]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/choice.h
wxAnimationCtrl fix to display inactive bitmap at start (patch 1590192)
[wxWidgets.git] / include / wx / gtk1 / choice.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/choice.h
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
dbf858b5 5// Id: $Id$
01111366 6// Copyright: (c) 1998 Robert Roebling
65571936 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
c801d85f
KB
10#ifndef __GTKCHOICEH__
11#define __GTKCHOICEH__
12
b5f6b52a 13class WXDLLIMPEXP_BASE wxSortedArrayString;
584ad2a3 14class WXDLLIMPEXP_BASE wxArrayString;
b5f6b52a 15
c801d85f
KB
16//-----------------------------------------------------------------------------
17// wxChoice
18//-----------------------------------------------------------------------------
19
20123d49 20class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
c801d85f 21{
fd0eed64 22public:
29006414
VZ
23 wxChoice();
24 wxChoice( wxWindow *parent, wxWindowID id,
25 const wxPoint& pos = wxDefaultPosition,
26 const wxSize& size = wxDefaultSize,
27 int n = 0, const wxString choices[] = (const wxString *) NULL,
28 long style = 0,
29 const wxValidator& validator = wxDefaultValidator,
30 const wxString& name = wxChoiceNameStr )
31 {
e01c8145
VZ
32 m_strings = (wxSortedArrayString *)NULL;
33
29006414
VZ
34 Create(parent, id, pos, size, n, choices, style, validator, name);
35 }
584ad2a3
MB
36 wxChoice( wxWindow *parent, wxWindowID id,
37 const wxPoint& pos,
38 const wxSize& size,
39 const wxArrayString& choices,
40 long style = 0,
41 const wxValidator& validator = wxDefaultValidator,
42 const wxString& name = wxChoiceNameStr )
43 {
44 m_strings = (wxSortedArrayString *)NULL;
45
46 Create(parent, id, pos, size, choices, style, validator, name);
47 }
d3c7fc99 48 virtual ~wxChoice();
29006414
VZ
49 bool Create( wxWindow *parent, wxWindowID id,
50 const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize,
52 int n = 0, const wxString choices[] = (wxString *) NULL,
53 long style = 0,
54 const wxValidator& validator = wxDefaultValidator,
55 const wxString& name = wxChoiceNameStr );
584ad2a3
MB
56 bool Create( wxWindow *parent, wxWindowID id,
57 const wxPoint& pos,
58 const wxSize& size,
59 const wxArrayString& choices,
60 long style = 0,
61 const wxValidator& validator = wxDefaultValidator,
62 const wxString& name = wxChoiceNameStr );
c801d85f 63
9abe166a 64 // implement base class pure virtuals
aa61d352 65 void Delete(unsigned int n);
9abe166a
VZ
66 void Clear();
67
68 int GetSelection() const;
aa61d352 69 virtual void SetSelection(int n);
29006414 70
aa61d352 71 virtual unsigned int GetCount() const;
853dcc57 72 virtual int FindString(const wxString& s, bool bCase = false) const;
aa61d352
VZ
73 virtual wxString GetString(unsigned int n) const;
74 virtual void SetString(unsigned int n, const wxString& string);
29006414 75
9d522606
RD
76 static wxVisualAttributes
77 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
78
20e05ffb 79protected:
e01c8145 80 wxList m_clientList; // contains the client data for the items
29006414 81
f40fdaa3 82 void DoApplyWidgetStyle(GtkRcStyle *style);
9abe166a 83 virtual int DoAppend(const wxString& item);
aa61d352 84 virtual int DoInsert(const wxString& item, unsigned int pos);
9abe166a 85
aa61d352
VZ
86 virtual void DoSetItemClientData(unsigned int n, void* clientData);
87 virtual void* DoGetItemClientData(unsigned int n) const;
88 virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData);
89 virtual wxClientData* DoGetItemClientObject(unsigned int n) const;
d6538e2c 90
f68586e5
VZ
91 virtual wxSize DoGetBestSize() const;
92
3a97d2db 93 virtual bool IsOwnGtkWindow( GdkWindow *window );
9d522606 94
738f9e5a 95private:
e01c8145 96 // common part of Create() and DoAppend()
aa61d352 97 int GtkAddHelper(GtkWidget *menu, unsigned int pos, const wxString& item);
e01c8145
VZ
98
99 // this array is only used for controls with wxCB_SORT style, so only
100 // allocate it if it's needed (hence using pointer)
101 wxSortedArrayString *m_strings;
102
5f3565a2 103public:
853dcc57
WS
104 // this circumvents a GTK+ 2.0 bug so that the selection is
105 // invalidated properly
16edee16 106 int m_selection_hack;
5f3565a2
RR
107
108private:
738f9e5a 109 DECLARE_DYNAMIC_CLASS(wxChoice)
c801d85f
KB
110};
111
ce4169a4 112
c801d85f 113#endif // __GTKCHOICEH__