Calss interface updates (wxMotif-only).
Made wxCheckBox inherit from wxChekBoxBase. Corrected virtual function hiding in wxListBox. Made wxRadioBox inherit from wxRadioBoxBase. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16306 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
4e9cbd33d0
commit
18128cbb47
@ -22,7 +22,7 @@ WXDLLEXPORT_DATA(extern const char*) wxCheckBoxNameStr;
|
|||||||
|
|
||||||
// Checkbox item (single checkbox)
|
// Checkbox item (single checkbox)
|
||||||
class WXDLLEXPORT wxBitmap;
|
class WXDLLEXPORT wxBitmap;
|
||||||
class WXDLLEXPORT wxCheckBox: public wxControl
|
class WXDLLEXPORT wxCheckBox: public wxCheckBoxBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
||||||
|
|
||||||
|
@ -70,6 +70,8 @@ public:
|
|||||||
virtual void Append(const wxString& item);
|
virtual void Append(const wxString& item);
|
||||||
virtual void Append(const wxString& item, void *clientData);
|
virtual void Append(const wxString& item, void *clientData);
|
||||||
virtual void Set(int n, const wxString* choices, void **clientData = NULL);
|
virtual void Set(int n, const wxString* choices, void **clientData = NULL);
|
||||||
|
void Set(const wxArrayString& items, void **clientData = NULL)
|
||||||
|
{ DoSetItems(items, clientData); }
|
||||||
virtual int FindString(const wxString& s) const ;
|
virtual int FindString(const wxString& s) const ;
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
virtual void SetSelection(int n, bool select = TRUE);
|
virtual void SetSelection(int n, bool select = TRUE);
|
||||||
@ -96,7 +98,9 @@ public:
|
|||||||
virtual void SetFirstItem(const wxString& s) ;
|
virtual void SetFirstItem(const wxString& s) ;
|
||||||
|
|
||||||
virtual void InsertItems(int nItems, const wxString items[], int pos);
|
virtual void InsertItems(int nItems, const wxString items[], int pos);
|
||||||
|
void InsertItems(const wxArrayString& items, int pos)
|
||||||
|
{ DoInsertItems(items, pos); }
|
||||||
|
|
||||||
virtual wxString GetStringSelection() const ;
|
virtual wxString GetStringSelection() const ;
|
||||||
virtual bool SetStringSelection(const wxString& s, bool flag = TRUE);
|
virtual bool SetStringSelection(const wxString& s, bool flag = TRUE);
|
||||||
virtual int Number() const ;
|
virtual int Number() const ;
|
||||||
|
@ -23,7 +23,7 @@ WXDLLEXPORT_DATA(extern const char*) wxRadioBoxNameStr;
|
|||||||
// List box item
|
// List box item
|
||||||
class WXDLLEXPORT wxBitmap ;
|
class WXDLLEXPORT wxBitmap ;
|
||||||
|
|
||||||
class WXDLLEXPORT wxRadioBox : public wxControl
|
class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
||||||
|
|
||||||
@ -50,12 +50,9 @@ public:
|
|||||||
int FindString(const wxString& s) const;
|
int FindString(const wxString& s) const;
|
||||||
void SetSelection(int N);
|
void SetSelection(int N);
|
||||||
int GetSelection() const;
|
int GetSelection() const;
|
||||||
wxString GetString(int N) const;
|
|
||||||
|
|
||||||
void SetLabel(const wxString& label) { wxControl::SetLabel(label); };
|
void SetString(int item, const wxString& label) ;
|
||||||
void SetLabel(int item, const wxString& label) ;
|
wxString GetString(int item) const;
|
||||||
wxString GetLabel(int item) const;
|
|
||||||
wxString GetLabel() const { return wxControl::GetLabel(); };
|
|
||||||
virtual bool Enable(bool enable = TRUE);
|
virtual bool Enable(bool enable = TRUE);
|
||||||
void Enable(int item, bool enable);
|
void Enable(int item, bool enable);
|
||||||
void Show(int item, bool show) ;
|
void Show(int item, bool show) ;
|
||||||
@ -66,6 +63,9 @@ public:
|
|||||||
virtual int GetCount() const { return m_noItems; } ;
|
virtual int GetCount() const { return m_noItems; } ;
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
|
|
||||||
|
int GetColumnCount() const;
|
||||||
|
int GetRowCount() const;
|
||||||
|
|
||||||
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
||||||
void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
||||||
|
|
||||||
|
@ -215,34 +215,7 @@ wxRadioBox::~wxRadioBox()
|
|||||||
m_labelWidget = (WXWidget) 0;
|
m_labelWidget = (WXWidget) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxRadioBox::GetLabel(int item) const
|
void wxRadioBox::SetString(int item, const wxString& label)
|
||||||
{
|
|
||||||
if (item < 0 || item >= m_noItems)
|
|
||||||
return wxEmptyString;
|
|
||||||
|
|
||||||
Widget widget = (Widget) m_radioButtons[item];
|
|
||||||
XmString text;
|
|
||||||
char *s;
|
|
||||||
XtVaGetValues (widget,
|
|
||||||
XmNlabelString, &text,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
|
||||||
{
|
|
||||||
// Should we free 'text'???
|
|
||||||
XmStringFree(text);
|
|
||||||
wxString str(s);
|
|
||||||
XtFree (s);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
XmStringFree(text);
|
|
||||||
return wxEmptyString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRadioBox::SetLabel(int item, const wxString& label)
|
|
||||||
{
|
{
|
||||||
if (item < 0 || item >= m_noItems)
|
if (item < 0 || item >= m_noItems)
|
||||||
return;
|
return;
|
||||||
@ -391,10 +364,10 @@ void wxRadioBox::Show(int n, bool show)
|
|||||||
|
|
||||||
// Please note that this is all we can do: removing the label
|
// Please note that this is all we can do: removing the label
|
||||||
// if switching to unshow state. However, when switching
|
// if switching to unshow state. However, when switching
|
||||||
// to the on state, it's the prog. resp. to call SetLabel(item,...)
|
// to the on state, it's the prog. resp. to call SetString(item,...)
|
||||||
// after this call!!
|
// after this call!!
|
||||||
if (!show)
|
if (!show)
|
||||||
wxRadioBox::SetLabel (n, " ");
|
wxRadioBox::SetString (n, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
// For single selection items only
|
// For single selection items only
|
||||||
@ -477,6 +450,23 @@ void wxRadioBox::ChangeForegroundColour()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int CalcOtherDim( int items, int dim )
|
||||||
|
{
|
||||||
|
return items / dim + ( items % dim ? 1 : 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxRadioBox::GetRowCount() const
|
||||||
|
{
|
||||||
|
return m_windowStyle & wxRA_SPECIFY_ROWS ? m_noRowsOrCols
|
||||||
|
: CalcOtherDim( GetCount(), m_noRowsOrCols );
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxRadioBox::GetColumnCount() const
|
||||||
|
{
|
||||||
|
return m_windowStyle & wxRA_SPECIFY_COLS ? m_noRowsOrCols
|
||||||
|
: CalcOtherDim( GetCount(), m_noRowsOrCols );
|
||||||
|
}
|
||||||
|
|
||||||
void wxRadioBoxCallback (Widget w, XtPointer clientData,
|
void wxRadioBoxCallback (Widget w, XtPointer clientData,
|
||||||
XmToggleButtonCallbackStruct * cbs)
|
XmToggleButtonCallbackStruct * cbs)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user