#endif
#include "wx/defs.h"
+
+#if wxUSE_CHOICE
+
#include "wx/choice.h"
#include "wx/menu.h"
#include "wx/mac/uma.h"
const wxValidator& validator,
const wxString& name)
{
- m_macIsUserPane = FALSE ;
-
+ 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() ;
- verify_noerr ( CreatePopupButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
+ verify_noerr ( CreatePopupButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
-12345 , false /* no variable width */ , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) );
-
+
m_macPopUpMenuHandle = NewUniqueMenu() ;
m_peer->SetData<MenuHandle>( kControlNoPart , kControlPopupButtonMenuHandleTag , (MenuHandle) m_macPopUpMenuHandle ) ;
Append(choices[i]);
}
SetBestSize(size); // Needed because it is a wxControlWithItems
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
for( int i = 0 ; i < GetCount() ; i++ )
{
- if ( GetString( i ).IsSameAs(s, FALSE) )
+ if ( GetString( i ).IsSameAs(s, false) )
return i ;
}
return wxNOT_FOUND ;
return (wxClientData *)DoGetItemClientData(n);
}
-wxInt32 wxChoice::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
+wxInt32 wxChoice::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
{
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
int n = GetSelection();
}
return wxSize(lbWidth, lbHeight);
}
+
+#endif // wxUSE_CHOICE
#pragma implementation "slider.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_SLIDER
+
#include "wx/slider.h"
#include "wx/mac/uma.h"
#define wxSLIDER_DIMENSIONACROSS 15
#define wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS 24
#define wxSLIDER_DIMENSIONACROSS_ARROW 18
-
+
// Distance between slider and text
#define wxSLIDER_BORDERTEXT 5
-
+
/* NB! The default orientation for a slider is horizontal however if the user specifies
* some slider styles but dosen't specify the orientation we have to assume he wants a
* horizontal one. Therefore in this file when testing for the sliders orientation
* vertical is tested for if this is not set then we use the horizontal one
- * eg. if(GetWindowStyle() & wxSL_VERTICAL) {} else { horizontal case }>
+ * eg. if(GetWindowStyle() & wxSL_VERTICAL) {} else { horizontal case }>
*/
// Slider
const wxValidator& validator,
const wxString& name)
{
- m_macIsUserPane = FALSE ;
-
+ m_macIsUserPane = false ;
+
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
return 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);
-
- Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
-
+
+ Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+
UInt16 tickMarks = 0 ;
if ( style & wxSL_AUTOTICKS )
- tickMarks = (maxValue - minValue);
-
+ tickMarks = (maxValue - minValue);
+
if (tickMarks > 20)
tickMarks = tickMarks/5; //keep the number of tickmarks from becoming unwieldly
-
+
m_peer = new wxMacControl() ;
- verify_noerr ( CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
+ verify_noerr ( CreateSliderControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds ,
value , minValue , maxValue , kControlSliderPointsDownOrRight , tickMarks , true /* liveTracking */ ,
wxMacLiveScrollbarActionUPP , m_peer->GetControlRefAddr() ) );
-
-
+
+
if(style & wxSL_VERTICAL) {
SetSizeHints(10, -1, 10, -1); // Forces SetSize to use the proper width
}
// 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, -1, wxEmptyString );
- m_macMaximumStatic = new wxStaticText( parent, -1, wxEmptyString );
- m_macValueStatic = new wxStaticText( parent, -1, wxEmptyString );
+ 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;
}
void wxSlider::SetValue(int value)
{
wxString valuestring ;
- valuestring.Printf( wxT("%d") , value ) ;
+ valuestring.Printf( wxT("%d") , value ) ;
if ( m_macValueStatic )
m_macValueStatic->SetLabel( valuestring ) ;
m_peer->SetValue( value ) ;
void wxSlider::SetRange(int minValue, int maxValue)
{
wxString value;
-
+
m_rangeMin = minValue;
m_rangeMax = maxValue;
-
+
m_peer->SetMinimum( m_rangeMin);
m_peer->SetMaximum( m_rangeMax);
-
+
if(m_macMinimumStatic) {
value.Printf(wxT("%d"), m_rangeMin);
m_macMinimumStatic->SetLabel(value);
ProcessCommand (event);
}
-void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bool mouseStillDown )
+void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bool mouseStillDown )
{
SInt16 value = m_peer->GetValue() ;
-
- SetValue( value ) ;
-
+
+ SetValue( value ) ;
+
wxEventType scrollEvent = wxEVT_NULL ;
-
+
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
-
+
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 );
}
-wxInt32 wxSlider::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent )
+wxInt32 wxSlider::MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF mevent )
{
SInt16 value = m_peer->GetValue() ;
-
- SetValue( value ) ;
-
+
+ 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 ;
}
int incW , int incH )
{
wxSize size = GetBestSize();
-
+
if(GetWindowStyle() & wxSL_VERTICAL) {
wxWindow::SetSizeHints(size.x, minH, size.x, maxH, incW, incH);
}
{
wxSize size;
int textwidth, textheight;
-
+
if(GetWindowStyle() & wxSL_LABELS)
{
wxString text;
int ht, wd;
-
+
// Get maximum text label width and height
text.Printf(wxT("%d"), m_rangeMin);
GetTextExtent(text, &textwidth, &textheight);
textwidth = wd;
}
}
-
+
if(GetWindowStyle() & wxSL_VERTICAL)
{
if(GetWindowStyle() & wxSL_AUTOTICKS) {
int xborder, yborder;
int minValWidth, maxValWidth, textwidth, textheight;
int sliderBreadth;
-
+
xborder = yborder = 0;
if (GetWindowStyle() & wxSL_LABELS)
//relative to its parent in order to size properly, so
//move the control first so we can use GetPosition()
wxControl::DoSetSize( x, y , w , h ,sizeFlags ) ;
-
+
wxString text;
int ht;
-
+
// Get maximum text label width and height
text.Printf(wxT("%d"), m_rangeMin);
GetTextExtent(text, &minValWidth, &textheight);
textheight = ht;
}
textwidth = (minValWidth > maxValWidth ? minValWidth : maxValWidth);
-
+
xborder = textwidth + wxSLIDER_BORDERTEXT;
yborder = textheight + wxSLIDER_BORDERTEXT;
-
+
// Get slider breadth
if(GetWindowStyle() & wxSL_AUTOTICKS) {
sliderBreadth = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
else {
sliderBreadth = wxSLIDER_DIMENSIONACROSS_ARROW;
}
-
+
if(GetWindowStyle() & wxSL_VERTICAL)
{
h = h - yborder ;
-
+
if ( m_macMinimumStatic )
m_macMinimumStatic->Move(GetPosition().x + sliderBreadth + wxSLIDER_BORDERTEXT,
GetPosition().y + h - yborder);
}
}
//If the control has labels, we still need to call this again because
- //the labels alter the control's w and h values.
+ //the labels alter the control's w and h values.
wxControl::DoSetSize( x, y , w , h ,sizeFlags ) ;
}
{
wxControl::DoMoveWindow(x,y,width,height) ;
}
+
+#endif // wxUSE_SLIDER
#pragma implementation "spinbuttbase.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_SPINBTN
+
#include "wx/spinbutt.h"
#include "wx/mac/uma.h"
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
{
- m_macIsUserPane = FALSE ;
-
+ 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;
-
+ return false;
+
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
-
+
m_peer = new wxMacControl() ;
verify_noerr ( CreateLittleArrowsControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , 0 , m_min , m_max , 1 ,
m_peer->GetControlRefAddr() ) );
-
+
m_peer->SetActionProc( wxMacLiveScrollbarActionUPP ) ;
MacPostControlCreate(pos,size) ;
-
- return TRUE;
+
+ return true;
}
-
+
wxSpinButton::~wxSpinButton()
{
}
void wxSpinButton::MacHandleValueChanged( int inc )
{
-
+
wxEventType scrollEvent = wxEVT_NULL;
int oldValue = m_value ;
-
+
m_value = oldValue + inc;
-
+
if (m_value < m_min)
{
if ( m_windowStyle & wxSP_WRAP )
else
m_value = m_min;
}
-
+
if (m_value > m_max)
{
if ( m_windowStyle & wxSP_WRAP )
else
m_value = m_max;
}
-
+
if ( m_value - oldValue == -1 )
scrollEvent = wxEVT_SCROLL_LINEDOWN ;
else if ( m_value - oldValue == 1 )
scrollEvent = wxEVT_SCROLL_LINEUP ;
else
scrollEvent = wxEVT_SCROLL_THUMBTRACK ;
-
+
wxSpinEvent event(scrollEvent, m_windowId);
-
+
event.SetPosition(m_value);
event.SetEventObject( this );
if ((GetEventHandler()->ProcessEvent( event )) &&
m_value = oldValue ;
}
m_peer->SetValue( m_value ) ;
-
+
/* always send a thumbtrack event */
if (scrollEvent != wxEVT_SCROLL_THUMBTRACK)
{
}
}
-void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown )
+void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown )
{
int nScrollInc = 0;
-
+
switch( controlpart )
{
case kControlUpButtonPart :
MacHandleValueChanged( nScrollInc ) ;
}
-wxInt32 wxSpinButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF event )
+wxInt32 wxSpinButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF event )
{
/*
// these have been handled by the live action proc already
int nScrollInc = 0;
wxMacCarbonEvent cEvent( (EventRef) event ) ;
-
+
switch( cEvent.GetParameter<ControlPartCode>(kEventParamControlPart,typeControlPartCode) )
{
case kControlUpButtonPart :
return wxSize(16,24);
}
+#endif // wxUSE_SPINBTN
#endif
#include "wx/defs.h"
+
+#if wxUSE_CHOICE
+
#include "wx/choice.h"
#include "wx/menu.h"
#include "wx/mac/uma.h"
{
Append(choices[i]);
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
{
for( int i = 0 ; i < GetCount() ; i++ )
{
- if ( GetString( i ).IsSameAs(s, FALSE) )
+ if ( GetString( i ).IsSameAs(s, false) )
return i ;
}
return wxNOT_FOUND ;
return (wxClientData *)DoGetItemClientData(n);
}
-void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
+void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
{
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
int n = GetSelection();
}
return wxSize(lbWidth, lbHeight);
}
+
+#endif // wxUSE_CHOICE
#pragma implementation "slider.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_SLIDER
+
#include "wx/slider.h"
#include "wx/mac/uma.h"
#define wxSLIDER_DIMENSIONACROSS 15
#define wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS 24
#define wxSLIDER_DIMENSIONACROSS_ARROW 18
-
+
// Distance between slider and text
#define wxSLIDER_BORDERTEXT 5
-
+
/* NB! The default orientation for a slider is horizontal however if the user specifies
* some slider styles but dosen't specify the orientation we have to assume he wants a
* horizontal one. Therefore in this file when testing for the sliders orientation
* vertical is tested for if this is not set then we use the horizontal one
- * eg. if(GetWindowStyle() & wxSL_VERTICAL) {} else { horizontal case }>
+ * eg. if(GetWindowStyle() & wxSL_VERTICAL) {} else { horizontal case }>
*/
// Slider
Rect bounds ;
Str255 title ;
SInt16 procID;
-
+
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);
-
+
MacPreControlCreate( parent, id, wxEmptyString, pos, size, style,
validator, name, &bounds, title );
-
+
procID = kControlSliderProc + kControlSliderLiveFeedback;
if(style & wxSL_AUTOTICKS) {
procID += kControlSliderHasTickMarks;
}
-
-
+
+
m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, title, false,
value, minValue, maxValue, procID, (long) this);
-
+
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
-
+
::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
-
+
if(style & wxSL_LABELS)
{
- m_macMinimumStatic = new wxStaticText( this, -1, wxEmptyString );
- m_macMaximumStatic = new wxStaticText( this, -1, wxEmptyString );
- m_macValueStatic = new wxStaticText( this, -1, wxEmptyString );
+ m_macMinimumStatic = new wxStaticText( this, wxID_ANY, wxEmptyString );
+ m_macMaximumStatic = new wxStaticText( this, wxID_ANY, wxEmptyString );
+ m_macValueStatic = new wxStaticText( this, wxID_ANY, wxEmptyString );
SetRange(minValue, maxValue);
SetValue(value);
}
-
+
else {
m_macMinimumStatic = NULL ;
m_macMaximumStatic = NULL ;
m_macValueStatic = NULL ;
}
-
+
if(style & wxSL_VERTICAL) {
SetSizeHints(10, -1, 10, -1); // Forces SetSize to use the proper width
}
// 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
-
+
MacPostControlCreate() ;
-
+
return true;
}
void wxSlider::SetValue(int value)
{
wxString valuestring ;
- valuestring.Printf( wxT("%d") , value ) ;
+ valuestring.Printf( wxT("%d") , value ) ;
if ( m_macValueStatic )
m_macValueStatic->SetLabel( valuestring ) ;
SetControl32BitValue( (ControlHandle) m_macControl , value ) ;
void wxSlider::SetRange(int minValue, int maxValue)
{
wxString value;
-
+
m_rangeMin = minValue;
m_rangeMax = maxValue;
-
+
SetControl32BitMinimum( (ControlHandle) m_macControl, m_rangeMin);
SetControl32BitMaximum( (ControlHandle) m_macControl, m_rangeMax);
-
+
if(m_macMinimumStatic) {
value.Printf(wxT("%d"), m_rangeMin);
m_macMinimumStatic->SetLabel(value);
ProcessCommand (event);
}
-void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bool mouseStillDown )
+void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart, bool mouseStillDown )
{
SInt16 value = ::GetControl32BitValue( (ControlHandle) m_macControl ) ;
-
- SetValue( value ) ;
-
+
+ SetValue( value ) ;
+
wxEventType scrollEvent = wxEVT_NULL ;
-
+
if ( mouseStillDown )
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
else
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 );
}
int incW , int incH )
{
wxSize size = GetBestSize();
-
+
if(GetWindowStyle() & wxSL_VERTICAL) {
wxWindow::SetSizeHints(size.x, minH, size.x, maxH, incW, incH);
}
{
wxSize size;
int textwidth, textheight;
-
+
if(GetWindowStyle() & wxSL_LABELS)
{
wxString text;
int ht, wd;
-
+
// Get maximum text label width and height
text.Printf(wxT("%d"), m_rangeMin);
GetTextExtent(text, &textwidth, &textheight);
textwidth = wd;
}
}
-
+
if(GetWindowStyle() & wxSL_VERTICAL)
{
if(GetWindowStyle() & wxSL_AUTOTICKS) {
wxControl::DoSetSize( x, y , width , height ,sizeFlags ) ;
}
-void wxSlider::MacUpdateDimensions()
+void wxSlider::MacUpdateDimensions()
{
// actually in the current systems this should never be possible, but later reparenting
// may become a reality
-
+
if ( (ControlHandle) m_macControl == NULL )
return ;
-
+
if ( GetParent() == NULL )
return ;
-
+
WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
if ( rootwindow == NULL )
return ;
-
+
int xborder, yborder;
int minValWidth, maxValWidth, textwidth, textheight;
int sliderBreadth;
-
+
xborder = yborder = 0;
-
+
if (GetWindowStyle() & wxSL_LABELS)
{
wxString text;
int ht;
-
+
// Get maximum text label width and height
text.Printf(wxT("%d"), m_rangeMin);
GetTextExtent(text, &minValWidth, &textheight);
textheight = ht;
}
textwidth = (minValWidth > maxValWidth ? minValWidth : maxValWidth);
-
+
xborder = textwidth + wxSLIDER_BORDERTEXT;
yborder = textheight + wxSLIDER_BORDERTEXT;
-
+
// Get slider breadth
if(GetWindowStyle() & wxSL_AUTOTICKS) {
sliderBreadth = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
else {
sliderBreadth = wxSLIDER_DIMENSIONACROSS_ARROW;
}
-
+
if(GetWindowStyle() & wxSL_VERTICAL)
{
m_macMinimumStatic->Move(sliderBreadth + wxSLIDER_BORDERTEXT,
m_macValueStatic->Move(m_width - textwidth, 0);
}
}
-
- Rect oldBounds ;
- GetControlBounds( (ControlHandle) m_macControl , &oldBounds ) ;
-
+
+ Rect oldBounds ;
+ GetControlBounds( (ControlHandle) m_macControl , &oldBounds ) ;
+
int new_x = m_x + MacGetLeftBorderSize() + m_macHorizontalBorder ;
int new_y = m_y + MacGetTopBorderSize() + m_macVerticalBorder ;
int new_width = m_width - MacGetLeftBorderSize() - MacGetRightBorderSize() - 2 * m_macHorizontalBorder - xborder ;
int new_height = m_height - MacGetTopBorderSize() - MacGetBottomBorderSize() - 2 * m_macVerticalBorder - yborder ;
-
+
GetParent()->MacWindowToRootWindow( & new_x , & new_y ) ;
bool doMove = new_x != oldBounds.left || new_y != oldBounds.top ;
bool doResize = ( oldBounds.right - oldBounds.left ) != new_width || (oldBounds.bottom - oldBounds.top ) != new_height ;
{
wxControl::DoMoveWindow(x,y,width,height) ;
}
+
+#endif // wxUSE_SLIDER
#pragma implementation "spinbuttbase.h"
#endif
+#include "wx/defs.h"
+
+#if wxUSE_SPINBTN
+
#include "wx/spinbutt.h"
#include "wx/mac/uma.h"
m_min = 0;
m_max = 100;
-
+
if (!parent)
- return FALSE;
-
+ return false;
+
Rect bounds ;
Str255 title ;
-
+
MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
-
- m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 100,
+
+ m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 100,
kControlLittleArrowsProc , (long) this ) ;
-
+
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
-
+
MacPostControlCreate() ;
-
- return TRUE;
+
+ return true;
}
-
+
wxSpinButton::~wxSpinButton()
{
}
void wxSpinButton::MacHandleValueChanged( int inc )
{
-
+
wxEventType scrollEvent = wxEVT_NULL;
int oldValue = m_value ;
-
+
m_value = oldValue + inc;
-
+
if (m_value < m_min)
{
if ( m_windowStyle & wxSP_WRAP )
else
m_value = m_min;
}
-
+
if (m_value > m_max)
{
if ( m_windowStyle & wxSP_WRAP )
else
m_value = m_max;
}
-
+
if ( m_value - oldValue == -1 )
scrollEvent = wxEVT_SCROLL_LINEDOWN ;
else if ( m_value - oldValue == 1 )
scrollEvent = wxEVT_SCROLL_LINEUP ;
else
scrollEvent = wxEVT_SCROLL_THUMBTRACK ;
-
+
wxSpinEvent event(scrollEvent, m_windowId);
-
+
event.SetPosition(m_value);
event.SetEventObject( this );
if ((GetEventHandler()->ProcessEvent( event )) &&
m_value = oldValue ;
}
SetControl32BitValue( (ControlHandle) m_macControl , m_value ) ;
-
+
/* always send a thumbtrack event */
if (scrollEvent != wxEVT_SCROLL_THUMBTRACK)
{
}
}
-void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
+void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
{
if ( (ControlHandle) m_macControl == NULL )
return ;
-
+
int nScrollInc = 0;
-
+
switch( controlpart )
{
case kControlUpButtonPart :
break ;
}
MacHandleValueChanged( nScrollInc ) ;
-
+
}
// ----------------------------------------------------------------------------
return wxSize(16,24);
}
+#endif // wxUSE_SPINBTN
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#include "wx/defs.h"
+#if wxUSE_CHOICE
+
#include "wx/choice.h"
#include "wx/utils.h"
#include "wx/arrstr.h"
const wxString& name)
{
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
- return FALSE;
+ return false;
Widget parentWidget = (Widget) parent->GetClientWidget();
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
- ChangeFont(FALSE);
+ ChangeFont(false);
ChangeBackgroundColour();
AttachWidget (parent, m_buttonWidget, m_formWidget,
pos.x, pos.y, bestSize.x, bestSize.y);
- return TRUE;
+ return true;
}
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
int wxChoice::DoInsert(const wxString& item, int pos)
{
- wxCHECK_MSG(FALSE, -1, wxT("insert not implemented"));
+ wxCHECK_MSG(false, -1, wxT("insert not implemented"));
// wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
// if (pos == GetCount()) return DoAppend(item);
void wxChoice::SetSelection(int n)
{
- m_inSetValue = TRUE;
+ m_inSetValue = true;
wxStringList::compatibility_iterator node = m_stringList.Item(n);
if (node)
XmNmenuHistory, (Widget) m_widgetArray[n], NULL);
#endif
}
- m_inSetValue = FALSE;
+ m_inSetValue = false;
}
int wxChoice::FindString(const wxString& s) const
i++;
}
- return -1;
+ return wxNOT_FOUND;
}
wxString wxChoice::GetString(int n) const
XtVaSetValues( (Widget)m_widgetArray[i],
fontTag, fontType,
NULL );
-
+
GetSize(& width1, & height1);
if (keepOriginalSize && (width != width1 || height != height1))
{
- SetSize(-1, -1, width, height);
+ SetSize(wxDefaultCoord, wxDefaultCoord, width, height);
}
}
}
void wxChoice::DoSetItemClientData(int n, void* clientData)
{
- m_clientDataDict.Set(n, (wxClientData*)clientData, FALSE);
+ m_clientDataDict.Set(n, (wxClientData*)clientData, false);
}
void* wxChoice::DoGetItemClientData(int n) const
void wxChoice::DoSetItemClientObject(int n, wxClientData* clientData)
{
// don't delete, wxItemContainer does that for us
- m_clientDataDict.Set(n, clientData, FALSE);
+ m_clientDataDict.Set(n, clientData, false);
}
wxClientData* wxChoice::DoGetItemClientObject(int n) const
return wxSize( ( items.x ? items.x + WIDTH_OVERHEAD : 120 ),
items.y + HEIGHT_OVERHEAD );
}
+
+#endif // wxUSE_CHOICE
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
+#include "wx/defs.h"
+
+#if wxUSE_SLIDER
+
#include "wx/slider.h"
#include "wx/utils.h"
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
- ChangeFont(FALSE);
+ ChangeFont(false);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();
- return TRUE;
+ return true;
}
wxSlider::~wxSlider()
slider->GetEventHandler()->ProcessEvent(event2);
}
+#endif // wxUSE_SLIDER
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
+#include "wx/defs.h"
+
+#if wxUSE_SPINBTN
+
#include "wx/spinbutt.h"
#include "wx/spinctrl.h"
#include "wx/timer.h"
{
friend class wxArrowButtonTimer;
public:
- wxArrowButton( int increment )
+ wxArrowButton( int increment )
: m_increment( increment ),
m_timer( 0 ) {}
SetForegroundColour( parent->GetBackgroundColour() );
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
if( !wxControl::Create( parent, id, pos, newSize, style ) )
{
- return FALSE;
+ return false;
}
SetName(name);
- m_windowId = ( id == -1 ) ? NewControlId() : id;
+ m_windowId = ( id == wxID_ANY ) ? NewControlId() : id;
bool isVert = IsVertical();
wxPoint pt1, pt2;
isVert ? wxARROW_DOWN : wxARROW_LEFT,
pt2, sz2, -1 );
- return TRUE;
+ return true;
}
wxSpinButton::~wxSpinButton()
{
// TODO
}
+
+#endif // wxUSE_SPINBTN
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
+#include "wx/defs.h"
+
+#if wxUSE_CHOICE
+
#ifndef WX_PRECOMP
#include "wx/choice.h"
#include "wx/utils.h"
,rValidator
,rsName
))
- return FALSE;
+ return false;
lSstyle = CBS_DROPDOWNLIST |
WS_TABSTOP |
WS_VISIBLE;
if (!OS2CreateControl( wxT("COMBOBOX")
,lSstyle
))
- return FALSE;
+ return false;
//
// A choice/combobox normally has a white background (or other, depending
,rSize.y
);
delete pTextFont;
- return TRUE;
+ return true;
} // end of wxChoice::Create
// ----------------------------------------------------------------------------
//
// "selection changed" is the only event we're after
//
- return FALSE;
+ return false;
}
int n = GetSelection();
vEvent.SetClientData(GetClientData(n));
ProcessCommand(vEvent);
}
- return TRUE;
+ return true;
} // end of wxChoice::OS2Command
void wxChoice::Free()
delete GetClientObject(n);
}
}
-} // end of wxhoice::Free
+} // end of wxChoice::Free
+
+#endif // wxUSE_CHOICE
#include <wx/scrolwin.h>
#endif
+#if wxUSE_SLIDER
+
#include "wx/slider.h"
#include "wx/os2/private.h"
,(PVOID)&lColor
);
SetValue(nValue);
- return TRUE;
+ return true;
} // end of wxSlider::Create
void wxSlider::DoSetSize(
break;
default:
- return FALSE;
+ return false;
}
int nPixelRange = SHORT1FROMMR(::WinSendMsg( GetHwnd()
//
// Out of range - but we did process it
//
- return TRUE;
+ return true;
}
SetValue(nNewPos);
::WinShowWindow((HWND)m_hStaticMin, bShow);
if(m_hStaticMax)
::WinShowWindow((HWND)m_hStaticMax, bShow);
- return TRUE;
+ return true;
} // end of wxSlider::Show
+#endif // wxUSE_SLIDER
#include "wx/wx.h"
#endif
-#if wxUSE_SPINBTN
+#if wxUSE_SPINCTRL
#include "wx/spinctrl.h"
#include "wx/os2/private.h"
BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton)
EVT_CHAR(wxSpinCtrl::OnChar)
- EVT_SPIN(-1, wxSpinCtrl::OnSpinChange)
+ EVT_SPIN(wxID_ANY, wxSpinCtrl::OnSpinChange)
EVT_SET_FOCUS(wxSpinCtrl::OnSetFocus)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------
{
SWP vSwp;
- if (vId == -1)
+ if (vId == wxID_ANY)
m_windowId = NewControlId();
else
m_windowId = vId;
);
if (m_hWnd == 0)
{
- return FALSE;
+ return false;
}
m_hWndBuddy = m_hWnd; // One in the same for OS/2
if(pParent)
fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc);
m_svAllSpins.Add(this);
delete pTextFont;
- return TRUE;
+ return true;
} // end of wxSpinCtrl::Create
wxSize wxSpinCtrl::DoGetBestSize() const
{
if (!wxControl::Enable(bEnable))
{
- return FALSE;
+ return false;
}
::WinEnableWindow(GetHwnd(), bEnable);
- return TRUE;
+ return true;
} // end of wxSpinCtrl::Enable
wxSpinCtrl* wxSpinCtrl::GetSpinForTextCtrl(
//
// Not processed
//
- return FALSE;
+ return false;
} // end of wxSpinCtrl::ProcessTextCommand
void wxSpinCtrl::SetFocus()
if (!wxWindowBase::SetFont(rFont))
{
// nothing to do
- return FALSE;
+ return false;
}
wxOS2SetFont( m_hWnd
,rFont
);
- return TRUE;
+ return true;
} // end of wxSpinCtrl::SetFont
void wxSpinCtrl::SetValue(
{
if (!wxControl::Show(bShow))
{
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
} // end of wxSpinCtrl::Show
void wxSpinCtrl::SetSelection (
::WinSendMsg(m_hWnd, EM_SETSEL, MPFROM2SHORT((USHORT)lFrom, (USHORT)lTo), (MPARAM)0);
} // end of wxSpinCtrl::SetSelection
-#endif //wxUSE_SPINBTN
+#endif //wxUSE_SPINCTRL