1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/choice.cpp
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
15 #include "wx/choice.h"
19 #include "wx/dcclient.h"
22 #include "wx/osx/private.h"
24 // adapt the number offset (mac menu are 1 based)
26 class wxMacChoiceCarbonControl
: public wxMacControl
29 wxMacChoiceCarbonControl( wxWindowMac
* peer
) : wxMacControl( peer
)
33 void SetValue(wxInt32 v
)
35 wxMacControl::SetValue( v
+ 1 );
38 wxInt32
GetValue() const
40 return wxMacControl::GetValue() - 1;
44 wxWidgetImplType
* wxWidgetImpl::CreateChoice( wxWindowMac
* wxpeer
,
46 wxWindowID
WXUNUSED(id
),
51 long WXUNUSED(extraStyle
))
53 Rect bounds
= wxMacGetBoundsForControl( wxpeer
, pos
, size
);
55 wxMacControl
* peer
= new wxMacChoiceCarbonControl( wxpeer
) ;
56 OSStatus err
= CreatePopupButtonControl(
57 MAC_WXHWND(parent
->MacGetTopLevelWindowRef()) , &bounds
, CFSTR("") ,
58 -12345 , false /* no variable width */ , 0 , 0 , 0 , peer
->GetControlRefAddr() );
61 peer
->SetData
<MenuHandle
>( kControlNoPart
, kControlPopupButtonMenuHandleTag
, (MenuHandle
) menu
->GetHMenu() ) ;
65 #endif // wxUSE_CHOICE