]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: choice.h | |
3 | // Purpose: wxChoice class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc JS |
8 | // Copyright: (c) Julian Smart |
9 | // Licence: wxWindows licence | |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_CHOICE_H_ |
13 | #define _WX_CHOICE_H_ | |
2bda0e17 KB |
14 | |
15 | #ifdef __GNUG__ | |
16 | #pragma interface "choice.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/control.h" | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr; | |
22 | ||
23 | // Choice item | |
24 | class WXDLLEXPORT wxChoice: public wxControl | |
25 | { | |
26 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
27 | ||
28 | public: | |
bbcdf8bc | 29 | inline wxChoice(void) { m_noStrings = 0; } |
2bda0e17 | 30 | |
debe6624 | 31 | inline wxChoice(wxWindow *parent, wxWindowID id, |
2bda0e17 KB |
32 | const wxPoint& pos = wxDefaultPosition, |
33 | const wxSize& size = wxDefaultSize, | |
debe6624 JS |
34 | int n = 0, const wxString choices[] = NULL, |
35 | long style = 0, | |
2bda0e17 KB |
36 | const wxValidator& validator = wxDefaultValidator, |
37 | const wxString& name = wxChoiceNameStr) | |
38 | { | |
39 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
40 | } | |
41 | ||
debe6624 | 42 | bool Create(wxWindow *parent, wxWindowID id, |
2bda0e17 KB |
43 | const wxPoint& pos = wxDefaultPosition, |
44 | const wxSize& size = wxDefaultSize, | |
debe6624 JS |
45 | int n = 0, const wxString choices[] = NULL, |
46 | long style = 0, | |
2bda0e17 KB |
47 | const wxValidator& validator = wxDefaultValidator, |
48 | const wxString& name = wxChoiceNameStr); | |
49 | ||
50 | virtual void Append(const wxString& item); | |
debe6624 | 51 | virtual void Delete(int n); |
2bda0e17 KB |
52 | virtual void Clear(void); |
53 | virtual int GetSelection(void) const ; | |
debe6624 | 54 | virtual void SetSelection(int n); |
2bda0e17 | 55 | virtual int FindString(const wxString& s) const; |
debe6624 JS |
56 | virtual wxString GetString(int n) const ; |
57 | virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); | |
4fabb575 JS |
58 | void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) |
59 | { wxWindow::SetSize(rect, sizeFlags); } | |
60 | void SetSize(const wxSize& size) { wxWindow::SetSize(size); } | |
2bda0e17 KB |
61 | virtual wxString GetStringSelection(void) const ; |
62 | virtual bool SetStringSelection(const wxString& sel); | |
63 | ||
bbcdf8bc | 64 | virtual inline int Number(void) const { return m_noStrings; } |
2bda0e17 KB |
65 | virtual void Command(wxCommandEvent& event); |
66 | ||
debe6624 | 67 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
2bda0e17 | 68 | |
debe6624 | 69 | virtual inline void SetColumns(int WXUNUSED(n) = 1 ) { /* No effect */ } ; |
2bda0e17 KB |
70 | virtual inline int GetColumns(void) const { return 1 ; }; |
71 | ||
debe6624 | 72 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
2bda0e17 KB |
73 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
74 | ||
75 | long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
bbcdf8bc JS |
76 | |
77 | protected: | |
78 | int m_noStrings; | |
79 | ||
2bda0e17 KB |
80 | }; |
81 | ||
82 | #endif | |
bbcdf8bc | 83 | // _WX_CHOICE_H_ |