1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/combobox.h
3 // Purpose: wxComboBox class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_COMBOBOX_H_
13 #define _WX_COMBOBOX_H_
15 #include "wx/choice.h"
16 #include "wx/textentry.h"
19 class WXDLLIMPEXP_CORE wxComboBox
: public wxChoice
,
23 wxComboBox() { m_inSetSelection
= false; }
24 virtual ~wxComboBox();
26 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
27 const wxString
& value
= wxEmptyString
,
28 const wxPoint
& pos
= wxDefaultPosition
,
29 const wxSize
& size
= wxDefaultSize
,
30 int n
= 0, const wxString choices
[] = NULL
,
32 const wxValidator
& validator
= wxDefaultValidator
,
33 const wxString
& name
= wxComboBoxNameStr
)
35 m_inSetSelection
= false;
36 Create(parent
, id
, value
, pos
, size
, n
, choices
,
37 style
, validator
, name
);
40 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
41 const wxString
& value
,
44 const wxArrayString
& choices
,
46 const wxValidator
& validator
= wxDefaultValidator
,
47 const wxString
& name
= wxComboBoxNameStr
)
49 m_inSetSelection
= false;
50 Create(parent
, id
, value
, pos
, size
, choices
,
51 style
, validator
, name
);
54 bool Create(wxWindow
*parent
, wxWindowID id
,
55 const wxString
& value
= wxEmptyString
,
56 const wxPoint
& pos
= wxDefaultPosition
,
57 const wxSize
& size
= wxDefaultSize
,
58 int n
= 0, const wxString choices
[] = NULL
,
60 const wxValidator
& validator
= wxDefaultValidator
,
61 const wxString
& name
= wxComboBoxNameStr
);
63 bool Create(wxWindow
*parent
, wxWindowID id
,
64 const wxString
& value
,
67 const wxArrayString
& choices
,
69 const wxValidator
& validator
= wxDefaultValidator
,
70 const wxString
& name
= wxComboBoxNameStr
);
72 // resolve ambiguities among virtual functions inherited from both base
75 virtual wxString
GetValue() const { return wxTextEntry::GetValue(); }
76 virtual void SetValue(const wxString
& value
);
77 virtual wxString
GetStringSelection() const
78 { return wxChoice::GetStringSelection(); }
80 virtual void SetSelection(long from
, long to
)
81 { wxTextEntry::SetSelection(from
, to
); }
82 virtual void GetSelection(long *from
, long *to
) const
83 { wxTextEntry::GetSelection(from
, to
); }
86 // implementation of wxControlWithItems
87 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
89 void **clientData
, wxClientDataType type
);
90 virtual void DoDeleteOneItem(unsigned int n
);
91 virtual int GetSelection() const ;
92 virtual void SetSelection(int n
);
93 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
94 virtual wxString
GetString(unsigned int n
) const ;
95 virtual void SetString(unsigned int n
, const wxString
& s
);
98 virtual void ChangeFont(bool keepOriginalSize
= true);
99 virtual void ChangeBackgroundColour();
100 virtual void ChangeForegroundColour();
101 WXWidget
GetTopWidget() const { return m_mainWidget
; }
102 WXWidget
GetMainWidget() const { return m_mainWidget
; }
105 virtual wxSize
DoGetBestSize() const;
106 virtual void DoSetSize(int x
, int y
,
107 int width
, int height
,
108 int sizeFlags
= wxSIZE_AUTO
);
110 // implement wxTextEntry pure virtual methods
111 virtual wxWindow
*GetEditableWindow() { return this; }
112 virtual WXWidget
GetTextWidget() const;
115 // only implemented for native combo box
116 void AdjustDropDownListSize();
118 // implementation detail, should really be private
120 bool m_inSetSelection
;
122 DECLARE_DYNAMIC_CLASS(wxComboBox
)
125 #endif // _WX_COMBOBOX_H_