]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/choice.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / motif / choice.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/choice.h
3 // Purpose: wxChoice 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_CHOICE_H_
12 #define _WX_CHOICE_H_
13
14 #include "wx/clntdata.h"
15
16 #ifndef wxWIDGET_ARRAY_DEFINED
17 #define wxWIDGET_ARRAY_DEFINED
18
19 #include "wx/dynarray.h"
20 WX_DEFINE_ARRAY_PTR(WXWidget, wxWidgetArray);
21 #endif
22
23 // Choice item
24 class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase
25 {
26 DECLARE_DYNAMIC_CLASS(wxChoice)
27
28 public:
29 wxChoice();
30 virtual ~wxChoice();
31
32 wxChoice(wxWindow *parent, wxWindowID id,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 int n = 0, const wxString choices[] = NULL,
36 long style = 0,
37 const wxValidator& validator = wxDefaultValidator,
38 const wxString& name = wxChoiceNameStr)
39 {
40 Init();
41 Create(parent, id, pos, size, n, choices, style, validator, name);
42 }
43
44 wxChoice(wxWindow *parent, wxWindowID id,
45 const wxPoint& pos,
46 const wxSize& size,
47 const wxArrayString& choices,
48 long style = 0,
49 const wxValidator& validator = wxDefaultValidator,
50 const wxString& name = wxChoiceNameStr)
51 {
52 Init();
53 Create(parent, id, pos, size, choices, style, validator, name);
54 }
55
56 bool Create(wxWindow *parent, wxWindowID id,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
59 int n = 0, const wxString choices[] = NULL,
60 long style = 0,
61 const wxValidator& validator = wxDefaultValidator,
62 const wxString& name = wxChoiceNameStr);
63
64 bool Create(wxWindow *parent, wxWindowID id,
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 = wxChoiceNameStr);
71
72 // implementation of wxControlWithItems
73 virtual unsigned int GetCount() const;
74 virtual int GetSelection() const;
75 virtual void DoDeleteOneItem(unsigned int n);
76 virtual void DoClear();
77 virtual void SetString(unsigned int n, const wxString& s);
78 virtual wxString GetString(unsigned int n) const;
79
80 // implementation of wxChoiceBase
81 virtual void SetSelection(int n);
82 virtual void SetColumns(int n = 1 );
83 virtual int GetColumns() const ;
84
85 // Original API
86 virtual void Command(wxCommandEvent& event);
87
88 void SetFocus();
89
90 // Implementation
91 virtual void ChangeFont(bool keepOriginalSize = true);
92 virtual void ChangeBackgroundColour();
93 virtual void ChangeForegroundColour();
94 WXWidget GetTopWidget() const { return m_formWidget; }
95 WXWidget GetMainWidget() const { return m_buttonWidget; }
96
97 virtual wxSize DoGetBestSize() const;
98
99 // implementation, for wxChoiceCallback
100 const wxWidgetArray& GetWidgets() const { return m_widgetArray; }
101 const wxArrayString& GetStrings() const { return m_stringArray; }
102 protected:
103 // minimum size for the text ctrl
104 wxSize GetItemsSize() const;
105 // common part of all contructors
106 void Init();
107
108 WXWidget m_menuWidget;
109 WXWidget m_buttonWidget;
110 wxWidgetArray m_widgetArray;
111 WXWidget m_formWidget;
112 wxArrayString m_stringArray;
113
114 virtual void DoSetSize(int x, int y,
115 int width, int height,
116 int sizeFlags = wxSIZE_AUTO);
117
118 // implementation of wxControlWithItems
119 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
120 unsigned int pos,
121 void **clientData, wxClientDataType type);
122 };
123
124 #endif // _WX_CHOICE_H_