]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/choice.h
Added a resource for Smartphone menubar
[wxWidgets.git] / include / wx / motif / choice.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "choice.h"
17 #endif
18
19 #include "wx/clntdata.h"
20 #include "wx/dynarray.h"
21
22 WX_DEFINE_ARRAY(WXWidget, wxWidgetArray);
23
24 // Choice item
25 class WXDLLEXPORT wxChoice: public wxChoiceBase
26 {
27 DECLARE_DYNAMIC_CLASS(wxChoice)
28
29 public:
30 wxChoice();
31 ~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 bool Create(wxWindow *parent, wxWindowID id,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 int n = 0, const wxString choices[] = NULL,
49 long style = 0,
50 const wxValidator& validator = wxDefaultValidator,
51 const wxString& name = wxChoiceNameStr);
52
53 // implementation of wxControlWithItems
54 virtual int GetCount() const;
55 virtual int DoAppend(const wxString& item);
56 virtual int DoInsert(const wxString& item, int pos);
57 virtual void DoSetItemClientData(int n, void* clientData);
58 virtual void* DoGetItemClientData(int n) const;
59 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
60 virtual wxClientData* DoGetItemClientObject(int n) const;
61 virtual int GetSelection() const;
62 virtual void Delete(int n);
63 virtual int FindString(const wxString& s) const;
64 virtual void Clear();
65 virtual void SetString(int n, const wxString& s);
66 virtual wxString GetString(int n) const;
67
68 // implementation of wxChoiceBase
69 virtual void SetSelection(int n);
70 virtual void SetColumns(int n = 1 );
71 virtual int GetColumns() const ;
72
73 // Original API
74 virtual void Command(wxCommandEvent& event);
75
76 void SetFocus();
77
78 // Implementation
79 virtual void ChangeFont(bool keepOriginalSize = TRUE);
80 virtual void ChangeBackgroundColour();
81 virtual void ChangeForegroundColour();
82 WXWidget GetTopWidget() const { return m_formWidget; }
83 WXWidget GetMainWidget() const { return m_buttonWidget; }
84
85 virtual wxSize DoGetBestSize() const;
86
87 // implementation, for wxChoiceCallback
88 const wxWidgetArray& GetWidgets() const { return m_widgetArray; }
89 const wxStringList& GetStrings() const { return m_stringList; }
90 protected:
91 // minimum size for the text ctrl
92 wxSize GetItemsSize() const;
93 // common part of all contructors
94 void Init();
95
96 size_t m_noStrings;
97 WXWidget m_menuWidget;
98 WXWidget m_buttonWidget;
99 wxWidgetArray m_widgetArray;
100 WXWidget m_formWidget;
101 wxStringList m_stringList;
102 wxClientDataDictionary m_clientDataDict;
103
104 virtual void DoSetSize(int x, int y,
105 int width, int height,
106 int sizeFlags = wxSIZE_AUTO);
107 };
108
109 #endif
110 // _WX_CHOICE_H_