1. moved m_majorDim duplicated in many ports to wxRadioBoxBase

2. also implement Getcolumn/RowCount() in it now and document them
3. removed various remains of old (pre-wxRadioBoxBase) cruft

sorry in advance for any compilation breakage on the platforms I can't test on


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-11-30 16:28:15 +00:00
parent 344d0d8821
commit 21e0a4d5f1
19 changed files with 111 additions and 318 deletions

View File

@@ -91,9 +91,6 @@ public:
// change the individual radio button state
virtual bool Enable(int n, bool enable = true);
virtual bool Show(int n, bool show = true);
// layout parameters
virtual int GetColumnCount() const;
virtual int GetRowCount() const;
protected:
virtual wxSize DoGetBestSize() const;
};

View File

@@ -66,10 +66,6 @@ public:
virtual bool Enable(int item, bool enable = true);
virtual bool Show(int item, bool show = true);
virtual int GetColumnCount() const ;
virtual int GetRowCount() const ;
virtual bool Enable(bool enable = true);
virtual wxString GetLabel() const;
virtual void SetLabel(const wxString& label) ;
@@ -87,7 +83,6 @@ public:
protected:
wxRadioButton *m_radioButtonCycle;
int m_majorDim ;
int m_noItems;
int m_noRowsOrCols;

View File

@@ -66,9 +66,6 @@ public:
virtual bool Enable(int item, bool enable = true);
virtual bool Show(int item, bool show = true);
virtual int GetColumnCount() const ;
virtual int GetRowCount() const ;
virtual bool Enable(bool enable = true);
virtual wxString GetLabel() const;
virtual void SetLabel(const wxString& label) ;
@@ -86,7 +83,6 @@ public:
protected:
wxRadioButton *m_radioButtonCycle;
int m_majorDim ;
int m_noItems;
int m_noRowsOrCols;

View File

@@ -87,9 +87,6 @@ public:
virtual int GetCount() const { return m_noItems; } ;
void Command(wxCommandEvent& event);
int GetColumnCount() const;
int GetRowCount() const;
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
@@ -106,7 +103,6 @@ protected:
int width, int height,
int sizeFlags = wxSIZE_AUTO);
int m_majorDim;
int m_noItems;
int m_noRowsOrCols;
int m_selectedButton;

View File

@@ -92,8 +92,6 @@ public:
virtual bool Show(int n, bool show = true);
virtual bool IsItemEnabled(int n) const;
virtual bool IsItemShown(int n) const;
virtual int GetColumnCount() const { return GetNumHor(); }
virtual int GetRowCount() const { return GetNumVer(); }
// override some base class methods
virtual bool Show(bool show = true);
@@ -117,10 +115,6 @@ public:
void SendNotificationEvent();
// get the number of buttons per column/row
int GetNumVer() const;
int GetNumHor() const;
protected:
// common part of all ctors
void Init();
@@ -158,10 +152,6 @@ protected:
int *m_radioWidth;
int *m_radioHeight;
// the number of elements in major dimension (i.e. number of columns if
// wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS)
int m_majorDim;
// currently selected button or wxNOT_FOUND if none
int m_selectedButton;

View File

@@ -125,16 +125,12 @@ public:
virtual int GetColumnCount(void) const;
virtual int GetCount(void) const;
inline int GetNumberOfRowsOrCols(void) const { return m_nNoRowsOrCols; }
int GetNumHor(void) const;
int GetNumVer(void) const;
void GetPosition( int* pnX
,int* pnY
) const;
inline WXHWND* GetRadioButtons(void) const { return m_ahRadioButtons; }
virtual int GetRowCount(void) const;
int GetSelection(void) const;
void GetSize( int* pnX
,int* pnY
@@ -183,7 +179,6 @@ protected:
WXHWND* m_ahRadioButtons;
int m_nMajorDim ;
int* m_pnRadioWidth; // for bitmaps
int* m_pnRadioHeight;
int m_nNoItems;

View File

@@ -101,9 +101,6 @@ public:
virtual void SetLabel(const wxString& label);
virtual wxString GetLabel();
virtual int GetColumnCount() const;
virtual int GetRowCount() const;
virtual void DoGetPosition( int *x, int *y ) const;
virtual void DoGetSize( int *width, int *height ) const;
virtual void DoMoveWindow(int x, int y, int width, int height);
@@ -129,10 +126,6 @@ public:
void SendNotificationEvent();
// get the number of buttons per column/row
int GetNumVer() const;
int GetNumHor() const;
protected:
// we can't compute our best size before the items are added to the control
virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { }
@@ -143,7 +136,6 @@ protected:
// get the total size occupied by the radio box buttons
wxSize GetTotalButtonSize(const wxSize& sizeBtn) const;
int m_majorDim;
int * m_radioWidth; // for bitmaps
int * m_radioHeight;

View File

@@ -36,9 +36,9 @@ public:
virtual bool IsItemEnabled(int WXUNUSED(n)) const { return true; }
virtual bool IsItemShown(int WXUNUSED(n)) const { return true; }
// layout parameters
virtual int GetColumnCount() const = 0;
virtual int GetRowCount() const = 0;
// return number of columns/rows in this radiobox
int GetColumnCount() const { return m_numCols; }
int GetRowCount() const { return m_numRows; }
// return the item above/below/to the left/right of the given one
int GetNextItem(int item, wxDirection dir, long style) const;
@@ -51,6 +51,30 @@ public:
wxDEPRECATED( int GetNumberOfRowsOrCols() const );
wxDEPRECATED( void SetNumberOfRowsOrCols(int n) );
#endif // WXWIN_COMPATIBILITY_2_4
protected:
wxRadioBoxBase()
{
m_majorDim = 0;
}
// return the number of items in major direction (which depends on whether
// we have wxRA_SPECIFY_COLS or wxRA_SPECIFY_ROWS style)
int GetMajorDim() const { return m_majorDim; }
// sets m_majorDim and also updates m_numCols/Rows
//
// the style parameter should be the style of the radiobox itself
void SetMajorDim(int majorDim, long style);
private:
// the number of elements in major dimension (i.e. number of columns if
// wxRA_SPECIFY_COLS or the number of rows if wxRA_SPECIFY_ROWS) and also
// the number of rows/columns calculated from it
int m_majorDim,
m_numCols,
m_numRows;
};
#if defined(__WXUNIVERSAL__)

View File

@@ -85,8 +85,6 @@ public:
virtual int GetSelection() const;
virtual int GetCount() const { return (int) m_buttons.GetCount(); }
virtual int GetColumnCount() const { return m_numCols; }
virtual int GetRowCount() const { return m_numRows; }
virtual wxString GetString(int n) const;
virtual void SetString(int n, const wxString& label);
@@ -128,24 +126,12 @@ protected:
// common part of all ctors
void Init();
// sets m_majorDim and calculate m_numCols and m_numRows
void SetMajorDim(int majorDim);
// calculate the max size of all buttons
wxSize GetMaxButtonSize() const;
// the currently selected radio button or -1
int m_selection;
// the parameters defining the button layout: majorDim meaning depends on
// the style and is the (max) number of columns if it includes
// wxRA_SPECIFY_COLS and is the (max) number of rows if it includes
// wxRA_SPECIFY_ROWS - the number of rows and columns is calculated from
// it
int m_majorDim,
m_numCols,
m_numRows;
// all radio buttons
wxArrayRadioButtons m_buttons;