Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

mgButtonListPanel Class Reference

#include <PaletteDlg.h>

Inheritance diagram for mgButtonListPanel:

mgMathBoxWndUser mgCapitalGreekPanel mgSmallGreekPanel mgSpecialSymPanel List of all members.

Detailed Description

A little class which makes the creation of "MathGUI palettes" much easier.

For "palettes" I mean those dialog boxes with a smaller title bar, containing various buttons which can be used by the user to insert/edit/manipulate the math data of the main mgMathBox/mgMathWnd object. They are, thus, a sort of toolbars.

To keep the same look & feel for all the palettes, all the palettes should derive from this class, which provides the default creation settings.

Definition at line 92 of file PaletteDlg.h.

Public Member Functions

 mgButtonListPanel (wxWindow *parent, wxWindow *client, mgMathWnd *mathwnd, mgMathBox *mathbox, int cols, int rows, int baseid, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
 Constructs this dialog.

Protected Member Functions

Utilities
Some functions which manipulate the sizer.

virtual void BuildPanel (int border=5, int proportion=30)
 Sets all the rows of the main sizer as growable and then sets up the main sizer of the palette.
virtual void BuildSizer ()
 Builds the main sizer of this palette.
void AddHorizontalSpacer ()
 Adds to the main sizer a row of spacers.
void AddButtonsToSizer (int idoffset, int num, wxSize sz)
 Adds 'num' buttons to the main sizer, with the given size; Retrieves the button label and tooltop using the GetButtonLabel and GetButtonTooltip functions.
wxSize FindBiggestLetter (const wxString &str)
 Using the font for the button labels, finds the biggest character of the given string and then returns its size.
int GetDefaultWidth (const wxString &str)
 Returns the default width of this window if each character of the given string is a toolbutton.
int GetDefaultHeight (const wxString &str)
void SetFontButtonPointSize (int pointsize)
void UpdateFontButton ()
void OnSize (wxSizeEvent &)
void SetClientWindow (wxWindow *p)
 Resets the client windows of the wxPaletteButtons which are built through the AddButtonsToSizer...
virtual int GetButtonID (wxCommandEvent &) const
 Returns the index of the pressed button with the given event.
int GetColCount () const
int GetRowCount () const
int GetBaseID () const
 Returns the wxWidgets ID of the first button of the palette; all the following buttons' ID are obtained increasing this value.
Abstract functions
The abstract functions which must be implemented in derived classes.

virtual wxString GetButtonLabel (int n)=0
 Returns the label of the n-th button.
virtual wxString GetButtonTooltip (int n)=0
 Returns the tooltip for the n-th button.

Protected Attributes

int m_nColumns
 The list of the wxSizers used to contain the buttons.
int m_nRows
 The list of the wxSizers used to contain the buttons.
int m_nBaseID
wxWindow * m_pClientWnd
 The window which is used to init the client windows of the wxPaletteButtons; that is, the window where focus is set when the button is clicked.
bool m_bBuildComplete
 TRUE if all the windows, controls, sizers ....
wxFont m_fButtons
 The font which is used to draw the button labels.
float m_fButtonFontRatio
bool m_bEnableFontButtonUpdate


Constructor & Destructor Documentation

mgButtonListPanel::mgButtonListPanel wxWindow *  parent,
wxWindow *  client,
mgMathWnd mathwnd,
mgMathBox mathbox,
int  cols,
int  rows,
int  baseid,
wxWindowID  id = -1,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
[inline]
 

Constructs this dialog.

This function works as the standard wxWindow constructors, with just two new parameters:

Parameters:
mathwnd The math window whose selected mathbox receives the commands.
mathbox The math box which receives the 'create greek symbol' commands.

Definition at line 203 of file PaletteDlg.h.

References m_bBuildComplete, m_nColumns, m_nRows, and m_pClientWnd.


Member Function Documentation

void mgButtonListPanel::BuildSizer  )  [protected, virtual]
 

Builds the main sizer of this palette.

Derived-classes should call this function as first thing in their constructors.

Definition at line 149 of file PaletteDlg.cpp.

Referenced by mgCapitalGreekPanel::mgCapitalGreekPanel(), and mgSmallGreekPanel::mgSmallGreekPanel().

int mgButtonListPanel::GetButtonID wxCommandEvent &   )  const [protected, virtual]
 

Returns the index of the pressed button with the given event.

The index is zero-based.

Definition at line 155 of file PaletteDlg.cpp.

References GetBaseID().


Member Data Documentation

bool mgButtonListPanel::m_bBuildComplete [protected]
 

TRUE if all the windows, controls, sizers ....

have been added and the palette is ready to work.

Definition at line 110 of file PaletteDlg.h.

Referenced by mgButtonListPanel().

int mgButtonListPanel::m_nColumns [protected]
 

The list of the wxSizers used to contain the buttons.

Each of them is separed by the previous with a wxStaticLine.

Definition at line 100 of file PaletteDlg.h.

Referenced by mgButtonListPanel().

int mgButtonListPanel::m_nRows [protected]
 

The list of the wxSizers used to contain the buttons.

Each of them is separed by the previous with a wxStaticLine.

Definition at line 100 of file PaletteDlg.h.

Referenced by mgButtonListPanel().


The documentation for this class was generated from the following files:

Documentation generated with Doxygen on Sun Feb 6 17:19:27 2005
Visit MathStudio home page for more info

[ Top ]