]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/choice.h
Ditribution script mods;
[wxWidgets.git] / include / wx / mac / choice.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: choice.h
3 // Purpose: wxChoice class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CHOICE_H_
13 #define _WX_CHOICE_H_
14
15 #ifdef __GNUG__
16 #pragma interface "choice.h"
17 #endif
18
19 #include "wx/control.h"
20
21 #include "wx/dynarray.h"
22
23 WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr;
24
25 WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ;
26
27 // Choice item
28 class WXDLLEXPORT wxChoice: public wxChoiceBase
29 {
30 DECLARE_DYNAMIC_CLASS(wxChoice)
31
32 public:
33 wxChoice()
34 : m_strings(), m_datas(), m_macPopUpMenuHandle(NULL)
35 {}
36
37 virtual ~wxChoice() ;
38
39 wxChoice(wxWindow *parent, wxWindowID id,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 int n = 0, const wxString choices[] = NULL,
43 long style = 0,
44 const wxValidator& validator = wxDefaultValidator,
45 const wxString& name = wxChoiceNameStr)
46 {
47 Create(parent, id, pos, size, n, choices, style, validator, name);
48 }
49
50 bool Create(wxWindow *parent, wxWindowID id,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 int n = 0, const wxString choices[] = NULL,
54 long style = 0,
55 const wxValidator& validator = wxDefaultValidator,
56 const wxString& name = wxChoiceNameStr);
57
58 // implement base class pure virtuals
59 virtual int DoAppend(const wxString& item);
60 virtual void Delete(int n);
61 virtual void Clear();
62
63 virtual int GetCount() const ;
64 virtual int GetSelection() const ;
65 virtual void SetSelection(int n);
66
67 virtual int FindString(const wxString& s) const;
68 virtual wxString GetString(int n) const ;
69 virtual void SetString( int , const wxString& s ) ;
70 void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
71
72 /*
73 virtual void Append(const wxString& item);
74 // Added min Append and GetClientData
75 virtual void Append(const wxString& item, void *client_data);
76 virtual void *GetClientData(int index) const;
77 virtual inline void Select( int n ) { SetSelection( n ); }
78 virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
79 virtual wxString GetStringSelection() const ;
80 virtual bool SetStringSelection(const wxString& sel);
81
82 // Mac specific
83 virtual void Command(wxCommandEvent& event);
84 void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
85
86 virtual inline int GetColumns() const { return 1 ; };
87 */
88 protected:
89 virtual wxSize DoGetBestSize() const ;
90 virtual void DoSetItemClientData( int n, void* clientData );
91 virtual void* DoGetItemClientData( int n ) const;
92 virtual void DoSetItemClientObject( int n, wxClientData* clientData );
93 virtual wxClientData* DoGetItemClientObject( int n ) const;
94
95 // free all memory we have (used by Clear() and dtor)
96 // prevent collision with some BSD definitions of macro Free()
97 void FreeData();
98
99 wxArrayString m_strings;
100 wxChoiceDataArray m_datas ;
101 WXHMENU m_macPopUpMenuHandle ;
102 };
103
104 #endif
105 // _WX_CHOICE_H_