]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/combobox.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / motif / combobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/combobox.h
3 // Purpose: wxComboBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_COMBOBOX_H_
12 #define _WX_COMBOBOX_H_
13
14 #include "wx/choice.h"
15 #include "wx/textentry.h"
16
17 // Combobox item
18 class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
19 public wxTextEntry
20 {
21 public:
22 wxComboBox() { m_inSetSelection = false; }
23 virtual ~wxComboBox();
24
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,
30 long style = 0,
31 const wxValidator& validator = wxDefaultValidator,
32 const wxString& name = wxComboBoxNameStr)
33 {
34 m_inSetSelection = false;
35 Create(parent, id, value, pos, size, n, choices,
36 style, validator, name);
37 }
38
39 inline wxComboBox(wxWindow *parent, wxWindowID id,
40 const wxString& value,
41 const wxPoint& pos,
42 const wxSize& size,
43 const wxArrayString& choices,
44 long style = 0,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxComboBoxNameStr)
47 {
48 m_inSetSelection = false;
49 Create(parent, id, value, pos, size, choices,
50 style, validator, name);
51 }
52
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,
58 long style = 0,
59 const wxValidator& validator = wxDefaultValidator,
60 const wxString& name = wxComboBoxNameStr);
61
62 bool Create(wxWindow *parent, wxWindowID id,
63 const wxString& value,
64 const wxPoint& pos,
65 const wxSize& size,
66 const wxArrayString& choices,
67 long style = 0,
68 const wxValidator& validator = wxDefaultValidator,
69 const wxString& name = wxComboBoxNameStr);
70
71 // See wxComboBoxBase discussion of IsEmpty().
72 bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
73 bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
74
75 // resolve ambiguities among virtual functions inherited from both base
76 // classes
77 virtual void Clear();
78 virtual wxString GetValue() const { return wxTextEntry::GetValue(); }
79 virtual void SetValue(const wxString& value);
80 virtual wxString GetStringSelection() const
81 { return wxChoice::GetStringSelection(); }
82
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); }
87
88
89 // implementation of wxControlWithItems
90 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
91 unsigned int pos,
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);
99
100 // Implementation
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; }
106
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") ); }
110
111 protected:
112 virtual wxSize DoGetBestSize() const;
113 virtual void DoSetSize(int x, int y,
114 int width, int height,
115 int sizeFlags = wxSIZE_AUTO);
116
117 // implement wxTextEntry pure virtual methods
118 virtual wxWindow *GetEditableWindow() { return this; }
119 virtual WXWidget GetTextWidget() const;
120
121 private:
122 // only implemented for native combo box
123 void AdjustDropDownListSize();
124
125 // implementation detail, should really be private
126 public:
127 bool m_inSetSelection;
128
129 DECLARE_DYNAMIC_CLASS(wxComboBox)
130 };
131
132 #endif // _WX_COMBOBOX_H_