]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/choice.h
?lk
[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 #include "wx/ctrlsub.h"
20
21 WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr;
22
23 // Choice item
24 class WXDLLEXPORT wxChoice: public wxControlWithItems
25 {
26 DECLARE_DYNAMIC_CLASS(wxChoice)
27
28 public:
29 wxChoice();
30 ~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 Create(parent, id, pos, size, n, choices, style, validator, name);
41 }
42
43 bool Create(wxWindow *parent, wxWindowID id,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 int n = 0, const wxString choices[] = NULL,
47 long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
49 const wxString& name = wxChoiceNameStr);
50
51 // Virtual functions required by wxControlWithItems.
52 // They are not all implemented yet :-(
53 virtual int GetCount() const;
54 virtual int DoAppend(const wxString& item);
55 virtual void DoInsertItems(const wxArrayString& items, int pos);
56 virtual void DoSetItems(const wxArrayString& items, void **clientData);
57 virtual void DoSetFirstItem(int n);
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 void Select(int n);
63 virtual void SetString(int n, const wxString& s);
64
65 // Original API
66 virtual void Append(const wxString& item);
67 virtual void Delete(int n);
68 virtual void Clear();
69 virtual int GetSelection() const ;
70 virtual void SetSelection(int n);
71 virtual int FindString(const wxString& s) const;
72 virtual wxString GetString(int n) const ;
73
74 virtual wxString GetStringSelection() const ;
75 virtual bool SetStringSelection(const wxString& sel);
76
77 virtual int Number() const { return m_noStrings; }
78 virtual void Command(wxCommandEvent& event);
79
80 virtual void SetColumns(int n = 1 );
81 virtual int GetColumns() const ;
82
83 void SetFocus();
84
85 // Implementation
86 virtual void ChangeFont(bool keepOriginalSize = TRUE);
87 virtual void ChangeBackgroundColour();
88 virtual void ChangeForegroundColour();
89 WXWidget GetTopWidget() const { return m_formWidget; }
90 WXWidget GetMainWidget() const { return m_buttonWidget; }
91
92 protected:
93 int m_noStrings;
94 WXWidget m_menuWidget;
95 WXWidget m_buttonWidget;
96 WXWidget* m_widgetList ;
97 WXWidget m_formWidget;
98 wxStringList m_stringList;
99
100 virtual void DoSetSize(int x, int y,
101 int width, int height,
102 int sizeFlags = wxSIZE_AUTO);
103 };
104
105 #endif
106 // _WX_CHOICE_H_