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