]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/choice.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / motif / choice.h
CommitLineData
9b6dbb09 1/////////////////////////////////////////////////////////////////////////////
853dcc57 2// Name: wx/motif/choice.h
9b6dbb09
JS
3// Purpose: wxChoice class
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
9b6dbb09 7// Copyright: (c) Julian Smart
853dcc57 8// Licence: wxWindows licence
9b6dbb09
JS
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_CHOICE_H_
12#define _WX_CHOICE_H_
13
ec75d791 14#include "wx/clntdata.h"
ec75d791 15
3bdb8629
MB
16#ifndef wxWIDGET_ARRAY_DEFINED
17 #define wxWIDGET_ARRAY_DEFINED
18
19 #include "wx/dynarray.h"
4b4f6e0f 20 WX_DEFINE_ARRAY_PTR(WXWidget, wxWidgetArray);
3bdb8629 21#endif
ec75d791 22
9b6dbb09 23// Choice item
53a2db12 24class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase
9b6dbb09 25{
bfc6fde4 26 DECLARE_DYNAMIC_CLASS(wxChoice)
ec75d791 27
bfc6fde4
VZ
28public:
29 wxChoice();
d3c7fc99 30 virtual ~wxChoice();
853dcc57 31
bfc6fde4 32 wxChoice(wxWindow *parent, wxWindowID id,
83df96d6
JS
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)
bfc6fde4 39 {
ec75d791 40 Init();
bfc6fde4
VZ
41 Create(parent, id, pos, size, n, choices, style, validator, name);
42 }
853dcc57 43
584ad2a3
MB
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
bfc6fde4 56 bool Create(wxWindow *parent, wxWindowID id,
83df96d6
JS
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,
584ad2a3
MB
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,
83df96d6 70 const wxString& name = wxChoiceNameStr);
ec75d791
MB
71
72 // implementation of wxControlWithItems
aa61d352 73 virtual unsigned int GetCount() const;
ec75d791 74 virtual int GetSelection() const;
a236aa20
VZ
75 virtual void DoDeleteOneItem(unsigned int n);
76 virtual void DoClear();
aa61d352
VZ
77 virtual void SetString(unsigned int n, const wxString& s);
78 virtual wxString GetString(unsigned int n) const;
ec75d791
MB
79
80 // implementation of wxChoiceBase
bfc6fde4 81 virtual void SetSelection(int n);
bfc6fde4
VZ
82 virtual void SetColumns(int n = 1 );
83 virtual int GetColumns() const ;
853dcc57
WS
84
85 // Original API
ec75d791 86 virtual void Command(wxCommandEvent& event);
853dcc57 87
bfc6fde4 88 void SetFocus();
853dcc57 89
bfc6fde4 90 // Implementation
96be256b 91 virtual void ChangeFont(bool keepOriginalSize = true);
bfc6fde4
VZ
92 virtual void ChangeBackgroundColour();
93 virtual void ChangeForegroundColour();
94 WXWidget GetTopWidget() const { return m_formWidget; }
95 WXWidget GetMainWidget() const { return m_buttonWidget; }
ec75d791
MB
96
97 virtual wxSize DoGetBestSize() const;
98
99 // implementation, for wxChoiceCallback
100 const wxWidgetArray& GetWidgets() const { return m_widgetArray; }
58045daa 101 const wxArrayString& GetStrings() const { return m_stringArray; }
9b6dbb09 102protected:
ec75d791
MB
103 // minimum size for the text ctrl
104 wxSize GetItemsSize() const;
105 // common part of all contructors
106 void Init();
107
bfc6fde4
VZ
108 WXWidget m_menuWidget;
109 WXWidget m_buttonWidget;
ec75d791 110 wxWidgetArray m_widgetArray;
bfc6fde4 111 WXWidget m_formWidget;
58045daa 112 wxArrayString m_stringArray;
853dcc57 113
bfc6fde4 114 virtual void DoSetSize(int x, int y,
83df96d6
JS
115 int width, int height,
116 int sizeFlags = wxSIZE_AUTO);
a236aa20
VZ
117
118 // implementation of wxControlWithItems
119 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
120 unsigned int pos,
121 void **clientData, wxClientDataType type);
9b6dbb09
JS
122};
123
a236aa20 124#endif // _WX_CHOICE_H_