]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/combobox.h
Convert wxFSW_EVENT_{WARNING,ERROR} to string correctly.
[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 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COMBOBOX_H_
13 #define _WX_COMBOBOX_H_
14
15 #include "wx/choice.h"
16 #include "wx/textentry.h"
17
18 // Combobox item
19 class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
20 public wxTextEntry
21 {
22 public:
23 wxComboBox() { m_inSetSelection = false; }
24 virtual ~wxComboBox();
25
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,
31 long style = 0,
32 const wxValidator& validator = wxDefaultValidator,
33 const wxString& name = wxComboBoxNameStr)
34 {
35 m_inSetSelection = false;
36 Create(parent, id, value, pos, size, n, choices,
37 style, validator, name);
38 }
39
40 inline wxComboBox(wxWindow *parent, wxWindowID id,
41 const wxString& value,
42 const wxPoint& pos,
43 const wxSize& size,
44 const wxArrayString& choices,
45 long style = 0,
46 const wxValidator& validator = wxDefaultValidator,
47 const wxString& name = wxComboBoxNameStr)
48 {
49 m_inSetSelection = false;
50 Create(parent, id, value, pos, size, choices,
51 style, validator, name);
52 }
53
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,
59 long style = 0,
60 const wxValidator& validator = wxDefaultValidator,
61 const wxString& name = wxComboBoxNameStr);
62
63 bool Create(wxWindow *parent, wxWindowID id,
64 const wxString& value,
65 const wxPoint& pos,
66 const wxSize& size,
67 const wxArrayString& choices,
68 long style = 0,
69 const wxValidator& validator = wxDefaultValidator,
70 const wxString& name = wxComboBoxNameStr);
71
72 // See wxComboBoxBase discussion of IsEmpty().
73 bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
74 bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
75
76 // resolve ambiguities among virtual functions inherited from both base
77 // classes
78 virtual void Clear();
79 virtual wxString GetValue() const { return wxTextEntry::GetValue(); }
80 virtual void SetValue(const wxString& value);
81 virtual wxString GetStringSelection() const
82 { return wxChoice::GetStringSelection(); }
83
84 virtual void SetSelection(long from, long to)
85 { wxTextEntry::SetSelection(from, to); }
86 virtual void GetSelection(long *from, long *to) const
87 { wxTextEntry::GetSelection(from, to); }
88
89
90 // implementation of wxControlWithItems
91 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
92 unsigned int pos,
93 void **clientData, wxClientDataType type);
94 virtual void DoDeleteOneItem(unsigned int n);
95 virtual int GetSelection() const ;
96 virtual void SetSelection(int n);
97 virtual int FindString(const wxString& s, bool bCase = false) const;
98 virtual wxString GetString(unsigned int n) const ;
99 virtual void SetString(unsigned int n, const wxString& s);
100
101 // Implementation
102 virtual void ChangeFont(bool keepOriginalSize = true);
103 virtual void ChangeBackgroundColour();
104 virtual void ChangeForegroundColour();
105 WXWidget GetTopWidget() const { return m_mainWidget; }
106 WXWidget GetMainWidget() const { return m_mainWidget; }
107
108 //Copied from wxComboBoxBase because for wxMOTIF wxComboBox does not inherit from it.
109 virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); }
110 virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); }
111
112 protected:
113 virtual wxSize DoGetBestSize() const;
114 virtual void DoSetSize(int x, int y,
115 int width, int height,
116 int sizeFlags = wxSIZE_AUTO);
117
118 // implement wxTextEntry pure virtual methods
119 virtual wxWindow *GetEditableWindow() { return this; }
120 virtual WXWidget GetTextWidget() const;
121
122 private:
123 // only implemented for native combo box
124 void AdjustDropDownListSize();
125
126 // implementation detail, should really be private
127 public:
128 bool m_inSetSelection;
129
130 DECLARE_DYNAMIC_CLASS(wxComboBox)
131 };
132
133 #endif // _WX_COMBOBOX_H_