cleanup - reformatting
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b26ed94e4f
commit
3b6a117962
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: toolbar.cpp
|
||||
// Name: src/mac/carbon/toolbar.cpp
|
||||
// Purpose: wxToolBar
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
@ -208,10 +208,8 @@ static const EventTypeSpec eventList[] =
|
||||
static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef handler, EventRef event, void *data )
|
||||
{
|
||||
OSStatus result = eventNotHandledErr;
|
||||
|
||||
wxMacCarbonEvent cEvent( event ) ;
|
||||
|
||||
ControlRef controlRef;
|
||||
wxMacCarbonEvent cEvent( event );
|
||||
|
||||
cEvent.GetParameter( kEventParamDirectObject, &controlRef );
|
||||
|
||||
@ -489,13 +487,13 @@ void wxToolBarTool::UpdateToggleImage( bool toggle )
|
||||
{
|
||||
ControlButtonContentInfo info;
|
||||
wxMacCreateBitmapButton( &info, m_bmpNormal );
|
||||
SetControlData( m_controlHandle , 0, kControlIconContentTag,
|
||||
sizeof( info ), (Ptr)&info );
|
||||
SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof( info ), (Ptr)&info );
|
||||
wxMacReleaseBitmapButton( &info );
|
||||
}
|
||||
|
||||
IconTransformType transform = toggle ? kTransformSelected : kTransformNone;
|
||||
SetControlData( m_controlHandle, 0, kControlIconTransformTag,
|
||||
SetControlData(
|
||||
m_controlHandle, 0, kControlIconTransformTag,
|
||||
sizeof( transform ), (Ptr)&transform );
|
||||
HIViewSetNeedsDisplay( m_controlHandle, true );
|
||||
|
||||
@ -504,7 +502,8 @@ void wxToolBarTool::UpdateToggleImage( bool toggle )
|
||||
#endif
|
||||
}
|
||||
|
||||
wxToolBarTool::wxToolBarTool(wxToolBar *tbar,
|
||||
wxToolBarTool::wxToolBarTool(
|
||||
wxToolBar *tbar,
|
||||
int id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bmpNormal,
|
||||
@ -513,7 +512,9 @@ wxToolBarTool::wxToolBarTool(wxToolBar *tbar,
|
||||
wxObject *clientData,
|
||||
const wxString& shortHelp,
|
||||
const wxString& longHelp )
|
||||
: wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
|
||||
:
|
||||
wxToolBarToolBase(
|
||||
tbar, id, label, bmpNormal, bmpDisabled, kind,
|
||||
clientData, shortHelp, longHelp )
|
||||
{
|
||||
Init();
|
||||
@ -522,7 +523,8 @@ wxToolBarTool::wxToolBarTool(wxToolBar *tbar,
|
||||
#pragma mark -
|
||||
#pragma mark Toolbar Implementation
|
||||
|
||||
wxToolBarToolBase *wxToolBar::CreateTool(int id,
|
||||
wxToolBarToolBase *wxToolBar::CreateTool(
|
||||
int id,
|
||||
const wxString& label,
|
||||
const wxBitmap& bmpNormal,
|
||||
const wxBitmap& bmpDisabled,
|
||||
@ -531,7 +533,8 @@ wxToolBarToolBase *wxToolBar::CreateTool(int id,
|
||||
const wxString& shortHelp,
|
||||
const wxString& longHelp )
|
||||
{
|
||||
return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind,
|
||||
return new wxToolBarTool(
|
||||
this, id, label, bmpNormal, bmpDisabled, kind,
|
||||
clientData, shortHelp, longHelp );
|
||||
}
|
||||
|
||||
@ -556,7 +559,8 @@ void wxToolBar::Init()
|
||||
// also for the toolbar we have the dual implementation:
|
||||
// only when MacInstallNativeToolbar is called is the native toolbar set as the window toolbar
|
||||
//
|
||||
bool wxToolBar::Create(wxWindow *parent,
|
||||
bool wxToolBar::Create(
|
||||
wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
@ -570,7 +574,8 @@ bool wxToolBar::Create(wxWindow *parent,
|
||||
|
||||
#if wxMAC_USE_NATIVE_TOOLBAR
|
||||
wxString labelStr = wxString::Format( wxT("%xd"), (int)this );
|
||||
err = HIToolbarCreate( wxMacCFStringHolder(labelStr, wxFont::GetDefaultEncoding() ) , 0 ,
|
||||
err = HIToolbarCreate(
|
||||
wxMacCFStringHolder( labelStr, wxFont::GetDefaultEncoding() ), 0,
|
||||
(HIToolbarRef*) &m_macHIToolbarRef );
|
||||
|
||||
if (m_macHIToolbarRef != NULL)
|
||||
@ -1101,8 +1106,7 @@ void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
|
||||
tool->UpdateToggleImage( toggle );
|
||||
}
|
||||
|
||||
bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
||||
wxToolBarToolBase *toolBase)
|
||||
bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
|
||||
{
|
||||
wxToolBarTool *tool = wx_static_cast( wxToolBarTool*, toolBase );
|
||||
if (tool == NULL)
|
||||
@ -1151,13 +1155,15 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
||||
wxMacCreateBitmapButton( &info, tool->GetNormalBitmap(), kControlContentIconRef );
|
||||
|
||||
if ( UMAGetSystemVersion() >= 0x1000)
|
||||
{
|
||||
CreateIconControl( window, &toolrect, &info, false, &controlHandle );
|
||||
}
|
||||
else
|
||||
{
|
||||
SInt16 behaviour = kControlBehaviorOffsetContents;
|
||||
if ( tool->CanBeToggled() )
|
||||
behaviour |= kControlBehaviorToggles;
|
||||
CreateBevelButtonControl( window ,
|
||||
err = CreateBevelButtonControl( window,
|
||||
&toolrect, CFSTR(""), kControlBevelButtonNormalBevel,
|
||||
behaviour, &info, 0, 0, 0, &controlHandle );
|
||||
}
|
||||
@ -1185,7 +1191,8 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
||||
UMASetControlTitle( m_controlHandle, label, wxFont::GetDefaultEncoding() );
|
||||
#endif
|
||||
|
||||
InstallControlEventHandler( (ControlRef) controlHandle, GetwxMacToolBarToolEventHandlerUPP(),
|
||||
InstallControlEventHandler(
|
||||
(ControlRef) controlHandle, GetwxMacToolBarToolEventHandlerUPP(),
|
||||
GetEventTypeCount(eventList), eventList, tool, NULL );
|
||||
|
||||
tool->SetControlHandle( controlHandle );
|
||||
@ -1194,15 +1201,17 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
||||
|
||||
case wxTOOL_STYLE_CONTROL:
|
||||
wxASSERT( tool->GetControl() != NULL );
|
||||
|
||||
#if 0 // wxMAC_USE_NATIVE_TOOLBAR
|
||||
// FIXME: doesn't work yet...
|
||||
{
|
||||
HIToolbarItemRef item;
|
||||
wxString labelStr = wxString::Format( wxT("%xd"), (int)tool );
|
||||
result = HIToolbarItemCreate( wxMacCFStringHolder(labelStr, wxFont::GetDefaultEncoding()),
|
||||
result = HIToolbarItemCreate(
|
||||
wxMacCFStringHolder( labelStr, wxFont::GetDefaultEncoding() ),
|
||||
kHIToolbarItemCantBeRemoved | kHIToolbarItemAnchoredLeft | kHIToolbarItemAllowDuplicates,
|
||||
&item );
|
||||
if ( result == 0 )
|
||||
if ( result == noErr )
|
||||
{
|
||||
HIToolbarItemSetLabel( item, wxMacCFStringHolder( tool->GetLabel(), m_font.GetEncoding() ) );
|
||||
HIToolbarItemSetCommandID( item, tool->GetId() );
|
||||
@ -1216,7 +1225,8 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
||||
UMAMoveControl( controlHandle, -toolrect.left, -toolrect.top );
|
||||
|
||||
// FIXME: is this necessary ??
|
||||
InstallControlEventHandler( controlHandle, GetwxMacToolBarToolEventHandlerUPP(),
|
||||
InstallControlEventHandler(
|
||||
controlHandle, GetwxMacToolBarToolEventHandlerUPP(),
|
||||
GetEventTypeCount(eventList), eventList, tool, NULL );
|
||||
}
|
||||
}
|
||||
@ -1235,7 +1245,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
||||
if ( controlHandle )
|
||||
{
|
||||
ControlRef container = (ControlRef) GetHandle();
|
||||
wxASSERT_MSG( container != NULL, wxT("No valid mac container control") );
|
||||
wxASSERT_MSG( container != NULL, wxT("No valid Mac container control") );
|
||||
|
||||
UMAShowControl( controlHandle );
|
||||
::EmbedControl( controlHandle, container );
|
||||
@ -1259,7 +1269,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos),
|
||||
|
||||
void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
|
||||
{
|
||||
wxFAIL_MSG( _T("not implemented") );
|
||||
wxFAIL_MSG( wxT("not implemented") );
|
||||
}
|
||||
|
||||
bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolbase)
|
||||
@ -1430,4 +1440,3 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
|
||||
}
|
||||
|
||||
#endif // wxUSE_TOOLBAR
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user