bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { m_macIsUserPane = FALSE ; if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) return false; m_label = label ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; m_peer = new wxMacControl(this) ; verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") , true /*primary*/ , m_peer->GetControlRefAddr() ) ) ; MacPostControlCreate(pos,size) ; return TRUE; }
wxWidgetImplType* wxWidgetImpl::CreateStaticText( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxString& WXUNUSED(label), const wxPoint& pos, const wxSize& size, long style, long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); wxMacControl* peer = new wxMacStaticText( wxpeer ); OSStatus err = CreateStaticTextControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, NULL, NULL, peer->GetControlRefAddr() ); verify_noerr( err ); if ( ( style & wxST_ELLIPSIZE_END ) || ( style & wxST_ELLIPSIZE_MIDDLE ) ) { TruncCode tCode = truncEnd; if ( style & wxST_ELLIPSIZE_MIDDLE ) tCode = truncMiddle; err = peer->SetData( kControlStaticTextTruncTag, tCode ); err = peer->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 ); } return peer; }
bool wxStaticText::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { m_macIsUserPane = FALSE ; m_label = wxStripMenuCodes(label) ; if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator , name ) ) { return false; } Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ; m_peer = new wxMacControl(this) ; verify_noerr(CreateStaticTextControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, str , NULL , m_peer->GetControlRefAddr() ) ) ; MacPostControlCreate(pos,size) ; return true; }
wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), wxInt32 value, wxInt32 minimum, wxInt32 maximum, const wxPoint& pos, const wxSize& size, long style, long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); int tickMarks = 0; if ( style & wxSL_AUTOTICKS ) tickMarks = (maximum - minimum) + 1; // +1 for the 0 value // keep the number of tickmarks from becoming unwieldly, therefore below it is ok to cast // it to a UInt16 while (tickMarks > 20) tickMarks /= 5; wxMacControl* peer = new wxMacSliderCarbonControl( wxpeer ); OSStatus err = CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, value, minimum, maximum, kControlSliderPointsDownOrRight, (UInt16) tickMarks, true /* liveTracking */, GetwxMacLiveScrollbarActionProc(), peer->GetControlRefAddr() ); verify_noerr( err ); return peer; }
// Single check box item bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { m_macIsUserPane = FALSE ; if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; m_label = label ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; m_peer = new wxMacControl(this) ; verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) ); MacPostControlCreate(pos,size) ; return TRUE; }
wxMacSearchFieldControl::wxMacSearchFieldControl( wxTextCtrl *wxPeer, const wxString& str, const wxPoint& pos, const wxSize& size, long style ) : wxMacUnicodeTextControl( wxPeer ) { m_font = wxPeer->GetFont() ; m_windowStyle = style ; m_selection.selStart = m_selection.selEnd = 0; Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ; wxString st = str ; wxMacConvertNewlines10To13( &st ) ; wxCFStringRef cf(st , m_font.GetEncoding()) ; m_valueTag = kControlEditTextCFStringTag ; OptionBits attributes = kHISearchFieldAttributesSearchIcon; HIRect hibounds = { { bounds.left, bounds.top }, { bounds.right-bounds.left, bounds.bottom-bounds.top } }; verify_noerr( HISearchFieldCreate( &hibounds, attributes, 0, // MenuRef CFSTR(""), &m_controlRef ) ); HIViewSetVisible (m_controlRef, true); verify_noerr( SetData<CFStringRef>( 0, kControlEditTextCFStringTag , cf ) ) ; ::InstallControlEventHandler( m_controlRef, GetwxMacSearchControlEventHandlerUPP(), GetEventTypeCount(eventList), eventList, wxPeer, NULL); SetNeedsFrame(false); wxMacUnicodeTextControl::InstallEventHandlers(); }
wxMacDataBrowserControl::wxMacDataBrowserControl( wxWindow* peer, const wxPoint& pos, const wxSize& size, long WXUNUSED(style)) : wxMacControl( peer ) { Rect bounds = wxMacGetBoundsForControl( peer, pos, size ); OSStatus err = ::CreateDataBrowserControl( MAC_WXHWND(peer->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView, &m_controlRef ); SetReferenceInNativeControl(); verify_noerr( err ); if ( gDataBrowserItemCompareUPP == NULL ) gDataBrowserItemCompareUPP = NewDataBrowserItemCompareUPP(DataBrowserCompareProc); if ( gDataBrowserItemDataUPP == NULL ) gDataBrowserItemDataUPP = NewDataBrowserItemDataUPP(DataBrowserGetSetItemDataProc); if ( gDataBrowserItemNotificationUPP == NULL ) { gDataBrowserItemNotificationUPP = (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc); } DataBrowserCallbacks callbacks; InitializeDataBrowserCallbacks( &callbacks, kDataBrowserLatestCallbacks ); callbacks.u.v1.itemDataCallback = gDataBrowserItemDataUPP; callbacks.u.v1.itemCompareCallback = gDataBrowserItemCompareUPP; callbacks.u.v1.itemNotificationCallback = gDataBrowserItemNotificationUPP; SetCallbacks( &callbacks ); }
// Single check box item bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { m_macIsUserPane = false ; if ( !wxCheckBoxBase::Create(parent, id, pos, size, style, validator, name) ) return false; m_label = label ; SInt32 maxValue = 1 /* kControlCheckboxCheckedValue */; if (style & wxCHK_3STATE) maxValue = 2 /* kControlCheckboxMixedValue */; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; m_peer = new wxMacControl( this ) ; verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds , CFSTR("") , 0 , false , m_peer->GetControlRefAddr() ) ); m_peer->SetMaximum( maxValue ) ; MacPostControlCreate(pos, size) ; return true; }
bool wxGauge::Create(wxWindow *parent, wxWindowID id, int range, const wxPoint& pos, const wxSize& s, long style, const wxValidator& validator, const wxString& name) { m_macIsUserPane = FALSE ; if ( !wxGaugeBase::Create(parent, id, range, pos, s, style & 0xE0FFFFFF, validator, name) ) return false; wxSize size = s ; /* if ( size.x == wxDefaultCoord && size.y == wxDefaultCoord) { size = wxSize( 200 , 16 ) ; } */ Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; m_peer = new wxMacControl(this) ; verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , GetValue() , 0 , GetRange() , false /* not indeterminate */ , m_peer->GetControlRefAddr() ) ); if ( GetValue() == 0 ) m_peer->SetData<Boolean>( kControlEntireControl , kControlProgressBarAnimatingTag , (Boolean) false ) ; MacPostControlCreate(pos,size) ; return TRUE; }
wxWidgetImplType* wxWidgetImpl::CreateButton( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long WXUNUSED(style), long WXUNUSED(extraStyle)) { OSStatus err; Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; wxMacControl* peer = new wxMacControl(wxpeer) ; if ( id == wxID_HELP ) { ControlButtonContentInfo info ; info.contentType = kControlContentIconRef ; GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &info.u.iconRef); err = CreateRoundButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kControlRoundButtonNormalSize, &info, peer->GetControlRefAddr() ); } else if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND) { // Button height is static in Mac, can't be changed, so we need to force it here int maxHeight; switch (wxpeer->GetWindowVariant() ) { default: wxFAIL_MSG( "unknown window variant" ); // fall through case wxWINDOW_VARIANT_NORMAL: case wxWINDOW_VARIANT_LARGE: maxHeight = 20 ; break; case wxWINDOW_VARIANT_SMALL: maxHeight = 17; break; case wxWINDOW_VARIANT_MINI: maxHeight = 15; } bounds.bottom = bounds.top + maxHeight ; wxpeer->SetMaxSize( wxSize( wxpeer->GetMaxWidth() , maxHeight )); err = CreatePushButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""), peer->GetControlRefAddr() ); } else { ControlButtonContentInfo info ; info.contentType = kControlNoContent ; err = CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds, CFSTR(""), kControlBevelButtonLargeBevel, kControlBehaviorPushbutton, &info, 0, 0, 0, peer->GetControlRefAddr() ); } verify_noerr( err ); return peer; }
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { m_macIsUserPane = false ; if ( !wxSpinButtonBase::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) return false; m_min = 0; m_max = 100; if (!parent) return false; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; m_peer = new wxMacControl(this) ; verify_noerr ( CreateLittleArrowsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 0 , m_min , m_max , 1 , m_peer->GetControlRefAddr() ) ); m_peer->SetActionProc( GetwxMacLiveScrollbarActionProc() ) ; MacPostControlCreate(pos,size) ; return true; }
bool wxNotebook::Create( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { m_macIsUserPane = false ; if (! (style & wxBK_ALIGN_MASK)) style |= wxBK_TOP; if ( !wxNotebookBase::Create( parent, id, pos, size, style, name ) ) return false; Rect bounds = wxMacGetBoundsForControl( this, pos, size ); if ( bounds.right <= bounds.left ) bounds.right = bounds.left + 100; if ( bounds.bottom <= bounds.top ) bounds.bottom = bounds.top + 100; UInt16 tabstyle = kControlTabDirectionNorth; if ( HasFlag(wxBK_LEFT) ) tabstyle = kControlTabDirectionWest; else if ( HasFlag( wxBK_RIGHT ) ) tabstyle = kControlTabDirectionEast; else if ( HasFlag( wxBK_BOTTOM ) ) tabstyle = kControlTabDirectionSouth; ControlTabSize tabsize; switch (GetWindowVariant()) { case wxWINDOW_VARIANT_MINI: if ( UMAGetSystemVersion() >= 0x1030 ) tabsize = 3 ; else tabsize = kControlSizeSmall; break; case wxWINDOW_VARIANT_SMALL: tabsize = kControlTabSizeSmall; break; default: tabsize = kControlTabSizeLarge; break; } m_peer = new wxMacControl( this ); OSStatus err = CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, tabsize, tabstyle, 0, NULL, m_peer->GetControlRefAddr() ); verify_noerr( err ); MacPostControlCreate( pos, size ); return true ; }
bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], int majorDim, long style, const wxValidator& val, const wxString& name) { m_macIsUserPane = false ; if ( !wxControl::Create(parent, id, pos, size, style, val, name) ) return false; int i; m_noItems = n; m_noRowsOrCols = majorDim; m_radioButtonCycle = NULL; if (majorDim==0) m_majorDim = n ; else m_majorDim = majorDim ; m_label = label ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; if( bounds.right <= bounds.left ) bounds.right = bounds.left + 100 ; if ( bounds.bottom <= bounds.top ) bounds.bottom = bounds.top + 100 ; m_peer = new wxMacControl(this) ; verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") , true /*primary*/ , m_peer->GetControlRefAddr() ) ) ; for (i = 0; i < n; i++) { wxRadioButton *radBtn = new wxRadioButton ( this, wxID_ANY, wxStripMenuCodes(choices[i]), wxPoint(5,20*i+10), wxDefaultSize, i == 0 ? wxRB_GROUP : 0 ); if ( i == 0 ) m_radioButtonCycle = radBtn ; // m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle); } SetSelection(0); MacPostControlCreate(pos,size) ; return true; }
bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) { m_macIsUserPane = false; if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) ) return false; m_label = label; Rect bounds = wxMacGetBoundsForControl( this, pos, size ); m_peer = new wxMacControl( this ); OSStatus err = CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""), 0, false /* no autotoggle */, m_peer->GetControlRefAddr() ); verify_noerr( err ); MacPostControlCreate( pos, size ); m_cycle = this; if (HasFlag( wxRB_GROUP )) { AddInCycle( NULL ); } else { // search backward for last group start wxRadioButton *chief = NULL; wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast(); while (node) { wxWindow *child = node->GetData(); if (child->IsKindOf( CLASSINFO( wxRadioButton ) )) { chief = (wxRadioButton*)child; if (child->HasFlag( wxRB_GROUP )) break; } node = node->GetPrevious(); } AddInCycle( chief ); } return true; }
wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, long WXUNUSED(extraStyle)) { wxMacBitmapButton* peer = new wxMacBitmapButton(wxpeer, bitmap, style); OSStatus err; WXWindow macParent = MAC_WXHWND(parent->MacGetTopLevelWindowRef()); Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); ControlButtonContentInfo info; peer->InitButtonContentInfo(info, bitmap); if ( info.contentType == kControlContentIconRef ) { err = CreateIconControl ( macParent, &bounds, &info, false, peer->GetControlRefAddr() ); } else // normal bevel button { err = CreateBevelButtonControl ( macParent, &bounds, CFSTR(""), style & wxBU_AUTODRAW ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel, kControlBehaviorOffsetContents, &info, 0, // menu id (no associated menu) 0, // menu behaviour (unused) 0, // menu placement (unused too) peer->GetControlRefAddr() ); } verify_noerr( err ); wxMacReleaseBitmapButton( &info ); return peer; }
wxWidgetImplType* wxWidgetImpl::CreateStaticLine( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxPoint& pos, const wxSize& size, long WXUNUSED(style), long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; wxMacControl* peer = new wxMacControl(wxpeer) ; verify_noerr(CreateSeparatorControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, peer->GetControlRefAddr() ) ) ; return peer; }
bool wxChoice::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style, const wxValidator& validator, const wxString& name ) { m_macIsUserPane = false; if ( !wxChoiceBase::Create( parent, id, pos, size, style, validator, name ) ) return false; Rect bounds = wxMacGetBoundsForControl( this , pos , size ); m_peer = new wxMacControl( this ) ; OSStatus err = CreatePopupButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , -12345 , false /* no variable width */ , 0 , 0 , 0 , m_peer->GetControlRefAddr() ); verify_noerr( err ); m_macPopUpMenuHandle = NewUniqueMenu() ; m_peer->SetData<MenuHandle>( kControlNoPart , kControlPopupButtonMenuHandleTag , (MenuHandle) m_macPopUpMenuHandle ) ; m_peer->SetValueAndRange( n > 0 ? 1 : 0 , 0 , 0 ); MacPostControlCreate( pos, size ); #if !wxUSE_STL if ( style & wxCB_SORT ) // autosort m_strings = wxArrayString( 1 ); #endif for ( int i = 0; i < n; i++ ) { Append( choices[i] ); } // Set the first item as being selected if (n > 0) SetSelection( 0 ); // Needed because it is a wxControlWithItems SetInitialSize( size ); return true; }
wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxString& WXUNUSED(label), const wxPoint& pos, const wxSize& size, long WXUNUSED(style), long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; wxMacControl* peer = new wxMacControl(wxpeer) ; verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , peer->GetControlRefAddr() ) ); return peer; }
wxWidgetImplType* wxWidgetImpl::CreateTabView( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxPoint& pos, const wxSize& size, long style, long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); if ( bounds.right <= bounds.left ) bounds.right = bounds.left + 100; if ( bounds.bottom <= bounds.top ) bounds.bottom = bounds.top + 100; UInt16 tabstyle = kControlTabDirectionNorth; if ( style & wxBK_LEFT ) tabstyle = kControlTabDirectionWest; else if ( style & wxBK_RIGHT ) tabstyle = kControlTabDirectionEast; else if ( style & wxBK_BOTTOM ) tabstyle = kControlTabDirectionSouth; ControlTabSize tabsize; switch (wxpeer->GetWindowVariant()) { case wxWINDOW_VARIANT_MINI: tabsize = 3 ; break; case wxWINDOW_VARIANT_SMALL: tabsize = kControlTabSizeSmall; break; default: tabsize = kControlTabSizeLarge; break; } wxMacControl* peer = new wxMacControl( wxpeer ); OSStatus err = CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, tabsize, tabstyle, 0, NULL, peer->GetControlRefAddr() ); verify_noerr( err ); return peer; }
wxWidgetImplType* wxWidgetImpl::CreateBitmapButton( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, long WXUNUSED(extraStyle)) { OSStatus err = noErr; ControlButtonContentInfo info; Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); wxMacControl* peer = new wxMacBitmapButton( wxpeer ); wxBitmap bmp; if ( bitmap.Ok() && (style & wxBORDER_NONE) ) { bmp = wxMakeStdSizeBitmap(bitmap); // TODO set bitmap in peer as well } else bmp = bitmap; if ( style & wxBORDER_NONE ) { // contrary to the docs this control only works with iconrefs wxMacCreateBitmapButton( &info, bmp, kControlContentIconRef ); err = CreateIconControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, &info, false, peer->GetControlRefAddr() ); } else { wxMacCreateBitmapButton( &info, bmp ); err = CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""), ((style & wxBU_AUTODRAW) ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel ), kControlBehaviorOffsetContents, &info, 0, 0, 0, peer->GetControlRefAddr() ); } verify_noerr( err ); wxMacReleaseBitmapButton( &info ); return peer; }
wxWidgetImplType* wxWidgetImpl::CreateRadioButton( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxString& WXUNUSED(label), const wxPoint& pos, const wxSize& size, long WXUNUSED(style), long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; wxMacControl* peer = new wxMacControl(wxpeer) ; OSStatus err = CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""), 0, false /* no autotoggle */, peer->GetControlRefAddr() ); verify_noerr( err ); return peer; }
wxWidgetImplType* wxWidgetImpl::CreateScrollBar( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxPoint& pos, const wxSize& size, long WXUNUSED(style), long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer, pos, size ); wxMacControl* peer = new wxOSXScrollBarCarbonImpl( wxpeer ); OSStatus err = CreateScrollBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, 0, 0, 100, 1, true /* liveTracking */, GetwxMacLiveScrollbarActionProc(), peer->GetControlRefAddr() ); verify_noerr( err ); return peer; }
wxWidgetImplType* wxWidgetImpl::CreateChoice( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), wxMenu* menu, const wxPoint& pos, const wxSize& size, long WXUNUSED(style), long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ); wxMacControl* peer = new wxMacChoiceCarbonControl( wxpeer ) ; OSStatus err = CreatePopupButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , -12345 , false /* no variable width */ , 0 , 0 , 0 , peer->GetControlRefAddr() ); verify_noerr( err ); peer->SetData<MenuHandle>( kControlNoPart , kControlPopupButtonMenuHandleTag , (MenuHandle) menu->GetHMenu() ) ; return peer; }
bool wxStaticLine::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name) { m_macIsUserPane = FALSE ; if ( !wxStaticLineBase::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) return false; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; m_peer = new wxMacControl(this) ; verify_noerr(CreateSeparatorControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, m_peer->GetControlRefAddr() ) ) ; MacPostControlCreate(pos,size) ; return TRUE; }
wxWidgetImplType* wxWidgetImpl::CreateSpinButton( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), wxInt32 value, wxInt32 minimum, wxInt32 maximum, const wxPoint& pos, const wxSize& size, long WXUNUSED(style), long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ); wxMacControl* peer = new wxMacControl( wxpeer ); OSStatus err = CreateLittleArrowsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, value, minimum, maximum, 1, peer->GetControlRefAddr() ); verify_noerr( err ); peer->SetActionProc( GetwxMacLiveScrollbarActionProc() ); return peer ; }
// Scrollbar bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { m_macIsUserPane = FALSE ; if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return FALSE; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; m_peer = new wxMacControl(this) ; verify_noerr ( CreateScrollBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 0 , 0 , 100 , 1 , true /* liveTracking */ , GetwxMacLiveScrollbarActionProc() , m_peer->GetControlRefAddr() ) ); MacPostControlCreate(pos,size) ; return TRUE; }
wxWidgetImplType* wxWidgetImpl::CreateCheckBox( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxString& WXUNUSED(label), const wxPoint& pos, const wxSize& size, long style, long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; wxMacControl* peer = new wxMacControl(wxpeer) ; verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds , CFSTR("") , 0 , false , peer->GetControlRefAddr() ) ); SInt32 maxValue = 1 /* kControlCheckboxCheckedValue */; if (style & wxCHK_3STATE) maxValue = 2 /* kControlCheckboxMixedValue */; peer->SetMaximum( maxValue ) ; return peer; }
bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { m_macIsUserPane = false; m_label = GetLabelText( label ); if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) return false; Rect bounds = wxMacGetBoundsForControl( this, pos, size ); wxMacCFStringHolder str( m_label, m_font.GetEncoding() ); m_peer = new wxMacControl( this ); OSStatus err = CreateStaticTextControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, str, NULL, m_peer->GetControlRefAddr() ); verify_noerr( err ); if ( ( style & wxST_DOTS_END ) || ( style & wxST_DOTS_MIDDLE ) ) { TruncCode tCode = truncEnd; if ( style & wxST_DOTS_MIDDLE ) tCode = truncMiddle; err = m_peer->SetData( kControlStaticTextTruncTag, tCode ); err = m_peer->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 ); } MacPostControlCreate( pos, size ); return true; }
wxWidgetImplType* wxWidgetImpl::CreateDisclosureTriangle( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID WXUNUSED(id), const wxString& label, const wxPoint& pos, const wxSize& size, long WXUNUSED(style), long WXUNUSED(extraStyle)) { Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; wxMacControl* peer = new wxMacControl(wxpeer) ; OSStatus err = CreateDisclosureTriangleControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds, kControlDisclosureTrianglePointDefault, wxCFStringRef( label ), 0, // closed TRUE, // draw title TRUE, // auto toggle back and forth peer->GetControlRefAddr() ); verify_noerr( err ); return peer; }
bool wxSlider::Create(wxWindow *parent, wxWindowID id, int value, int minValue, int maxValue, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) { m_macIsUserPane = false; m_macMinimumStatic = NULL; m_macMaximumStatic = NULL; m_macValueStatic = NULL; m_lineSize = 1; m_tickFreq = 0; m_rangeMax = maxValue; m_rangeMin = minValue; m_pageSize = (int)((maxValue - minValue) / 10); // our styles are redundant: wxSL_LEFT/RIGHT imply wxSL_VERTICAL and // wxSL_TOP/BOTTOM imply wxSL_HORIZONTAL, but for backwards compatibility // reasons we can't really change it, instead try to infer the orientation // from the flags given to us here switch ( style & (wxSL_LEFT | wxSL_RIGHT | wxSL_TOP | wxSL_BOTTOM) ) { case wxSL_LEFT: case wxSL_RIGHT: style |= wxSL_VERTICAL; break; case wxSL_TOP: case wxSL_BOTTOM: style |= wxSL_HORIZONTAL; break; case 0: default: // no specific direction, do we have at least the orientation? if ( !(style & (wxSL_HORIZONTAL | wxSL_VERTICAL)) ) // no: choose default style |= wxSL_BOTTOM | wxSL_HORIZONTAL; break; } wxASSERT_MSG( !(style & wxSL_VERTICAL) || !(style & wxSL_HORIZONTAL), wxT("incompatible slider direction and orientation") ); if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; Rect bounds = wxMacGetBoundsForControl( this , pos , size ); // NB: (RN) Ticks here are sometimes off in the GUI if there // are not as many tick marks as there are values // int tickMarks = 0; if ( style & wxSL_AUTOTICKS ) tickMarks = (maxValue - minValue) + 1; // +1 for the 0 value // keep the number of tickmarks from becoming unwieldly, therefore below it is ok to cast // it to a UInt16 while (tickMarks > 20) tickMarks /= 5; m_peer = new wxMacControl( this ); OSStatus err = CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, value, minValue, maxValue, kControlSliderPointsDownOrRight, (UInt16) tickMarks, true /* liveTracking */, GetwxMacLiveScrollbarActionProc(), m_peer->GetControlRefAddr() ); verify_noerr( err ); if (style & wxSL_VERTICAL) // Forces SetSize to use the proper width SetSizeHints(10, -1, 10, -1); else // Forces SetSize to use the proper height SetSizeHints(-1, 10, -1, 10); // NB: SetSizeHints is overloaded by wxSlider and will substitute 10 with the // proper dimensions, it also means other people cannot bugger the slider with // other values if (style & wxSL_LABELS) { m_macMinimumStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString ); m_macMaximumStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString ); m_macValueStatic = new wxStaticText( parent, wxID_ANY, wxEmptyString ); } SetRange(minValue, maxValue); SetValue(value); MacPostControlCreate(pos, size); return true; }