]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/choice.h
fixes for moving wxHTML files into their own DLL
[wxWidgets.git] / include / wx / gtk / choice.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: choice.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKCHOICEH__
11 #define __GTKCHOICEH__
12
13 #if defined(__GNUG__) && !defined(__APPLE__)
14 #pragma interface "choice.h"
15 #endif
16
17 //-----------------------------------------------------------------------------
18 // wxChoice
19 //-----------------------------------------------------------------------------
20
21 class wxChoice : public wxChoiceBase
22 {
23 public:
24 wxChoice();
25 wxChoice( wxWindow *parent, wxWindowID id,
26 const wxPoint& pos = wxDefaultPosition,
27 const wxSize& size = wxDefaultSize,
28 int n = 0, const wxString choices[] = (const wxString *) NULL,
29 long style = 0,
30 const wxValidator& validator = wxDefaultValidator,
31 const wxString& name = wxChoiceNameStr )
32 {
33 m_strings = (wxSortedArrayString *)NULL;
34
35 Create(parent, id, pos, size, n, choices, style, validator, name);
36 }
37 ~wxChoice();
38 bool Create( wxWindow *parent, wxWindowID id,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 int n = 0, const wxString choices[] = (wxString *) NULL,
42 long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxChoiceNameStr );
45
46 // implement base class pure virtuals
47 void Delete(int n);
48 void Clear();
49
50 int GetSelection() const;
51 void SetSelection( int n );
52
53 virtual int GetCount() const;
54 int FindString( const wxString& string ) const;
55 wxString GetString( int n ) const;
56 void SetString( int n, const wxString& string );
57
58 protected:
59 wxList m_clientList; // contains the client data for the items
60
61 void ApplyWidgetStyle();
62 virtual int DoAppend(const wxString& item);
63 virtual int DoInsert(const wxString& item, int pos);
64
65 virtual void DoSetItemClientData( int n, void* clientData );
66 virtual void* DoGetItemClientData( int n ) const;
67 virtual void DoSetItemClientObject( int n, wxClientData* clientData );
68 virtual wxClientData* DoGetItemClientObject( int n ) const;
69
70 virtual wxSize DoGetBestSize() const;
71
72 private:
73 // common part of Create() and DoAppend()
74 int GtkAddHelper(GtkWidget *menu, int pos, const wxString& item);
75
76 // this array is only used for controls with wxCB_SORT style, so only
77 // allocate it if it's needed (hence using pointer)
78 wxSortedArrayString *m_strings;
79
80 DECLARE_DYNAMIC_CLASS(wxChoice)
81 };
82
83
84 #endif // __GTKCHOICEH__