]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/choice.h
Added wxSYS_TABLET_PRESENT to check for tablet capability
[wxWidgets.git] / include / wx / msw / choice.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
853dcc57 2// Name: wx/msw/choice.h
2bda0e17
KB
3// Purpose: wxChoice class
4// Author: Julian Smart
8d99be5f 5// Modified by: Vadim Zeitlin to derive from wxChoiceBase
2bda0e17
KB
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc 8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_CHOICE_H_
13#define _WX_CHOICE_H_
2bda0e17 14
8d99be5f 15// ----------------------------------------------------------------------------
2bda0e17 16// Choice item
8d99be5f
VZ
17// ----------------------------------------------------------------------------
18
19class WXDLLEXPORT wxChoice : public wxChoiceBase
2bda0e17 20{
bfc6fde4 21public:
8d99be5f 22 // ctors
6ba93d23 23 wxChoice() { Init(); }
8ee9d618 24 virtual ~wxChoice();
8d99be5f
VZ
25
26 wxChoice(wxWindow *parent,
27 wxWindowID id,
28 const wxPoint& pos = wxDefaultPosition,
29 const wxSize& size = wxDefaultSize,
30 int n = 0, const wxString choices[] = NULL,
31 long style = 0,
32 const wxValidator& validator = wxDefaultValidator,
6463b9f5
JS
33 const wxString& name = wxChoiceNameStr)
34 {
94500b32 35 Init();
6463b9f5
JS
36 Create(parent, id, pos, size, n, choices, style, validator, name);
37 }
6ba93d23 38
584ad2a3
MB
39 wxChoice(wxWindow *parent,
40 wxWindowID id,
41 const wxPoint& pos,
42 const wxSize& size,
43 const wxArrayString& choices,
44 long style = 0,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxChoiceNameStr)
47 {
94500b32 48 Init();
584ad2a3
MB
49 Create(parent, id, pos, size, choices, style, validator, name);
50 }
bfc6fde4 51
8d99be5f
VZ
52 bool Create(wxWindow *parent,
53 wxWindowID id,
54 const wxPoint& pos = wxDefaultPosition,
55 const wxSize& size = wxDefaultSize,
56 int n = 0, const wxString choices[] = NULL,
57 long style = 0,
58 const wxValidator& validator = wxDefaultValidator,
59 const wxString& name = wxChoiceNameStr);
584ad2a3
MB
60 bool Create(wxWindow *parent,
61 wxWindowID id,
62 const wxPoint& pos,
63 const wxSize& size,
64 const wxArrayString& choices,
65 long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxChoiceNameStr);
8d99be5f
VZ
68
69 // implement base class pure virtuals
4cd056a7 70 virtual int DoAppend(const wxString& item);
243dbf1a 71 virtual int DoInsert(const wxString& item, int pos);
bfc6fde4
VZ
72 virtual void Delete(int n);
73 virtual void Clear();
8d99be5f
VZ
74
75 virtual int GetCount() const;
76 virtual int GetSelection() const;
6ba93d23 77 virtual int GetCurrentSelection() const;
bfc6fde4 78 virtual void SetSelection(int n);
bfc6fde4 79
853dcc57 80 virtual int FindString(const wxString& s, bool bCase = false) const;
8d99be5f 81 virtual wxString GetString(int n) const;
6c8a980f 82 virtual void SetString(int n, const wxString& s);
bfc6fde4 83
8d99be5f 84 // MSW only
bfc6fde4 85 virtual bool MSWCommand(WXUINT param, WXWORD id);
c140b7e7 86 WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
2bae4332 87 virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd);
bbcdf8bc
JS
88
89protected:
6ba93d23
VZ
90 // common part of all ctors
91 void Init() { m_lastAcceptedSelection = wxID_NONE; }
92
18c50997 93 virtual void DoMoveWindow(int x, int y, int width, int height);
6c8a980f
VZ
94 virtual void DoSetItemClientData( int n, void* clientData );
95 virtual void* DoGetItemClientData( int n ) const;
96 virtual void DoSetItemClientObject( int n, wxClientData* clientData );
97 virtual wxClientData* DoGetItemClientObject( int n ) const;
bbcdf8bc 98
8d99be5f 99 // MSW implementation
882a8f40 100 virtual wxSize DoGetBestSize() const;
d99957b6 101 virtual void DoGetSize(int *w, int *h) const;
bfc6fde4 102 virtual void DoSetSize(int x, int y,
4438caf4
VZ
103 int width, int height,
104 int sizeFlags = wxSIZE_AUTO);
8ee9d618 105
4b17d2e3
DS
106 virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg);
107
71e57cd6
VZ
108 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
109
71e57cd6
VZ
110 // update the height of the drop down list to fit the number of items we
111 // have (without changing the visible height)
112 void UpdateVisibleHeight();
113
114 // create and initialize the control
115 bool CreateAndInit(wxWindow *parent, wxWindowID id,
116 const wxPoint& pos,
117 const wxSize& size,
118 int n, const wxString choices[],
119 long style,
120 const wxValidator& validator,
121 const wxString& name);
122
8ee9d618
VZ
123 // free all memory we have (used by Clear() and dtor)
124 void Free();
fc7a2a60 125
6ba93d23
VZ
126
127 // last "completed" selection, i.e. not the transient one while the user is
128 // browsing the popup list: this is only used when != wxID_NONE which is
129 // the case while the drop down is opened
130 int m_lastAcceptedSelection;
131
132
fc7a2a60 133 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice)
2bda0e17
KB
134};
135
8d99be5f 136#endif // _WX_CHOICE_H_