switching to CreateXXX methods for Controls and to Hit Event Processing, thus supporting full keyboard access mode
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -69,20 +69,16 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
|||||||
if ( m_bmpNormal.Ok() )
|
if ( m_bmpNormal.Ok() )
|
||||||
bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
|
bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 ,
|
|
||||||
kControlBehaviorOffsetContents +
|
|
||||||
( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ?
|
|
||||||
kControlContentCIconHandle : kControlContentPictHandle ) , 0,
|
|
||||||
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
|
|
||||||
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
|
|
||||||
|
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
|
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
|
||||||
if ( info.contentType != kControlNoContent )
|
|
||||||
{
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
::SetControlData( (ControlRef) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
|
verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
|
||||||
}
|
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevel : kControlBevelButtonNormalBevel ) ,
|
||||||
|
kControlBehaviorOffsetContents , &info , 0 , 0 , 0 , (ControlRef*) &m_macControl ) ) ;
|
||||||
|
|
||||||
|
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -41,8 +41,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
|
if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
|
||||||
{
|
{
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , 0 , 1,
|
verify_noerr ( CreatePushButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , (ControlRef*) &m_macControl ) ) ;
|
||||||
kControlPushButtonProc , (long) this ) ;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -132,13 +131,11 @@ void wxButton::Command (wxCommandEvent & event)
|
|||||||
ProcessCommand (event);
|
ProcessCommand (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxButton::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 controlpart , bool WXUNUSED(mouseStillDown) )
|
wxInt32 wxButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if ( controlpart != kControlNoPart )
|
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId );
|
||||||
{
|
event.SetEventObject(this);
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId );
|
ProcessCommand(event);
|
||||||
event.SetEventObject(this);
|
return noErr ;
|
||||||
ProcessCommand(event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,16 +38,15 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
|
|
||||||
m_label = label ;
|
m_label = label ;
|
||||||
|
|
||||||
SInt16 maxValue = 1 /* kControlCheckboxCheckedValue */;
|
SInt32 maxValue = 1 /* kControlCheckboxCheckedValue */;
|
||||||
if (style & wxCHK_3STATE)
|
if (style & wxCHK_3STATE)
|
||||||
{
|
|
||||||
maxValue = 2 /* kControlCheckboxMixedValue */;
|
maxValue = 2 /* kControlCheckboxMixedValue */;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , 0 , maxValue,
|
verify_noerr( CreateCheckBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds ,
|
||||||
kControlCheckBoxProc , (long) this ) ;
|
CFSTR("") , 0 , false , (ControlRef*) &m_macControl ) ) ;
|
||||||
|
|
||||||
|
SetControl32BitMaximum( (ControlRef) m_macControl , maxValue ) ;
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
|
|
||||||
@@ -95,7 +94,7 @@ void wxCheckBox::DoSet3StateValue(wxCheckBoxState val)
|
|||||||
MacRedrawControl() ;
|
MacRedrawControl() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) , bool WXUNUSED(mouseStillDown) )
|
wxInt32 wxCheckBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
|
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
|
||||||
wxCheckBoxState state = Get3StateValue();
|
wxCheckBoxState state = Get3StateValue();
|
||||||
@@ -122,11 +121,13 @@ void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUN
|
|||||||
{
|
{
|
||||||
state = wxCHK_UNCHECKED;
|
state = wxCHK_UNCHECKED;
|
||||||
}
|
}
|
||||||
Set3StateValue(state);
|
Set3StateValue(state);
|
||||||
|
|
||||||
event.SetInt(state);
|
event.SetInt(state);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
|
|
||||||
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bitmap checkbox
|
// Bitmap checkbox
|
||||||
|
@@ -244,7 +244,6 @@ bool wxCheckListBox::Create(wxWindow *parent,
|
|||||||
}
|
}
|
||||||
listDef.u.userProc = macCheckListDefUPP ;
|
listDef.u.userProc = macCheckListDefUPP ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
Size asize;
|
Size asize;
|
||||||
|
|
||||||
|
|
||||||
@@ -257,32 +256,7 @@ bool wxCheckListBox::Create(wxWindow *parent,
|
|||||||
SetControlReference( (ControlRef) m_macControl, (long) this);
|
SetControlReference( (ControlRef) m_macControl, (long) this);
|
||||||
SetControlVisibility( (ControlRef) m_macControl, false, false);
|
SetControlVisibility( (ControlRef) m_macControl, false, false);
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
long result ;
|
|
||||||
|
|
||||||
wxStAppResource resload ;
|
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true ,
|
|
||||||
kwxMacListWithVerticalScrollbar , 0 , 0,
|
|
||||||
kControlListBoxProc , (long) this ) ;
|
|
||||||
::GetControlData( (ControlRef) m_macControl , kControlNoPart , kControlListBoxListHandleTag ,
|
|
||||||
sizeof( ListHandle ) , (char*) &m_macList , &result ) ;
|
|
||||||
|
|
||||||
HLock( (Handle) m_macList ) ;
|
|
||||||
ldefHandle ldef ;
|
|
||||||
ldef = (ldefHandle) NewHandle( sizeof(ldefRec) ) ;
|
|
||||||
if ( (**(ListHandle)m_macList).listDefProc != NULL )
|
|
||||||
{
|
|
||||||
(**ldef).instruction = 0x4EF9; /* JMP instruction */
|
|
||||||
(**ldef).function = (void(*)()) listDef.u.userProc;
|
|
||||||
(**(ListHandle)m_macList).listDefProc = (Handle) ldef ;
|
|
||||||
}
|
|
||||||
|
|
||||||
Point pt = (**(ListHandle)m_macList).cellSize ;
|
|
||||||
pt.v = 14 ;
|
|
||||||
LCellSize( pt , (ListHandle)m_macList ) ;
|
|
||||||
LAddColumn( 1 , 0 , (ListHandle)m_macList ) ;
|
|
||||||
#endif
|
|
||||||
OptionBits options = 0;
|
OptionBits options = 0;
|
||||||
if ( style & wxLB_MULTIPLE )
|
if ( style & wxLB_MULTIPLE )
|
||||||
{
|
{
|
||||||
|
@@ -66,8 +66,9 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , -12345 , 0 ,
|
|
||||||
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
|
verify_noerr ( CreatePopupButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
|
||||||
|
-12345 , false /* no variable width */ , 0 , 0 , 0 , (ControlRef*) &m_macControl ) ) ;
|
||||||
|
|
||||||
m_macPopUpMenuHandle = NewUniqueMenu() ;
|
m_macPopUpMenuHandle = NewUniqueMenu() ;
|
||||||
SetControlData( (ControlRef) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
|
SetControlData( (ControlRef) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
|
||||||
@@ -228,7 +229,7 @@ wxClientData* wxChoice::DoGetItemClientObject( int n ) const
|
|||||||
return (wxClientData *)DoGetItemClientData(n);
|
return (wxClientData *)DoGetItemClientData(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
|
wxInt32 wxChoice::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
|
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
|
||||||
int n = GetSelection();
|
int n = GetSelection();
|
||||||
@@ -244,6 +245,7 @@ void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart , b
|
|||||||
event.SetClientData( GetClientData(n) );
|
event.SetClientData( GetClientData(n) );
|
||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxChoice::DoGetBestSize() const
|
wxSize wxChoice::DoGetBestSize() const
|
||||||
|
@@ -531,12 +531,13 @@ void wxComboBox::SetString(int n, const wxString& s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxComboBox::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 WXUNUSED(controlpart) , bool WXUNUSED(mouseStillDown))
|
wxInt32 wxComboBox::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
|
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
|
||||||
event.SetInt(GetSelection());
|
event.SetInt(GetSelection());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetString(GetStringSelection());
|
event.SetString(GetStringSelection());
|
||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,9 +45,9 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , 0 , range,
|
verify_noerr ( CreateProgressBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
|
||||||
kControlProgressBarProc , (long) this ) ;
|
m_gaugePos , 0 , m_rangeMax , false /* not indeterminate */ , (ControlRef*) &m_macControl ) ) ;
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -44,7 +44,6 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
|
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
|
||||||
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
|
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
|
||||||
EVT_MOUSE_EVENTS(wxNotebook::OnMouse)
|
|
||||||
|
|
||||||
EVT_SIZE(wxNotebook::OnSize)
|
EVT_SIZE(wxNotebook::OnSize)
|
||||||
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
|
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
|
||||||
@@ -126,7 +125,8 @@ bool wxNotebook::Create(wxWindow *parent,
|
|||||||
tabsize = kControlSizeSmall;
|
tabsize = kControlSizeSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
::CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , tabsize , tabstyle, 0, NULL, (ControlRef*) &m_macControl);
|
verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
|
||||||
|
tabsize , tabstyle, 0, NULL, (ControlRef*) &m_macControl) );
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
@@ -567,88 +567,32 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
|
|||||||
SetControl32BitValue( (ControlRef) m_macControl , m_nSelection + 1 ) ;
|
SetControl32BitValue( (ControlRef) m_macControl , m_nSelection + 1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxInt32 wxNotebook::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
void wxNotebook::OnMouse( wxMouseEvent &event )
|
|
||||||
{
|
{
|
||||||
if ( (ControlRef) m_macControl == NULL )
|
OSStatus status = eventNotHandledErr ;
|
||||||
|
|
||||||
|
SInt32 newSel = GetControl32BitValue( (ControlRef) m_macControl ) - 1 ;
|
||||||
|
if ( newSel != m_nSelection )
|
||||||
{
|
{
|
||||||
event.Skip() ;
|
wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
|
||||||
return ;
|
newSel , m_nSelection);
|
||||||
}
|
changing.SetEventObject(this);
|
||||||
|
GetEventHandler()->ProcessEvent(changing);
|
||||||
|
|
||||||
if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
|
if(changing.IsAllowed())
|
||||||
{
|
|
||||||
int x = event.m_x ;
|
|
||||||
int y = event.m_y ;
|
|
||||||
|
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
// OS Needs it in window not client coordinates
|
|
||||||
wxPoint origin = GetClientAreaOrigin() ;
|
|
||||||
x += origin.x ;
|
|
||||||
y += origin.y ;
|
|
||||||
#else
|
|
||||||
// OS Needs it in tlw content area coordinates
|
|
||||||
MacClientToRootWindow( &x , &y ) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ControlRef control ;
|
|
||||||
Point localwhere ;
|
|
||||||
SInt16 controlpart ;
|
|
||||||
|
|
||||||
localwhere.h = x ;
|
|
||||||
localwhere.v = y ;
|
|
||||||
|
|
||||||
short modifiers = 0;
|
|
||||||
|
|
||||||
if ( !event.m_leftDown && !event.m_rightDown )
|
|
||||||
modifiers |= btnState ;
|
|
||||||
|
|
||||||
if ( event.m_shiftDown )
|
|
||||||
modifiers |= shiftKey ;
|
|
||||||
|
|
||||||
if ( event.m_controlDown )
|
|
||||||
modifiers |= controlKey ;
|
|
||||||
|
|
||||||
if ( event.m_altDown )
|
|
||||||
modifiers |= optionKey ;
|
|
||||||
|
|
||||||
if ( event.m_metaDown )
|
|
||||||
modifiers |= cmdKey ;
|
|
||||||
|
|
||||||
control = (ControlRef) m_macControl ;
|
|
||||||
if ( control && ::IsControlActive( control ) )
|
|
||||||
{
|
{
|
||||||
{
|
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
|
||||||
wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
|
newSel, m_nSelection);
|
||||||
::GetControl32BitValue(control) - 1, m_nSelection);
|
event.SetEventObject(this);
|
||||||
changing.SetEventObject(this);
|
|
||||||
GetEventHandler()->ProcessEvent(changing);
|
|
||||||
|
|
||||||
if(changing.IsAllowed())
|
GetEventHandler()->ProcessEvent(event);
|
||||||
{
|
|
||||||
controlpart = ::HandleControlClick(control, localwhere, modifiers,
|
|
||||||
(ControlActionUPP) -1);
|
|
||||||
wxTheApp->s_lastMouseDown = 0 ;
|
|
||||||
|
|
||||||
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
|
|
||||||
::GetControl32BitValue(control) - 1, m_nSelection);
|
|
||||||
event.SetEventObject(this);
|
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetControl32BitValue( (ControlRef) m_macControl , m_nSelection + 1 ) ;
|
||||||
|
}
|
||||||
|
status = noErr ;
|
||||||
}
|
}
|
||||||
}
|
return status ;
|
||||||
|
|
||||||
|
|
||||||
void wxNotebook::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControl32BitValue((ControlRef)m_macControl) - 1, m_nSelection);
|
|
||||||
event.SetEventObject(this);
|
|
||||||
|
|
||||||
ProcessEvent(event);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -137,8 +137,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
if ( bounds.bottom <= bounds.top )
|
if ( bounds.bottom <= bounds.top )
|
||||||
bounds.bottom = bounds.top + 100 ;
|
bounds.bottom = bounds.top + 100 ;
|
||||||
|
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , 0 , 1,
|
verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") ,
|
||||||
kControlGroupBoxTextTitleProc , (long) this ) ;
|
true /*primary*/ , (ControlRef*)&m_macControl ) ) ;
|
||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
|
@@ -38,10 +38,10 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_label = label ;
|
m_label = label ;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
|
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , 0 , 1,
|
|
||||||
kControlRadioButtonProc , (long) this ) ;
|
|
||||||
|
|
||||||
|
verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
|
||||||
|
0 , false /* no autotoggle */ , (ControlRef*) &m_macControl ) ) ;
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
|
|
||||||
m_cycle = this ;
|
m_cycle = this ;
|
||||||
@@ -101,10 +101,11 @@ void wxRadioButton::Command (wxCommandEvent & event)
|
|||||||
ProcessCommand (event);
|
ProcessCommand (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
|
wxInt32 wxRadioButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
|
// if already set -> no action
|
||||||
if ( GetValue() )
|
if ( GetValue() )
|
||||||
return ;
|
return noErr;
|
||||||
|
|
||||||
wxRadioButton *cycle, *old = NULL ;
|
wxRadioButton *cycle, *old = NULL ;
|
||||||
cycle=this->NextInCycle();
|
cycle=this->NextInCycle();
|
||||||
@@ -130,6 +131,7 @@ void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpar
|
|||||||
event2.SetEventObject(this);
|
event2.SetEventObject(this);
|
||||||
event2.SetInt( true );
|
event2.SetInt( true );
|
||||||
ProcessCommand(event2);
|
ProcessCommand(event2);
|
||||||
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
|
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
|
||||||
|
@@ -46,13 +46,9 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
m_macControl = (WXWidget) ::NewControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()) ,
|
|
||||||
&bounds , "\p" , true , 0 , 0 , 100,
|
|
||||||
kControlScrollBarLiveProc , (long) this) ;
|
|
||||||
|
|
||||||
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
|
verify_noerr ( CreateScrollBarControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
|
||||||
|
0 , 0 , 100 , 1 , true /* liveTracking */ , wxMacLiveScrollbarActionUPP , (ControlRef*) &m_macControl ) ) ;
|
||||||
::SetControlAction( (ControlRef) m_macControl , wxMacLiveScrollbarActionUPP ) ;
|
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
|
|
||||||
@@ -80,19 +76,13 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS
|
|||||||
m_viewSize = thumbSize;
|
m_viewSize = thumbSize;
|
||||||
m_objectSize = range;
|
m_objectSize = range;
|
||||||
|
|
||||||
int range1 = wxMax((m_objectSize - m_viewSize), 0) ;
|
int range1 = wxMax((m_objectSize - m_viewSize), 0) ;
|
||||||
|
|
||||||
SetControl32BitMaximum( (ControlRef) m_macControl , range1 ) ;
|
SetControl32BitMaximum( (ControlRef) m_macControl , range1 ) ;
|
||||||
SetControl32BitMinimum( (ControlRef) m_macControl , 0 ) ;
|
SetControl32BitMinimum( (ControlRef) m_macControl , 0 ) ;
|
||||||
SetControl32BitValue( (ControlRef) m_macControl , position ) ;
|
SetControl32BitValue( (ControlRef) m_macControl , position ) ;
|
||||||
|
SetControlViewSize( (ControlRef) m_macControl , m_viewSize ) ;
|
||||||
|
|
||||||
if ( UMAGetAppearanceVersion() >= 0x0110 )
|
|
||||||
{
|
|
||||||
if ( SetControlViewSize != (void*) kUnresolvedCFragSymbolAddress )
|
|
||||||
{
|
|
||||||
SetControlViewSize( (ControlRef) m_macControl , m_viewSize ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( refresh )
|
if ( refresh )
|
||||||
MacRedrawControl() ;
|
MacRedrawControl() ;
|
||||||
}
|
}
|
||||||
@@ -106,9 +96,6 @@ void wxScrollBar::Command(wxCommandEvent& event)
|
|||||||
|
|
||||||
void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown )
|
void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown )
|
||||||
{
|
{
|
||||||
if ( (ControlRef) m_macControl == NULL )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
int position = GetControl32BitValue( (ControlRef) m_macControl) ;
|
int position = GetControl32BitValue( (ControlRef) m_macControl) ;
|
||||||
int minPos = GetControl32BitMinimum( (ControlRef) m_macControl) ;
|
int minPos = GetControl32BitMinimum( (ControlRef) m_macControl) ;
|
||||||
int maxPos = GetControl32BitMaximum( (ControlRef) m_macControl) ;
|
int maxPos = GetControl32BitMaximum( (ControlRef) m_macControl) ;
|
||||||
@@ -180,3 +167,62 @@ void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart
|
|||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxInt32 wxScrollBar::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent )
|
||||||
|
{
|
||||||
|
int position = GetControl32BitValue( (ControlRef) m_macControl) ;
|
||||||
|
int minPos = GetControl32BitMinimum( (ControlRef) m_macControl) ;
|
||||||
|
int maxPos = GetControl32BitMaximum( (ControlRef) m_macControl) ;
|
||||||
|
|
||||||
|
wxEventType scrollEvent = wxEVT_NULL;
|
||||||
|
int nScrollInc = 0;
|
||||||
|
|
||||||
|
wxMacCarbonEvent cEvent( (EventRef) mevent ) ;
|
||||||
|
ControlPartCode controlpart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart,typeControlPartCode) ;
|
||||||
|
|
||||||
|
// all events have already been reported during mouse down, except for THUMBRELEASE
|
||||||
|
if ( controlpart !=kControlIndicatorPart )
|
||||||
|
return eventNotHandledErr ;
|
||||||
|
|
||||||
|
switch( controlpart )
|
||||||
|
{
|
||||||
|
case kControlIndicatorPart :
|
||||||
|
nScrollInc = 0 ;
|
||||||
|
scrollEvent = wxEVT_SCROLL_THUMBRELEASE;
|
||||||
|
break ;
|
||||||
|
default :
|
||||||
|
wxFAIL_MSG(wxT("illegal scrollbar selector"));
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int new_pos = position + nScrollInc;
|
||||||
|
|
||||||
|
if (new_pos < minPos)
|
||||||
|
new_pos = minPos;
|
||||||
|
if (new_pos > maxPos)
|
||||||
|
new_pos = maxPos;
|
||||||
|
if ( nScrollInc )
|
||||||
|
SetThumbPosition(new_pos);
|
||||||
|
|
||||||
|
wxScrollEvent event(scrollEvent, m_windowId);
|
||||||
|
if ( m_windowStyle & wxHORIZONTAL )
|
||||||
|
{
|
||||||
|
event.SetOrientation( wxHORIZONTAL ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event.SetOrientation( wxVERTICAL ) ;
|
||||||
|
}
|
||||||
|
event.SetPosition(new_pos);
|
||||||
|
event.SetEventObject( this );
|
||||||
|
wxWindow* window = GetParent() ;
|
||||||
|
if (window && window->MacIsWindowScrollbar(this) )
|
||||||
|
{
|
||||||
|
// this is hardcoded
|
||||||
|
window->MacOnScroll(event);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
return noErr ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -79,18 +79,13 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
|
|
||||||
procID = kControlSliderProc + kControlSliderLiveFeedback;
|
UInt16 tickMarks = 0 ;
|
||||||
if(style & wxSL_AUTOTICKS) {
|
if ( style & wxSL_AUTOTICKS )
|
||||||
procID += kControlSliderHasTickMarks;
|
tickMarks = maxValue - minValue ;
|
||||||
}
|
|
||||||
|
verify_noerr ( CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
|
||||||
|
value , minValue , maxValue , kControlSliderPointsDownOrRight , tickMarks , true /* liveTracking */ ,
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, "\p", true,
|
wxMacLiveScrollbarActionUPP , (ControlRef*) &m_macControl ) ) ;
|
||||||
value, minValue, maxValue, procID, (long) this);
|
|
||||||
|
|
||||||
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
|
|
||||||
|
|
||||||
::SetControlAction( (ControlRef) m_macControl , wxMacLiveScrollbarActionUPP ) ;
|
|
||||||
|
|
||||||
if(style & wxSL_VERTICAL) {
|
if(style & wxSL_VERTICAL) {
|
||||||
SetSizeHints(10, -1, 10, -1); // Forces SetSize to use the proper width
|
SetSizeHints(10, -1, 10, -1); // Forces SetSize to use the proper width
|
||||||
@@ -245,10 +240,7 @@ void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bo
|
|||||||
|
|
||||||
wxEventType scrollEvent = wxEVT_NULL ;
|
wxEventType scrollEvent = wxEVT_NULL ;
|
||||||
|
|
||||||
if ( mouseStillDown )
|
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
|
||||||
else
|
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBRELEASE;
|
|
||||||
|
|
||||||
wxScrollEvent event(scrollEvent, m_windowId);
|
wxScrollEvent event(scrollEvent, m_windowId);
|
||||||
event.SetPosition(value);
|
event.SetPosition(value);
|
||||||
@@ -262,6 +254,30 @@ void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bo
|
|||||||
GetEventHandler()->ProcessEvent( cevent );
|
GetEventHandler()->ProcessEvent( cevent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxInt32 wxSlider::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent )
|
||||||
|
{
|
||||||
|
SInt16 value = ::GetControl32BitValue( (ControlRef) m_macControl ) ;
|
||||||
|
|
||||||
|
SetValue( value ) ;
|
||||||
|
|
||||||
|
wxEventType scrollEvent = wxEVT_NULL ;
|
||||||
|
|
||||||
|
scrollEvent = wxEVT_SCROLL_THUMBRELEASE;
|
||||||
|
|
||||||
|
wxScrollEvent event(scrollEvent, m_windowId);
|
||||||
|
event.SetPosition(value);
|
||||||
|
event.SetEventObject( this );
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
|
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId );
|
||||||
|
cevent.SetInt( value );
|
||||||
|
cevent.SetEventObject( this );
|
||||||
|
|
||||||
|
GetEventHandler()->ProcessEvent( cevent );
|
||||||
|
return noErr ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This is overloaded in wxSlider so that the proper width/height will always be used
|
/* This is overloaded in wxSlider so that the proper width/height will always be used
|
||||||
* for the slider different values would cause redrawing and mouse detection problems */
|
* for the slider different values would cause redrawing and mouse detection problems */
|
||||||
void wxSlider::SetSizeHints( int minW, int minH,
|
void wxSlider::SetSizeHints( int minW, int minH,
|
||||||
|
@@ -51,11 +51,9 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
|
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , 0 , 100,
|
verify_noerr ( CreateLittleArrowsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 0 , m_min , m_max , 1 ,
|
||||||
kControlLittleArrowsProc , (long) this ) ;
|
(ControlRef*) &m_macControl ) ) ;
|
||||||
|
|
||||||
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
|
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
|
|
||||||
@@ -150,14 +148,12 @@ void wxSpinButton::MacHandleValueChanged( int inc )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
|
wxInt32 wxSpinButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF event )
|
||||||
{
|
{
|
||||||
if ( (ControlRef) m_macControl == NULL )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
int nScrollInc = 0;
|
int nScrollInc = 0;
|
||||||
|
wxMacCarbonEvent cEvent( (EventRef) event ) ;
|
||||||
|
|
||||||
switch( controlpart )
|
switch( cEvent.GetParameter<ControlPartCode>(kEventParamControlPart,typeControlPartCode) )
|
||||||
{
|
{
|
||||||
case kControlUpButtonPart :
|
case kControlUpButtonPart :
|
||||||
nScrollInc = 1;
|
nScrollInc = 1;
|
||||||
@@ -167,7 +163,7 @@ void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart
|
|||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
MacHandleValueChanged( nScrollInc ) ;
|
MacHandleValueChanged( nScrollInc ) ;
|
||||||
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -43,9 +43,9 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
|
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , 0 , 1,
|
verify_noerr(CreateGroupBoxControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, CFSTR("") ,
|
||||||
kControlGroupBoxTextTitleProc , (long) this ) ;
|
true /*primary*/ , (ControlRef*)&m_macControl ) ) ;
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -56,9 +56,8 @@ bool wxStaticLine::Create( wxWindow *parent,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , 0 , 1,
|
verify_noerr(CreateSeparatorControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, (ControlRef*)&m_macControl ) ) ;
|
||||||
kControlSeparatorLineProc , (long) this ) ;
|
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -43,9 +43,22 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
|
|||||||
m_imageList = NULL;
|
m_imageList = NULL;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , 0 , 1,
|
|
||||||
kControlTabSmallProc , (long) this ) ;
|
UInt16 tabstyle = kControlTabDirectionNorth ;
|
||||||
|
ControlTabSize tabsize = kControlTabSizeLarge ;
|
||||||
|
if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL )
|
||||||
|
tabsize = kControlTabSizeSmall ;
|
||||||
|
else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI )
|
||||||
|
{
|
||||||
|
if (UMAGetSystemVersion() >= 0x1030 )
|
||||||
|
tabsize = 3 ;
|
||||||
|
else
|
||||||
|
tabsize = kControlSizeSmall;
|
||||||
|
}
|
||||||
|
|
||||||
|
verify_noerr ( CreateTabsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
|
||||||
|
tabsize , tabstyle, 0, NULL, (ControlRef*) &m_macControl) );
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
@@ -64,9 +64,9 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_label = label ;
|
m_label = label ;
|
||||||
|
|
||||||
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
|
||||||
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , "\p" , true , 0 , kControlBehaviorToggles , 1,
|
|
||||||
kControlBevelButtonNormalBevelProc , (long) this ) ;
|
verify_noerr ( CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
|
||||||
wxASSERT_MSG( (ControlRef) m_macControl != NULL , wxT("No valid mac control") ) ;
|
kControlBevelButtonNormalBevel , kControlBehaviorToggles , NULL , 0 , 0 , 0 , (ControlRef*) &m_macControl ) ) ;
|
||||||
|
|
||||||
MacPostControlCreate(pos,size) ;
|
MacPostControlCreate(pos,size) ;
|
||||||
|
|
||||||
@@ -101,15 +101,13 @@ void wxToggleButton::Command(wxCommandEvent & event)
|
|||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToggleButton::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 controlpart , bool WXUNUSED(mouseStillDown) )
|
wxInt32 wxToggleButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
if ( controlpart != kControlNoPart )
|
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId);
|
||||||
{
|
event.SetInt(GetValue());
|
||||||
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId);
|
event.SetEventObject(this);
|
||||||
event.SetInt(GetValue());
|
ProcessCommand(event);
|
||||||
event.SetEventObject(this);
|
return noErr ;
|
||||||
ProcessCommand(event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_TOGGLEBTN
|
#endif // wxUSE_TOGGLEBTN
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
|
BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
|
||||||
EVT_MOUSE_EVENTS( wxToolBar::OnMouse )
|
|
||||||
EVT_PAINT( wxToolBar::OnPaint )
|
EVT_PAINT( wxToolBar::OnPaint )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
#endif
|
#endif
|
||||||
@@ -233,34 +232,21 @@ wxToolBarTool::wxToolBarTool(wxToolBar *tbar,
|
|||||||
SInt16 behaviour = kControlBehaviorOffsetContents ;
|
SInt16 behaviour = kControlBehaviorOffsetContents ;
|
||||||
if ( CanBeToggled() )
|
if ( CanBeToggled() )
|
||||||
behaviour += kControlBehaviorToggles ;
|
behaviour += kControlBehaviorToggles ;
|
||||||
|
|
||||||
if ( info.contentType != kControlNoContent )
|
|
||||||
{
|
|
||||||
m_controlHandle = ::NewControl( window , &toolrect , "\p" , true , 0 ,
|
|
||||||
behaviour + info.contentType , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
|
||||||
|
|
||||||
::SetControlData( m_controlHandle , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
|
CreateBevelButtonControl( window , &toolrect , CFSTR("") , kControlBevelButtonNormalBevel , behaviour , &info ,
|
||||||
}
|
0 , 0 , 0 , &m_controlHandle ) ;
|
||||||
else
|
|
||||||
{
|
|
||||||
m_controlHandle = ::NewControl( window , &toolrect , "\p" , true , 0 ,
|
|
||||||
behaviour , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
|
|
||||||
}
|
|
||||||
InstallControlEventHandler( (ControlRef) m_controlHandle, GetwxMacToolBarToolEventHandlerUPP(),
|
InstallControlEventHandler( (ControlRef) m_controlHandle, GetwxMacToolBarToolEventHandlerUPP(),
|
||||||
GetEventTypeCount(eventList), eventList, this,NULL);
|
GetEventTypeCount(eventList), eventList, this,NULL);
|
||||||
|
|
||||||
UMAShowControl( m_controlHandle ) ;
|
UMAShowControl( m_controlHandle ) ;
|
||||||
if ( !IsEnabled() )
|
if ( !IsEnabled() )
|
||||||
{
|
DisableControl( m_controlHandle ) ;
|
||||||
UMADeactivateControl( m_controlHandle ) ;
|
|
||||||
}
|
|
||||||
if ( CanBeToggled() && IsToggled() )
|
if ( CanBeToggled() && IsToggled() )
|
||||||
{
|
|
||||||
::SetControl32BitValue( m_controlHandle , 1 ) ;
|
::SetControl32BitValue( m_controlHandle , 1 ) ;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
::SetControl32BitValue( m_controlHandle , 0 ) ;
|
::SetControl32BitValue( m_controlHandle , 0 ) ;
|
||||||
}
|
|
||||||
|
|
||||||
ControlRef container = (ControlRef) tbar->GetHandle() ;
|
ControlRef container = (ControlRef) tbar->GetHandle() ;
|
||||||
wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
|
wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
|
||||||
@@ -406,27 +392,6 @@ wxSize wxToolBar::GetToolSize() const
|
|||||||
return wxSize(m_defaultWidth + 4, m_defaultHeight + 4);
|
return wxSize(m_defaultWidth + 4, m_defaultHeight + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
|
|
||||||
{
|
|
||||||
wxToolBarToolsList::Node *node;
|
|
||||||
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
|
|
||||||
{
|
|
||||||
wxToolBarTool* tool = (wxToolBarTool*) node->GetData() ;
|
|
||||||
if ( tool->IsButton() )
|
|
||||||
{
|
|
||||||
if( tool->GetControlHandle() == control )
|
|
||||||
{
|
|
||||||
if ( tool->CanBeToggled() )
|
|
||||||
{
|
|
||||||
tool->Toggle( GetControl32BitValue( (ControlRef) control ) ) ;
|
|
||||||
}
|
|
||||||
OnLeftClick( tool->GetId() , tool -> IsToggled() ) ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxToolBar::SetRows(int nRows)
|
void wxToolBar::SetRows(int nRows)
|
||||||
{
|
{
|
||||||
if ( nRows == m_maxRows )
|
if ( nRows == m_maxRows )
|
||||||
@@ -577,57 +542,5 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
|
|||||||
event.Skip() ;
|
event.Skip() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::OnMouse( wxMouseEvent &event )
|
|
||||||
{
|
|
||||||
if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
|
|
||||||
{
|
|
||||||
|
|
||||||
int x = event.m_x ;
|
|
||||||
int y = event.m_y ;
|
|
||||||
|
|
||||||
MacClientToRootWindow( &x , &y ) ;
|
|
||||||
|
|
||||||
ControlRef control ;
|
|
||||||
Point localwhere ;
|
|
||||||
SInt16 controlpart ;
|
|
||||||
WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ;
|
|
||||||
|
|
||||||
localwhere.h = x ;
|
|
||||||
localwhere.v = y ;
|
|
||||||
|
|
||||||
short modifiers = 0;
|
|
||||||
|
|
||||||
if ( !event.m_leftDown && !event.m_rightDown )
|
|
||||||
modifiers |= btnState ;
|
|
||||||
|
|
||||||
if ( event.m_shiftDown )
|
|
||||||
modifiers |= shiftKey ;
|
|
||||||
|
|
||||||
if ( event.m_controlDown )
|
|
||||||
modifiers |= controlKey ;
|
|
||||||
|
|
||||||
if ( event.m_altDown )
|
|
||||||
modifiers |= optionKey ;
|
|
||||||
|
|
||||||
if ( event.m_metaDown )
|
|
||||||
modifiers |= cmdKey ;
|
|
||||||
|
|
||||||
controlpart = ::FindControl( localwhere , window , &control ) ;
|
|
||||||
{
|
|
||||||
if ( control && ::IsControlActive( control ) )
|
|
||||||
{
|
|
||||||
{
|
|
||||||
controlpart = ::HandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
|
|
||||||
wxTheApp->s_lastMouseDown = 0 ;
|
|
||||||
if ( control && controlpart != kControlNoPart ) // otherwise we will get the event twice
|
|
||||||
{
|
|
||||||
MacHandleControlClick((WXWidget) control , controlpart , false /* not down anymore */ ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_TOOLBAR
|
#endif // wxUSE_TOOLBAR
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user