]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk/choice.h
* Added GetAppMenuBar
[wxWidgets.git] / include / wx / gtk / choice.h
... / ...
CommitLineData
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(NO_GCC_PRAGMA)
14 #pragma interface "choice.h"
15#endif
16
17class WXDLLIMPEXP_BASE wxSortedArrayString;
18
19//-----------------------------------------------------------------------------
20// wxChoice
21//-----------------------------------------------------------------------------
22
23class wxChoice : public wxChoiceBase
24{
25public:
26 wxChoice();
27 wxChoice( wxWindow *parent, wxWindowID id,
28 const wxPoint& pos = wxDefaultPosition,
29 const wxSize& size = wxDefaultSize,
30 int n = 0, const wxString choices[] = (const wxString *) NULL,
31 long style = 0,
32 const wxValidator& validator = wxDefaultValidator,
33 const wxString& name = wxChoiceNameStr )
34 {
35 m_strings = (wxSortedArrayString *)NULL;
36
37 Create(parent, id, pos, size, n, choices, style, validator, name);
38 }
39 ~wxChoice();
40 bool Create( wxWindow *parent, wxWindowID id,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 int n = 0, const wxString choices[] = (wxString *) NULL,
44 long style = 0,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxChoiceNameStr );
47
48 // implement base class pure virtuals
49 void Delete(int n);
50 void Clear();
51
52 int GetSelection() const;
53 void SetSelection( int n );
54
55 virtual int GetCount() const;
56 int FindString( const wxString& string ) const;
57 wxString GetString( int n ) const;
58 void SetString( int n, const wxString& string );
59
60protected:
61 wxList m_clientList; // contains the client data for the items
62
63 void ApplyWidgetStyle();
64 virtual int DoAppend(const wxString& item);
65 virtual int DoInsert(const wxString& item, int pos);
66
67 virtual void DoSetItemClientData( int n, void* clientData );
68 virtual void* DoGetItemClientData( int n ) const;
69 virtual void DoSetItemClientObject( int n, wxClientData* clientData );
70 virtual wxClientData* DoGetItemClientObject( int n ) const;
71
72 virtual wxSize DoGetBestSize() const;
73
74 virtual bool IsOwnGtkWindow( GdkWindow *window );
75private:
76 // common part of Create() and DoAppend()
77 int GtkAddHelper(GtkWidget *menu, int pos, const wxString& item);
78
79 // this array is only used for controls with wxCB_SORT style, so only
80 // allocate it if it's needed (hence using pointer)
81 wxSortedArrayString *m_strings;
82
83 DECLARE_DYNAMIC_CLASS(wxChoice)
84};
85
86
87#endif // __GTKCHOICEH__