1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/combobox.h
3 // Purpose: wxComboBox class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_COMBOBOX_H_
12 #define _WX_COMBOBOX_H_
14 #include "wx/choice.h"
15 #include "wx/textentry.h"
18 class WXDLLIMPEXP_CORE wxComboBox
: public wxChoice
,
22 wxComboBox() { m_inSetSelection
= false; }
23 virtual ~wxComboBox();
25 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
26 const wxString
& value
= wxEmptyString
,
27 const wxPoint
& pos
= wxDefaultPosition
,
28 const wxSize
& size
= wxDefaultSize
,
29 int n
= 0, const wxString choices
[] = NULL
,
31 const wxValidator
& validator
= wxDefaultValidator
,
32 const wxString
& name
= wxComboBoxNameStr
)
34 m_inSetSelection
= false;
35 Create(parent
, id
, value
, pos
, size
, n
, choices
,
36 style
, validator
, name
);
39 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
40 const wxString
& value
,
43 const wxArrayString
& choices
,
45 const wxValidator
& validator
= wxDefaultValidator
,
46 const wxString
& name
= wxComboBoxNameStr
)
48 m_inSetSelection
= false;
49 Create(parent
, id
, value
, pos
, size
, choices
,
50 style
, validator
, name
);
53 bool Create(wxWindow
*parent
, wxWindowID id
,
54 const wxString
& value
= wxEmptyString
,
55 const wxPoint
& pos
= wxDefaultPosition
,
56 const wxSize
& size
= wxDefaultSize
,
57 int n
= 0, const wxString choices
[] = NULL
,
59 const wxValidator
& validator
= wxDefaultValidator
,
60 const wxString
& name
= wxComboBoxNameStr
);
62 bool Create(wxWindow
*parent
, wxWindowID id
,
63 const wxString
& value
,
66 const wxArrayString
& choices
,
68 const wxValidator
& validator
= wxDefaultValidator
,
69 const wxString
& name
= wxComboBoxNameStr
);
71 // See wxComboBoxBase discussion of IsEmpty().
72 bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
73 bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
75 // resolve ambiguities among virtual functions inherited from both base
78 virtual wxString
GetValue() const { return wxTextEntry::GetValue(); }
79 virtual void SetValue(const wxString
& value
);
80 virtual wxString
GetStringSelection() const
81 { return wxChoice::GetStringSelection(); }
83 virtual void SetSelection(long from
, long to
)
84 { wxTextEntry::SetSelection(from
, to
); }
85 virtual void GetSelection(long *from
, long *to
) const
86 { wxTextEntry::GetSelection(from
, to
); }
89 // implementation of wxControlWithItems
90 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
92 void **clientData
, wxClientDataType type
);
93 virtual void DoDeleteOneItem(unsigned int n
);
94 virtual int GetSelection() const ;
95 virtual void SetSelection(int n
);
96 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
97 virtual wxString
GetString(unsigned int n
) const ;
98 virtual void SetString(unsigned int n
, const wxString
& s
);
101 virtual void ChangeFont(bool keepOriginalSize
= true);
102 virtual void ChangeBackgroundColour();
103 virtual void ChangeForegroundColour();
104 WXWidget
GetTopWidget() const { return m_mainWidget
; }
105 WXWidget
GetMainWidget() const { return m_mainWidget
; }
107 //Copied from wxComboBoxBase because for wxMOTIF wxComboBox does not inherit from it.
108 virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); }
109 virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); }
112 virtual wxSize
DoGetBestSize() const;
113 virtual void DoSetSize(int x
, int y
,
114 int width
, int height
,
115 int sizeFlags
= wxSIZE_AUTO
);
117 // implement wxTextEntry pure virtual methods
118 virtual wxWindow
*GetEditableWindow() { return this; }
119 virtual WXWidget
GetTextWidget() const;
122 // only implemented for native combo box
123 void AdjustDropDownListSize();
125 // implementation detail, should really be private
127 bool m_inSetSelection
;
129 DECLARE_DYNAMIC_CLASS(wxComboBox
)
132 #endif // _WX_COMBOBOX_H_