1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/choice.cpp
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/choice.h"
20 #include "wx/dcclient.h"
23 #include "wx/osx/private.h"
25 // adapt the number offset (mac menu are 1 based)
27 class wxMacChoiceCarbonControl
: public wxMacControl
30 wxMacChoiceCarbonControl( wxWindowMac
* peer
) : wxMacControl( peer
)
34 void SetValue(wxInt32 v
)
36 wxMacControl::SetValue( v
+ 1 );
39 wxInt32
GetValue() const
41 return wxMacControl::GetValue() - 1;
45 wxWidgetImplType
* wxWidgetImpl::CreateChoice( wxWindowMac
* wxpeer
,
54 Rect bounds
= wxMacGetBoundsForControl( wxpeer
, pos
, size
);
56 wxMacControl
* peer
= new wxMacChoiceCarbonControl( wxpeer
) ;
57 OSStatus err
= CreatePopupButtonControl(
58 MAC_WXHWND(parent
->MacGetTopLevelWindowRef()) , &bounds
, CFSTR("") ,
59 -12345 , false /* no variable width */ , 0 , 0 , 0 , peer
->GetControlRefAddr() );
62 peer
->SetData
<MenuHandle
>( kControlNoPart
, kControlPopupButtonMenuHandleTag
, (MenuHandle
) menu
->GetHMenu() ) ;
66 #endif // wxUSE_CHOICE