]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/choice.h
cleanups, proper event handling/cleanup
[wxWidgets.git] / include / wx / mac / carbon / choice.h
CommitLineData
8cf73271
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: choice.h
3// Purpose: wxChoice class
4// Author: Stefan Csomor
5// Modified by:
6// Created: 1998-01-01
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
8cf73271
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_CHOICE_H_
13#define _WX_CHOICE_H_
14
15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16#pragma interface "choice.h"
17#endif
18
19#include "wx/control.h"
20
21#include "wx/dynarray.h"
22#include "wx/arrstr.h"
23
24WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr;
25
26WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ;
27
28// Choice item
29class WXDLLEXPORT wxChoice: public wxChoiceBase
30{
31 DECLARE_DYNAMIC_CLASS(wxChoice)
32
33public:
34 wxChoice()
35 : m_strings(), m_datas(), m_macPopUpMenuHandle(NULL)
36 {}
37
38 virtual ~wxChoice() ;
39
40 wxChoice(wxWindow *parent, wxWindowID id,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 int n = 0, const wxString choices[] = NULL,
44 long style = 0,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxChoiceNameStr)
47 {
48 Create(parent, id, pos, size, n, choices, style, validator, name);
49 }
50 wxChoice(wxWindow *parent, wxWindowID id,
51 const wxPoint& pos,
52 const wxSize& size,
53 const wxArrayString& choices,
54 long style = 0,
55 const wxValidator& validator = wxDefaultValidator,
56 const wxString& name = wxChoiceNameStr)
57 {
58 Create(parent, id, pos, size, choices, style, validator, name);
59 }
60
61 bool Create(wxWindow *parent, wxWindowID id,
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize,
64 int n = 0, const wxString choices[] = NULL,
65 long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxChoiceNameStr);
68 bool Create(wxWindow *parent, wxWindowID id,
69 const wxPoint& pos,
70 const wxSize& size,
71 const wxArrayString& choices,
72 long style = 0,
73 const wxValidator& validator = wxDefaultValidator,
74 const wxString& name = wxChoiceNameStr);
75
76 // implement base class pure virtuals
77 virtual int DoAppend(const wxString& item);
78 virtual int DoInsert(const wxString& item, int pos);
79 virtual void Delete(int n);
80 virtual void Clear();
81
82 virtual int GetCount() const ;
83 virtual int GetSelection() const ;
84 virtual void SetSelection(int n);
85
86 virtual int FindString(const wxString& s) const;
87 virtual wxString GetString(int n) const ;
88 virtual void SetString( int , const wxString& s ) ;
336a6aba 89 virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
8cf73271
SC
90
91protected:
92 virtual wxSize DoGetBestSize() const ;
93
94public: // for wxComboBox only
95 virtual void DoSetItemClientData( int n, void* clientData );
96 virtual void* DoGetItemClientData( int n ) const;
97 virtual void DoSetItemClientObject( int n, wxClientData* clientData );
98 virtual wxClientData* DoGetItemClientObject( int n ) const;
99
100protected:
101 // free all memory we have (used by Clear() and dtor)
102 // prevent collision with some BSD definitions of macro Free()
103 void FreeData();
104
105 wxArrayString m_strings;
106 wxChoiceDataArray m_datas ;
107 WXHMENU m_macPopUpMenuHandle ;
108};
109
110#endif
111 // _WX_CHOICE_H_