]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: choice.h | |
3 | // Purpose: wxChoice class | |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
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/control.h" | |
20 | ||
56d4016a SC |
21 | #include <wx/dynarray.h> |
22 | ||
0dbd6262 SC |
23 | WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr; |
24 | ||
56d4016a SC |
25 | WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ; |
26 | ||
0dbd6262 | 27 | // Choice item |
56d4016a | 28 | class WXDLLEXPORT wxChoice: public wxChoiceBase |
0dbd6262 SC |
29 | { |
30 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
31 | ||
32 | public: | |
5b781a67 | 33 | wxChoice() {} |
5fde6fcc | 34 | virtual ~wxChoice() ; |
0dbd6262 | 35 | |
5b781a67 | 36 | wxChoice(wxWindow *parent, wxWindowID id, |
0dbd6262 SC |
37 | const wxPoint& pos = wxDefaultPosition, |
38 | const wxSize& size = wxDefaultSize, | |
39 | int n = 0, const wxString choices[] = NULL, | |
40 | long style = 0, | |
41 | const wxValidator& validator = wxDefaultValidator, | |
42 | const wxString& name = wxChoiceNameStr) | |
43 | { | |
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 | ||
5fde6fcc GD |
55 | // implement base class pure virtuals |
56 | virtual int DoAppend(const wxString& item); | |
0dbd6262 SC |
57 | virtual void Delete(int n); |
58 | virtual void Clear(); | |
5fde6fcc | 59 | |
56d4016a | 60 | virtual int GetCount() const ; |
0dbd6262 SC |
61 | virtual int GetSelection() const ; |
62 | virtual void SetSelection(int n); | |
5fde6fcc | 63 | |
0dbd6262 SC |
64 | virtual int FindString(const wxString& s) const; |
65 | virtual wxString GetString(int n) const ; | |
56d4016a SC |
66 | virtual void SetString( int , const wxString& s ) ; |
67 | void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ; | |
68 | ||
69 | /* | |
70 | virtual void Append(const wxString& item); | |
71 | // Added min Append and GetClientData | |
72 | virtual void Append(const wxString& item, void *client_data); | |
73 | virtual void *GetClientData(int index) const; | |
74 | virtual inline void Select( int n ) { SetSelection( n ); } | |
0dbd6262 SC |
75 | virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
76 | virtual wxString GetStringSelection() const ; | |
77 | virtual bool SetStringSelection(const wxString& sel); | |
78 | ||
5fde6fcc | 79 | // Mac specific |
0dbd6262 | 80 | virtual void Command(wxCommandEvent& event); |
5fde6fcc | 81 | void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ; |
0dbd6262 | 82 | |
0dbd6262 | 83 | virtual inline int GetColumns() const { return 1 ; }; |
56d4016a | 84 | */ |
0dbd6262 | 85 | protected: |
56d4016a SC |
86 | virtual void DoSetItemClientData( int n, void* clientData ); |
87 | virtual void* DoGetItemClientData( int n ) const; | |
88 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
89 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
90 | ||
56d4016a SC |
91 | // free all memory we have (used by Clear() and dtor) |
92 | void Free(); | |
93 | ||
05adb9d2 | 94 | wxArrayString m_strings; |
b668a735 | 95 | wxChoiceDataArray m_datas ; |
519cb848 | 96 | MenuHandle m_macPopUpMenuHandle ; |
0dbd6262 SC |
97 | }; |
98 | ||
99 | #endif | |
100 | // _WX_CHOICE_H_ |