Back to index

plt-scheme  4.2.1
Panel.h
Go to the documentation of this file.
00001 /*                                                      -*- C++ -*-
00002  *
00003  * Purpose: base class for all panels
00004  *
00005  * Authors: Markus Holzem and Julian Smart
00006  *
00007  * Copyright: (C) 2004-2009 PLT Scheme Inc.
00008  * Copyright: (C) 1995, AIAI, University of Edinburgh (Julian)
00009  * Copyright: (C) 1995, GNU (Markus)
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00024  * 02110-1301 USA.
00025  */
00026 
00027 #ifndef Panel_h
00028 #define Panel_h
00029 
00030 #ifdef __GNUG__
00031 #pragma interface
00032 #endif
00033 
00034 class wxButton;
00035 class wxColour;
00036 class wxCommandEvent;
00037 class wxItem;
00038 
00039 class wxPanel : public wxWindow {
00040 public:
00041     wxPanel(void); 
00042     wxPanel(wxWindow *parent, int x=-1, int y=-1, int width=-1, int height=-1,
00043            int style=0, char *name="panel");
00044     // panel creation
00045     Bool  Create(wxPanel *parent, 
00046                int x=-1, int y=-1, int width=-1, int height=-1,
00047                int style=0, char *name="panel");
00048     // resize/layout panel
00049     virtual void  GetClientSize(int *width, int *height);
00050     virtual void  Fit(void);
00051     virtual void  Layout(void);
00052     // data retrieved from wxItem and it's children
00053     // position of labels
00054     int   GetLabelPosition(void)           { return label_pos; }
00055     void  SetLabelPosition(int position)   { label_pos = position; }
00056     // positioning of items
00057     void  GetCursor(int *x, int *y);
00058     void  SetItemCursor(int x, int y);
00059     int   GetHorizontalSpacing(void)  { return h_space; }
00060     int   GetVerticalSpacing(void)    { return v_space; }
00061     void  NewLine(int pixels = 0);
00062     void  PositionItem(wxWindow *win, int x, int y, int width, int height);
00063     void  SetHorizontalSpacing(int sp)  { h_space = sp; }
00064     void  SetVerticalSpacing(int sp)    { v_space = sp; }
00065     void  Tab(int pixels = 0);
00066     // default item
00067     wxButton  *GetDefaultItem(void)  { return default_item; }
00068     // virtual event functions
00069     virtual void  OnDefaultAction(wxItem *item);
00070     // drawing
00071     wxPanelDC* GetPanelDC(void) { return dc; }
00072     virtual void ChangeToGray(Bool gray);
00073     virtual void ReleaseAllFocus();
00074     virtual Bool  WantsFocus(void);
00075 protected:
00076     friend class wxButton;  // allow access to default_item
00077 
00078     wxButton  *default_item;       // executed on default action
00079     int       label_pos;    // where to put the label
00080     int       cursor_x, cursor_y,
00081              h_space, v_space,
00082               v_line_extent; // for positioning of items
00083 };
00084 
00085 #endif // Panel_h