]> git.saurik.com Git - wxWidgets.git/blame - src/common/choiccmn.cpp
Invalidate best size of wxOSX wxChoice after its number of items changes.
[wxWidgets.git] / src / common / choiccmn.cpp
CommitLineData
2d61b48d 1/////////////////////////////////////////////////////////////////////////////
b36e08d0 2// Name: src/common/choiccmn.cpp
2d61b48d
VZ
3// Purpose: common (to all ports) wxChoice functions
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 26.07.99
7// RCS-ID: $Id$
77ffb593 8// Copyright: (c) wxWidgets team
65571936 9// Licence: wxWindows licence
2d61b48d
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
2d61b48d
VZ
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
1e6feb95
VZ
27#if wxUSE_CHOICE
28
b36e08d0
WS
29#include "wx/choice.h"
30
2d61b48d 31#ifndef WX_PRECOMP
2d61b48d
VZ
32#endif
33
f36e602b 34const char wxChoiceNameStr[] = "choice";
e7445ff8 35
28953245
SC
36
37wxDEFINE_FLAGS( wxChoiceStyle )
38wxBEGIN_FLAGS( wxChoiceStyle )
39// new style border flags, we put them first to
40// use them for streaming out
41wxFLAGS_MEMBER(wxBORDER_SIMPLE)
42wxFLAGS_MEMBER(wxBORDER_SUNKEN)
43wxFLAGS_MEMBER(wxBORDER_DOUBLE)
44wxFLAGS_MEMBER(wxBORDER_RAISED)
45wxFLAGS_MEMBER(wxBORDER_STATIC)
46wxFLAGS_MEMBER(wxBORDER_NONE)
47
48// old style border flags
49wxFLAGS_MEMBER(wxSIMPLE_BORDER)
50wxFLAGS_MEMBER(wxSUNKEN_BORDER)
51wxFLAGS_MEMBER(wxDOUBLE_BORDER)
52wxFLAGS_MEMBER(wxRAISED_BORDER)
53wxFLAGS_MEMBER(wxSTATIC_BORDER)
54wxFLAGS_MEMBER(wxBORDER)
55
56// standard window styles
57wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
58wxFLAGS_MEMBER(wxCLIP_CHILDREN)
59wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
60wxFLAGS_MEMBER(wxWANTS_CHARS)
61wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
62wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
63wxFLAGS_MEMBER(wxVSCROLL)
64wxFLAGS_MEMBER(wxHSCROLL)
65
66wxEND_FLAGS( wxChoiceStyle )
67
37788684 68wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl, "wx/choice.h")
28953245
SC
69
70wxBEGIN_PROPERTIES_TABLE(wxChoice)
71wxEVENT_PROPERTY( Select, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEvent )
72
73wxPROPERTY( Font, wxFont, SetFont, GetFont , wxEMPTY_PARAMETER_VALUE, \
74 0 /*flags*/, wxT("Helpstring"), wxT("group"))
75wxPROPERTY_COLLECTION( Choices, wxArrayString, wxString, AppendString, \
76 GetStrings, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
77wxPROPERTY( Selection,int, SetSelection, GetSelection, wxEMPTY_PARAMETER_VALUE, \
78 0 /*flags*/, wxT("Helpstring"), wxT("group"))
79
80/*
81 TODO PROPERTIES
82 selection (long)
83 content (list)
84 item
85 */
86
87wxPROPERTY_FLAGS( WindowStyle, wxChoiceStyle, long, SetWindowStyleFlag, \
88 GetWindowStyleFlag, wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
89 wxT("Helpstring"), wxT("group")) // style
90wxEND_PROPERTIES_TABLE()
91
92wxEMPTY_HANDLERS_TABLE(wxChoice)
93
94wxCONSTRUCTOR_4( wxChoice, wxWindow*, Parent, wxWindowID, Id, \
95 wxPoint, Position, wxSize, Size )
96
2d61b48d
VZ
97// ============================================================================
98// implementation
99// ============================================================================
100
05689a13
WS
101wxChoiceBase::~wxChoiceBase()
102{
103 // this destructor is required for Darwin
104}
105
2d61b48d 106// ----------------------------------------------------------------------------
6c8a980f 107// misc
2d61b48d
VZ
108// ----------------------------------------------------------------------------
109
6c8a980f 110void wxChoiceBase::Command(wxCommandEvent& event)
2d61b48d 111{
687706f5 112 SetSelection(event.GetInt());
004867db 113 (void)GetEventHandler()->ProcessEvent(event);
2d61b48d 114}
1e6feb95
VZ
115
116#endif // wxUSE_CHOICE