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