]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/choice.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/choice.h
3 // Purpose: wxChoice class
4 // Author: Julian Smart
5 // Modified by: Vadim Zeitlin to derive from wxChoiceBase
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 class WXDLLEXPORT wxChoice
: public wxChoiceBase
23 wxChoice() { Init(); }
26 wxChoice(wxWindow
*parent
,
28 const wxPoint
& pos
= wxDefaultPosition
,
29 const wxSize
& size
= wxDefaultSize
,
30 int n
= 0, const wxString choices
[] = NULL
,
32 const wxValidator
& validator
= wxDefaultValidator
,
33 const wxString
& name
= wxChoiceNameStr
)
36 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
39 wxChoice(wxWindow
*parent
,
43 const wxArrayString
& choices
,
45 const wxValidator
& validator
= wxDefaultValidator
,
46 const wxString
& name
= wxChoiceNameStr
)
49 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
52 bool Create(wxWindow
*parent
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
56 int n
= 0, const wxString choices
[] = NULL
,
58 const wxValidator
& validator
= wxDefaultValidator
,
59 const wxString
& name
= wxChoiceNameStr
);
60 bool Create(wxWindow
*parent
,
64 const wxArrayString
& choices
,
66 const wxValidator
& validator
= wxDefaultValidator
,
67 const wxString
& name
= wxChoiceNameStr
);
69 virtual void Delete(unsigned int n
);
72 virtual unsigned int GetCount() const;
73 virtual int GetSelection() const;
74 virtual int GetCurrentSelection() const;
75 virtual void SetSelection(int n
);
77 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
78 virtual wxString
GetString(unsigned int n
) const;
79 virtual void SetString(unsigned int n
, const wxString
& s
);
82 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
83 WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
84 virtual WXHBRUSH
MSWControlColor(WXHDC hDC
, WXHWND hWnd
);
85 virtual bool MSWShouldPreProcessMessage(WXMSG
*pMsg
);
86 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
89 // common part of all ctors
90 void Init() { m_lastAcceptedSelection
= wxID_NONE
; }
92 virtual int DoAppend(const wxString
& item
);
93 virtual int DoInsert(const wxString
& item
, unsigned int pos
);
94 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
95 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
96 virtual void* DoGetItemClientData(unsigned int n
) const;
97 virtual void DoSetItemClientObject(unsigned int n
, wxClientData
* clientData
);
98 virtual wxClientData
* DoGetItemClientObject(unsigned int n
) const;
100 // MSW implementation
101 virtual wxSize
DoGetBestSize() const;
102 virtual void DoGetSize(int *w
, int *h
) const;
103 virtual void DoSetSize(int x
, int y
,
104 int width
, int height
,
105 int sizeFlags
= wxSIZE_AUTO
);
107 // update the height of the drop down list to fit the number of items we
108 // have (without changing the visible height)
109 void UpdateVisibleHeight();
111 // create and initialize the control
112 bool CreateAndInit(wxWindow
*parent
, wxWindowID id
,
115 int n
, const wxString choices
[],
117 const wxValidator
& validator
,
118 const wxString
& name
);
120 // free all memory we have (used by Clear() and dtor)
124 // last "completed" selection, i.e. not the transient one while the user is
125 // browsing the popup list: this is only used when != wxID_NONE which is
126 // the case while the drop down is opened
127 int m_lastAcceptedSelection
;
130 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice
)
133 #endif // _WX_CHOICE_H_