CW5.2 Pro Adaptions, wxMac starting to move in

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
1999-11-05 09:16:09 +00:00
parent 20f2deb3cf
commit 519cb848a8
176 changed files with 19303 additions and 9141 deletions

View File

@@ -14,6 +14,7 @@
#endif
#include "wx/slider.h"
#include "wx/mac/uma.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
@@ -34,6 +35,8 @@ wxSlider::wxSlider()
m_tickFreq = 0;
}
extern ControlActionUPP wxMacLiveScrollbarActionUPP ;
bool wxSlider::Create(wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& pos,
@@ -41,28 +44,92 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator,
const wxString& name)
{
SetName(name);
SetValidator(validator);
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
if (parent) parent->AddChild(this);
m_macMinimumStatic = NULL ;
m_lineSize = 1;
m_windowStyle = style;
m_tickFreq = 0;
m_lineSize = 1;
m_tickFreq = 0;
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
m_rangeMax = maxValue;
m_rangeMin = minValue;
m_rangeMax = maxValue;
m_rangeMin = minValue;
m_pageSize = (int)((maxValue-minValue)/10);
if ( m_width == -1 )
{
m_width = 20 ;
if ( style & wxSL_LABELS && style & wxSL_VERTICAL )
m_width += 24 ;
bounds.right = bounds.left + m_width ;
}
if ( m_height == -1 )
{
m_height = 20 ;
if ( style & wxSL_LABELS && style & wxSL_HORIZONTAL )
m_height += 24 ;
bounds.bottom = bounds.top + m_height ;
}
if ( style & wxSL_LABELS && style & wxSL_HORIZONTAL )
{
bounds.top += 12 ;
bounds.right -= 24 ;
}
if ( style & wxSL_LABELS && style & wxSL_VERTICAL )
{
bounds.left += 24 ;
bounds.top += 12 ;
}
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , value , minValue , maxValue,
kControlSliderProc + kControlSliderLiveFeedback + ( ( style & wxSL_AUTOTICKS ) ? kControlSliderHasTickMarks : 0 ) , (long) this ) ;
wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
m_pageSize = (int)((maxValue-minValue)/10);
::SetControlAction( m_macControl , wxMacLiveScrollbarActionUPP ) ;
// TODO create slider
MacPostControlCreate() ;
if ( style & wxSL_LABELS )
{
if ( style & wxSL_HORIZONTAL )
{
wxSize size( 24 , 12 ) ;
wxPoint leftpos( 0 , 0 ) ;
wxPoint rightpos( m_width - 2 * 12 , 0 ) ;
wxPoint valuepos( m_width - 12 , 20 ) ;
wxString valuestring ;
valuestring.Printf( "%d" , minValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , leftpos , size ) ;
valuestring.Printf( "%d" , maxValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , rightpos , size ) ;
valuestring.Printf( "%d" , value ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , valuepos , size ) ;
}
else
{
wxSize size( 24 , 12 ) ;
wxPoint toppos( 0 , 12 ) ;
wxPoint bottompos( 0 , m_height - 12 ) ;
wxPoint valuepos( 20 , 0 ) ;
wxString valuestring ;
valuestring.Printf( "%d" , minValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , bottompos , size ) ;
valuestring.Printf( "%d" , maxValue ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , toppos , size ) ;
valuestring.Printf( "%d" , value ) ;
m_macMinimumStatic = new wxStaticText( this , -1 , valuestring , valuepos , size ) ;
}
}
return TRUE;
return FALSE;
}
wxSlider::~wxSlider()
@@ -71,28 +138,16 @@ wxSlider::~wxSlider()
int wxSlider::GetValue() const
{
// TODO
return 0;
return GetControlValue( m_macControl) ;
}
void wxSlider::SetValue(int value)
{
// TODO
}
void wxSlider::GetSize(int *width, int *height) const
{
// TODO
}
void wxSlider::GetPosition(int *x, int *y) const
{
// TODO
}
void wxSlider::SetSize(int x, int y, int width, int height, int sizeFlags)
{
// TODO
wxString valuestring ;
valuestring.Printf( "%d" , value ) ;
if ( m_macMinimumStatic )
m_macMinimumStatic->SetLabel( valuestring ) ;
SetControlValue( m_macControl , value ) ;
}
void wxSlider::SetRange(int minValue, int maxValue)
@@ -182,9 +237,32 @@ void wxSlider::Command (wxCommandEvent & event)
ProcessCommand (event);
}
bool wxSlider::Show(bool show)
bool wxSlider::Show( bool show )
{
// TODO
return TRUE;
return wxWindow::Show( show ) ;
}
void wxSlider::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
{
SInt16 value = ::GetControlValue( m_macControl ) ;
SetValue( value ) ;
wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
event.SetPosition(GetControlValue( m_macControl) );
event.SetEventObject( this );
#if WXWIN_COMPATIBILITY
wxEventType oldEvent = event.GetEventType();
event.SetEventType( wxEVT_COMMAND_SLIDER_UPDATED );
if ( !GetEventHandler()->ProcessEvent(event) )
{
event.SetEventType( oldEvent );
if (!GetParent()->GetEventHandler()->ProcessEvent(event))
event.Skip();
}
#else
GetEventHandler()->ProcessEvent(event);
#endif
}