#include "wx/app.h"
#include "wx/apptrait.h"
-#include "wx/defs.h"
#include "wx/object.h"
#include "wx/string.h"
#include "wx/timer.h"
#endif
// wxUSE_SOCKETS
-
/////////////////////////////////////////////////////////////////////////////
-// Name: generic/imaglist.cpp
+// Name: src/mac/carbon/imaglist.cpp
// Purpose:
// Author: Robert Roebling
-// Id: $id$
+// RCS_ID: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
-#if wxUSE_IMAGLIST
-
#ifdef __BORLANDC__
#pragma hdrstop
#endif
-#include "wx/defs.h"
+#if wxUSE_IMAGLIST
+
#include "wx/imaglist.h"
#include "wx/icon.h"
#include "wx/image.h"
}
#endif // wxUSE_IMAGLIST
-
/////////////////////////////////////////////////////////////////////////////
-// Name: app.cpp
+// Name: src/mac/classic/app.cpp
// Purpose: wxApp
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#include "wx/window.h"
#include "wx/frame.h"
// statics for implementation
-static bool s_inYield = FALSE;
+static bool s_inYield = false;
#if TARGET_CARBON
-static bool s_inReceiveEvent = FALSE ;
+static bool s_inReceiveEvent = false ;
static EventTime sleepTime = kEventDurationNoWait ;
#else
static long sleepTime = 0 ;
{
wxCommandEvent exitEvent(wxEVT_COMMAND_MENU_SELECTED, s_macExitMenuItemId);
if (!win->ProcessEvent(exitEvent))
- win->Close(TRUE ) ;
+ win->Close(true) ;
}
else
{
if (printout)
{
wxPrinter printer;
- printer.Print(view->GetFrame(), printout, TRUE);
+ printer.Print(view->GetFrame(), printout, true);
delete printout;
}
}
MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
-
+
if ( mbar )
{
wxFrame* win = mbar->GetFrame();
if ( win )
{
-
+
// VZ: we could find the menu from its handle here by examining all
// the menus in the menu bar recursively but knowing that neither
// wxMSW nor wxGTK do it why bother...
&menuRef);
#endif // 0
- wxEventType type=0;
+ wxEventType type=0;
MenuCommand cmd=0;
switch (GetEventKind(event))
{
UMAShowArrowCursor() ;
ParamText("\pFatal Error", message, (ConstStr255Param)"\p", (ConstStr255Param)"\p");
itemHit = Alert(128, nil);
- return FALSE ;
+ return false ;
}
#ifndef __DARWIN__
#endif
}
- return TRUE ;
+ return true ;
}
void wxApp::CleanUp()
wxApp::wxApp()
{
- m_printMode = wxPRINT_WINDOWS;
- m_auto3D = TRUE;
+ m_printMode = wxPRINT_WINDOWS;
+ m_auto3D = true;
- m_macCurrentEvent = NULL ;
+ m_macCurrentEvent = NULL ;
#if TARGET_CARBON
- m_macCurrentEventHandlerCallRef = NULL ;
+ m_macCurrentEventHandlerCallRef = NULL ;
#endif
}
int wxApp::MainLoop()
{
- m_keepGoing = TRUE;
+ m_keepGoing = true;
while (m_keepGoing)
{
void wxApp::ExitMainLoop()
{
- m_keepGoing = FALSE;
+ m_keepGoing = false;
}
// Is a message/event pending?
// without the receive event (with pull param = false ) nothing is ever reported
EventRef theEvent;
ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &theEvent);
- return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
+ return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
#else
EventRecord event ;
void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
{
if (GetTopWindow())
- GetTopWindow()->Close(TRUE);
+ GetTopWindow()->Close(true);
}
// Default behaviour: close the application with prompts. The
if (GetTopWindow())
{
if (!GetTopWindow()->Close(!event.CanVeto()))
- event.Veto(TRUE);
+ event.Veto(true);
}
}
wxFAIL_MSG( wxT("wxYield called recursively" ) );
}
- return FALSE;
+ return false;
}
- s_inYield = TRUE;
+ s_inYield = true;
#if wxUSE_THREADS
YieldToAnyThread() ;
#endif
wxMacProcessNotifierAndPendingEvents() ;
- s_inYield = FALSE;
+ s_inYield = false;
- return TRUE;
+ return true;
}
// platform specifics
/*virtual*/ void wxApp::MacHandleUnhandledEvent( WXEVENTREF evr )
{
- // Override to process unhandled events as you please
+ // Override to process unhandled events as you please
}
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
{
// we must avoid reentrancy problems when processing high level events eg printing
bool former = s_inYield ;
- s_inYield = TRUE ;
+ s_inYield = true ;
EventRecord* ev = (EventRecord*) evr ;
::AEProcessAppleEvent( ev ) ;
s_inYield = former ;
wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key !=
WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons"));
- KeyMap keymap;
+ KeyMap keymap;
GetKeys(keymap);
return !!(BitTst(keymap, (sizeof(KeyMap)*8) - key));
}
}
if (!handled)
{
- event.Skip( FALSE ) ;
+ event.Skip( false ) ;
event.SetEventType( wxEVT_CHAR ) ;
// raw value again
event.m_keyCode = realkeyval ;
bool controlDown = ev->modifiers & controlKey ; // for simulating right mouse
event.m_leftDown = isDown && !controlDown;
- event.m_middleDown = FALSE;
+ event.m_middleDown = false;
event.m_rightDown = isDown && controlDown;
event.m_shiftDown = ev->modifiers & shiftKey;
event.m_controlDown = ev->modifiers & controlKey;
event.m_leftDown = isDown && !controlDown;
- event.m_middleDown = FALSE;
+ event.m_middleDown = false;
event.m_rightDown = isDown && controlDown;
event.m_shiftDown = modifiers & shiftKey;
/////////////////////////////////////////////////////////////////////////////
-// Name: bitmap.cpp
+// Name: src/mac/classic/bitmap.cpp
// Purpose: wxBitmap
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#include "wx/bitmap.h"
#include "wx/icon.h"
: m_width(0)
, m_height(0)
, m_depth(0)
- , m_ok(FALSE)
+ , m_ok(false)
, m_numColors(0)
, m_quality(0)
{
bool wxBitmap::CreateFromXpm(const char **bits)
{
- wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") );
+ wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") );
wxXPMDecoder decoder;
wxImage img = decoder.ReadData(bits);
- wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid bitmap data") );
+ wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") );
*this = wxBitmap(img);
- return TRUE;
+ return true;
}
wxBitmap::wxBitmap(const char **bits)
if ( handler == NULL ) {
wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
- return FALSE;
+ return false;
}
return handler->Create(this, data, type, width, height, depth);
UnlockPixels( GetGWorldPixMap( (GWorldPtr) m_maskBitmap) );
UnlockPixels( GetGWorldPixMap( (GWorldPtr) bitmap.GetHBITMAP()) );
- return FALSE;
+ return false;
}
// Create a mask from a bitmap and a palette index indicating
{
// TODO
wxCHECK_MSG( 0, false, wxT("wxMask::Create not yet implemented"));
- return FALSE;
+ return false;
}
// Create a mask from a bitmap and a colour indicating
UnlockPixels( GetGWorldPixMap( (GWorldPtr) bitmap.GetHBITMAP() ) ) ;
SetGWorld( origPort , origDevice ) ;
- return TRUE;
+ return true;
}
bool wxMask::PointMasked(int x, int y)
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
{
- return FALSE;
+ return false;
}
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
{
- return FALSE;
+ return false;
}
bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
{
- return FALSE;
+ return false;
}
/*
M_BITMAPHANDLERDATA->m_numColors = theInfo.uniqueColors ;
// M_BITMAPHANDLERDATA->m_bitmapPalette;
// M_BITMAPHANDLERDATA->m_quality;
- return TRUE ;
+ return true ;
}
- return FALSE ;
+ return false ;
}
void wxBitmap::InitStandardHandlers()
/////////////////////////////////////////////////////////////////////////////
-// Name: button.cpp
+// Name: src/mac/classic/button.cpp
// Purpose: wxButton
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#include "wx/button.h"
#include "wx/panel.h"
wxString label(lbl);
if (label.empty() && wxIsStockID(id))
label = wxGetStockLabel(id);
-
+
if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) )
return false;
m_macHorizontalBorder = kMacOSXHorizontalBorder;
m_macVerticalBorder = kMacOSXVerticalBorder;
}
-
+
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
+ m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlPushButtonProc , (long) this ) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
-
+
MacPostControlCreate() ;
-
- return TRUE;
+
+ return true;
}
void wxButton::SetDefault()
wxSize wxButton::DoGetBestSize() const
{
- wxSize sz = GetDefaultSize() ;
-
- int wBtn = m_label.Length() * 8 + 12 + 2 * kMacOSXHorizontalBorder ;
-
- if (wBtn > sz.x) sz.x = wBtn;
-
- return sz ;
+ wxSize sz = GetDefaultSize() ;
+
+ int wBtn = m_label.Length() * 8 + 12 + 2 * kMacOSXHorizontalBorder ;
+
+ if (wBtn > sz.x) sz.x = wBtn;
+
+ return sz ;
}
wxSize wxButton::GetDefaultSize()
{
- int wBtn = 70 ;
+ int wBtn = 70 ;
int hBtn = 20 ;
if ( UMAHasAquaLayout() )
ProcessCommand (event);
}
-void wxButton::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 controlpart , bool WXUNUSED(mouseStillDown) )
+void wxButton::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 controlpart , bool WXUNUSED(mouseStillDown) )
{
if ( controlpart != kControlNoPart )
{
ProcessCommand(event);
}
}
-
/////////////////////////////////////////////////////////////////////////////
-// Name: checkbox.cpp
+// Name: src/mac/classic/checkbox.cpp
// Purpose: wxCheckBox
// Author: Stefan Csomor
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#include "wx/checkbox.h"
Rect bounds ;
Str255 title ;
-
+
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
SInt16 maxValue = 1 /* kControlCheckboxCheckedValue */;
maxValue = 2 /* kControlCheckboxMixedValue */;
}
- m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , maxValue,
+ m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , maxValue,
kControlCheckBoxProc , (long) this ) ;
-
+
MacPostControlCreate() ;
- return TRUE;
+ return true;
}
void wxCheckBox::SetValue(bool val)
MacRedrawControl() ;
}
-void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) , bool WXUNUSED(mouseStillDown) )
+void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) , bool WXUNUSED(mouseStillDown) )
{
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
wxCheckBoxState state = Get3StateValue();
// TODO: Create the bitmap checkbox
- return FALSE;
+ return false;
}
void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap)
{
// TODO
wxFAIL_MSG(wxT("wxBitmapCheckBox::GetValue() not yet implemented"));
- return FALSE;
+ return false;
}
-
-
/////////////////////////////////////////////////////////////////////////////
-// Name: control.cpp
+// Name: src/mac/classic/control.cpp
// Purpose: wxControl class
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#include "wx/control.h"
#include "wx/panel.h"
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
BEGIN_EVENT_TABLE(wxControl, wxWindow)
- EVT_MOUSE_EVENTS( wxControl::OnMouseEvent )
- EVT_PAINT( wxControl::OnPaint )
+ EVT_MOUSE_EVENTS( wxControl::OnMouseEvent )
+ EVT_PAINT( wxControl::OnPaint )
END_EVENT_TABLE()
#include "wx/mac/uma.h"
pascal SInt32 wxMacControlDefinition(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param)
{
-
+
wxControl* wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
{
}
return status ;
}
-
+
wxControl::wxControl()
{
m_macControl = NULL ;
m_macControl = NULL ;
m_macHorizontalBorder = 0 ; // additional pixels around the real control
m_macVerticalBorder = 0 ;
-
+
bool rval = wxWindow::Create(parent, id, pos, size, style, name);
if ( parent )
{
wxControl::~wxControl()
{
- m_isBeingDeleted = TRUE;
+ m_isBeingDeleted = true;
wxRemoveMacControlAssociation( this ) ;
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
if ( m_macControl )
{
- UMASetControlTitle( (ControlHandle) m_macControl , m_label , m_font.GetEncoding() ) ;
+ UMASetControlTitle( (ControlHandle) m_macControl , m_label , m_font.GetEncoding() ) ;
}
Refresh() ;
}
{
if ( (ControlHandle) m_macControl == NULL )
return wxWindow::DoGetBestSize() ;
-
+
Rect bestsize = { 0 , 0 , 0 , 0 } ;
short baselineoffset ;
int bestWidth, bestHeight ;
}
else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) )
{
- bestsize.bottom = 24 ;
+ bestsize.bottom = 24 ;
}
}
bestWidth = bestsize.right - bestsize.left ;
-
+
bestWidth += 2 * m_macHorizontalBorder ;
bestHeight = bestsize.bottom - bestsize.top ;
bestHeight += 2 * m_macVerticalBorder;
-
+
return wxSize(bestWidth, bestHeight);
}
wxWinMacControlList->DeleteObject(control);
}
-void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label ,
+void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label ,
const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator,
- const wxString& name , WXRECTPTR outBounds , unsigned char* maclabel )
+ const wxString& name , WXRECTPTR outBounds , unsigned char* maclabel )
{
m_label = label ;
m_height = size.y ;
m_x = pos.x ;
m_y = pos.y ;
-
+
((Rect*)outBounds)->top = -10;
((Rect*)outBounds)->left = -10;
((Rect*)outBounds)->bottom = 0;
{
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
DoSetWindowVariant( m_windowVariant ) ;
- /*
+ /*
if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
{
// no font
ControlFontStyleRec controlstyle ;
controlstyle.flags = kControlUseFontMask ;
controlstyle.font = kControlFontSmallBoldSystemFont ;
-
+
::SetControlFontStyle( (ControlHandle) m_macControl , &controlstyle ) ;
}
else
{
ControlFontStyleRec controlstyle ;
controlstyle.flags = kControlUseFontMask ;
-
+
if (IsKindOf( CLASSINFO( wxButton ) ) )
controlstyle.font = kControlFontBigSystemFont ; // eventually kControlFontBigSystemFont ;
else
controlstyle.font = kControlFontSmallSystemFont ;
-
+
::SetControlFontStyle( (ControlHandle) m_macControl , &controlstyle ) ;
}
*/
#endif
#endif
SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
-
+
// Adjust the controls size and position
wxPoint pos(m_x, m_y);
wxSize best_size( DoGetBestSize() );
wxSize new_size( m_width, m_height );
-
+
m_x = m_y = m_width = m_height = -1; // Forces SetSize to move/size the control
-
+
if (new_size.x == -1) {
new_size.x = best_size.x;
}
if (new_size.y == -1) {
new_size.y = best_size.y;
}
-
+
SetSize(pos.x, pos.y, new_size.x, new_size.y);
-
+
#if wxUSE_UNICODE
UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ;
#endif
if ( m_macControlIsShown )
UMAShowControl( (ControlHandle) m_macControl ) ;
-
+
SetCursor( *wxSTANDARD_CURSOR ) ;
-
+
Refresh() ;
}
-void wxControl::MacAdjustControlRect()
+void wxControl::MacAdjustControlRect()
{
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
if ( m_width == -1 || m_height == -1 )
{
Rect bestsize = { 0 , 0 , 0 , 0 } ;
short baselineoffset ;
-
+
::GetBestControlRect( (ControlHandle) m_macControl , &bestsize , &baselineoffset ) ;
if ( EmptyRect( &bestsize ) )
}
else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) )
{
- bestsize.bottom = 24 ;
+ bestsize.bottom = 24 ;
}
}
}
else
m_width = bestsize.right - bestsize.left ;
-
+
m_width += 2 * m_macHorizontalBorder + MacGetLeftBorderSize() + MacGetRightBorderSize() ;
}
if ( m_height == -1 )
m_height += 2 * m_macVerticalBorder + MacGetTopBorderSize() + MacGetBottomBorderSize() ;
}
- MacUpdateDimensions() ;
+ MacUpdateDimensions() ;
}
}
-WXWidget wxControl::MacGetContainerForEmbedding()
+WXWidget wxControl::MacGetContainerForEmbedding()
{
if ( m_macControl )
return m_macControl ;
return wxWindow::MacGetContainerForEmbedding() ;
}
-void wxControl::MacUpdateDimensions()
+void wxControl::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 ;
-
- 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 ;
int new_height = m_height - MacGetTopBorderSize() - MacGetBottomBorderSize() - 2 * m_macVerticalBorder ;
-
+
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 ;
}
}
-void wxControl::MacSuperChangedPosition()
+void wxControl::MacSuperChangedPosition()
{
MacUpdateDimensions() ;
wxWindow::MacSuperChangedPosition() ;
}
-void wxControl::MacSuperEnabled( bool enabled )
+void wxControl::MacSuperEnabled( bool enabled )
{
- Refresh(FALSE) ;
+ Refresh(false) ;
wxWindow::MacSuperEnabled( enabled ) ;
}
-void wxControl::MacSuperShown( bool show )
+void wxControl::MacSuperShown( bool show )
{
if ( (ControlHandle) m_macControl )
{
}
}
}
-
+
wxWindow::MacSuperShown( show ) ;
}
return ;
}
-bool wxControl::Show(bool show)
+bool wxControl::Show(bool show)
{
if ( !wxWindow::Show( show ) )
- return FALSE ;
-
+ return false ;
+
if ( (ControlHandle) m_macControl )
{
if ( !show )
}
}
}
- return TRUE ;
+ return true ;
}
-bool wxControl::Enable(bool enable)
+bool wxControl::Enable(bool enable)
{
if ( !wxWindow::Enable(enable) )
- return FALSE;
+ return false;
if ( (ControlHandle) m_macControl )
{
else
UMADeactivateControl( (ControlHandle) m_macControl ) ;
}
- return TRUE ;
+ return true ;
}
void wxControl::Refresh(bool eraseBack, const wxRect *rect)
}
void wxControl::OnEraseBackground(wxEraseEvent& event)
{
- wxWindow::OnEraseBackground( event ) ;
+ wxWindow::OnEraseBackground( event ) ;
}
-void wxControl::OnKeyDown( wxKeyEvent &event )
+void wxControl::OnKeyDown( wxKeyEvent &event )
{
if ( (ControlHandle) m_macControl == NULL )
return ;
-
+
#if TARGET_CARBON
char charCode ;
- UInt32 keyCode ;
+ UInt32 keyCode ;
UInt32 modifiers ;
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
::HandleControlKey( (ControlHandle) m_macControl , keyCode , charCode , modifiers ) ;
-
+
#else
EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
short keycode ;
#endif
}
-void wxControl::OnMouseEvent( wxMouseEvent &event )
+void wxControl::OnMouseEvent( wxMouseEvent &event )
{
if ( (ControlHandle) m_macControl == NULL )
{
event.Skip() ;
return ;
}
-
+
if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
{
-
+
int x = event.m_x ;
int y = event.m_y ;
-
+
MacClientToRootWindow( &x , &y ) ;
-
+
ControlHandle 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 ;
{
{
controlpart = ::HandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
wxTheApp->s_lastMouseDown = 0 ;
- if ( control && controlpart != kControlNoPart )
+ if ( control && controlpart != kControlNoPart )
{
MacHandleControlClick( (WXWidget) control , controlpart , false /* mouse not down anymore */ ) ;
}
}
else
{
- event.Skip() ;
+ event.Skip() ;
}
}
bool wxControl::MacCanFocus() const
{
- if ( (ControlHandle) m_macControl == NULL )
- return true ;
+ if ( (ControlHandle) m_macControl == NULL )
+ return true ;
else
- return false ;
+ return false ;
}
-void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
+void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
{
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
}
{
wxWindow::SetWindowVariant( variant ) ;
return ;
-
+
}
- m_windowVariant = variant ;
+ m_windowVariant = variant ;
- ControlSize size ;
- ControlFontStyleRec fontStyle;
- fontStyle.flags = kControlUseFontMask ;
+ ControlSize size ;
+ ControlFontStyleRec fontStyle;
+ fontStyle.flags = kControlUseFontMask ;
// we will get that from the settings later
- // and make this NORMAL later, but first
+ // and make this NORMAL later, but first
// we have a few calculations that we must fix
if ( variant == wxWINDOW_VARIANT_NORMAL )
else
variant = wxWINDOW_VARIANT_SMALL ;
}
-
+
switch ( variant )
{
case wxWINDOW_VARIANT_NORMAL :
- size = kControlSizeNormal;
- fontStyle.font = kControlFontBigSystemFont;
+ size = kControlSizeNormal;
+ fontStyle.font = kControlFontBigSystemFont;
break ;
case wxWINDOW_VARIANT_SMALL :
- size = kControlSizeSmall;
- fontStyle.font = kControlFontSmallSystemFont;
+ size = kControlSizeSmall;
+ fontStyle.font = kControlFontSmallSystemFont;
break ;
case wxWINDOW_VARIANT_MINI :
if (UMAGetSystemVersion() >= 0x1030 )
{
- size = 3 ; // not always defined in the header
- fontStyle.font = -5 ; // not always defined in the header
+ size = 3 ; // not always defined in the header
+ fontStyle.font = -5 ; // not always defined in the header
}
else
{
- size = kControlSizeSmall;
- fontStyle.font = kControlFontSmallSystemFont;
+ size = kControlSizeSmall;
+ fontStyle.font = kControlFontSmallSystemFont;
}
break;
break ;
case wxWINDOW_VARIANT_LARGE :
- size = kControlSizeLarge;
- fontStyle.font = kControlFontBigSystemFont;
+ size = kControlSizeLarge;
+ fontStyle.font = kControlFontBigSystemFont;
break ;
default:
wxFAIL_MSG(_T("unexpected window variant"));
break ;
}
- ::SetControlData( (ControlHandle) m_macControl , kControlEntireControl, kControlSizeTag, sizeof( ControlSize ), &size );
- ::SetControlFontStyle( (ControlHandle) m_macControl , &fontStyle );
+ ::SetControlData( (ControlHandle) m_macControl , kControlEntireControl, kControlSizeTag, sizeof( ControlSize ), &size );
+ ::SetControlFontStyle( (ControlHandle) m_macControl , &fontStyle );
}
/////////////////////////////////////////////////////////////////////////////
-// Name: cursor.cpp
+// Name: src/mac/classic/cursor.cpp
// Purpose: wxCursor class
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#include "wx/app.h"
#include "wx/cursor.h"
wxCursorRefData::wxCursorRefData()
{
- m_width = 16;
+ m_width = 16;
m_height = 16;
m_hCursor = NULL ;
m_disposeHandle = false ;
else if ( m_disposeHandle )
{
::DisposeHandle( (Handle ) m_hCursor ) ;
- }
+ }
else if ( m_releaseHandle )
{
// we don't release the resource since it may already
CreateFromImage( image ) ;
}
-wxCursor::wxCursor(const char **bits)
+wxCursor::wxCursor(const char **bits)
{
(void) CreateFromXpm(bits);
}
-wxCursor::wxCursor(char **bits)
+wxCursor::wxCursor(char **bits)
{
(void) CreateFromXpm((const char **)bits);
}
bool wxCursor::CreateFromXpm(const char **bits)
{
- wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid cursor data") );
+ wxCHECK_MSG( bits != NULL, false, wxT("invalid cursor data") );
wxXPMDecoder decoder;
wxImage img = decoder.ReadData(bits);
- wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid cursor data") );
- CreateFromImage( img ) ;
- return TRUE;
+ wxCHECK_MSG( img.Ok(), false, wxT("invalid cursor data") );
+ CreateFromImage( img ) ;
+ return true;
}
short GetCTabIndex( CTabHandle colors , RGBColor *col )
return retval ;
}
-void wxCursor::CreateFromImage(const wxImage & image)
+void wxCursor::CreateFromImage(const wxImage & image)
{
m_refData = new wxCursorRefData;
int w = 16;
int h = 16;
-
+
int hotSpotX = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
int hotSpotY = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
int image_w = image.GetWidth();
int image_h = image.GetHeight();
-
+
wxASSERT_MSG( hotSpotX >= 0 && hotSpotX < image_w &&
hotSpotY >= 0 && hotSpotY < image_h,
_T("invalid cursor hot spot coordinates") );
}
else if ((w != image_w) || (h != image_h))
{
- hotSpotX = int(hotSpotX * double(w) / double(image_w));
- hotSpotY = int(hotSpotY * double(h) / double(image_h));
+ hotSpotX = int(hotSpotX * double(w) / double(image_w));
+ hotSpotY = int(hotSpotY * double(h) / double(image_h));
image16 = image.Scale(w, h);
}
unsigned char * rgbBits = image16.GetData();
bool bHasMask = image16.HasMask() ;
-
+
#if 0
// monochrome implementation
M_CURSORDATA->m_hCursor = NewHandle( sizeof( Cursor ) ) ;
CursPtr cp = *(CursHandle)M_CURSORDATA->m_hCursor ;
memset( cp->data , 0 , sizeof( Bits16 ) ) ;
memset( cp->mask , 0 , sizeof( Bits16 ) ) ;
-
+
unsigned char mr = image16.GetMaskRed() ;
unsigned char mg = image16.GetMaskGreen() ;
unsigned char mb = image16.GetMaskBlue() ;
{
short rowbits = 0 ;
short maskbits = 0 ;
-
+
for ( int x = 0 ; x < w ; ++x )
{
long pos = (y * w + x) * 3;
}
HLock( (Handle) ch) ;
(**ch).crsrType = 0x8001 ; // color cursors
- (**ch).crsrMap = pm ;
+ (**ch).crsrMap = pm ;
short bytesPerRow = bytesPerPixel * extent ;
- (**pm).baseAddr = 0;
+ (**pm).baseAddr = 0;
(**pm).rowBytes = bytesPerRow | 0x8000;
- (**pm).bounds = bounds;
- (**pm).pmVersion = 0;
- (**pm).packType = 0;
- (**pm).packSize = 0;
+ (**pm).bounds = bounds;
+ (**pm).pmVersion = 0;
+ (**pm).packType = 0;
+ (**pm).packSize = 0;
(**pm).hRes = 0x00480000; /* 72 DPI default res */
(**pm).vRes = 0x00480000; /* 72 DPI default res */
(**pm).pixelSize = depth;
(**pm).pixelType = 0;
- (**pm).cmpCount = 1;
+ (**pm).cmpCount = 1;
(**pm).cmpSize = depth;
(**pm).pmTable = newColors;
- (**ch).crsrData = NewHandleClear( extent * bytesPerRow ) ;
+ (**ch).crsrData = NewHandleClear( extent * bytesPerRow ) ;
(**ch).crsrXData = NULL ;
(**ch).crsrXValid = 0;
(**ch).crsrXHandle = NULL;
(**ch).crsrHotSpot.h = hotSpotX ;
(**ch).crsrHotSpot.v = hotSpotY ;
- (**ch).crsrXTable = NULL ;
+ (**ch).crsrXTable = NULL ;
(**ch).crsrID = GetCTSeed() ;
-
+
memset( (**ch).crsr1Data , 0 , sizeof( Bits16 ) ) ;
memset( (**ch).crsrMask , 0 , sizeof( Bits16 ) ) ;
-
+
unsigned char mr = image16.GetMaskRed() ;
unsigned char mg = image16.GetMaskGreen() ;
unsigned char mb = image16.GetMaskBlue() ;
{
short rowbits = 0 ;
short maskbits = 0 ;
-
+
for ( int x = 0 ; x < w ; ++x )
{
long pos = (y * w + x) * 3;
unsigned char g = rgbBits[pos+1] ;
unsigned char b = rgbBits[pos+2] ;
RGBColor col = { 0xFFFF ,0xFFFF, 0xFFFF } ;
-
+
if ( bHasMask && r==mr && g==mg && b==mb )
{
// masked area, does not appear anywhere
rowbits |= ( 1 << (15-x) ) ;
}
maskbits |= ( 1 << (15-x) ) ;
-
+
col = *((RGBColor*) wxColor( r , g , b ).GetPixel()) ;
}
- *((*(**ch).crsrData) + y * bytesPerRow + x) =
+ *((*(**ch).crsrData) + y * bytesPerRow + x) =
GetCTabIndex( newColors , &col) ;
}
(**ch).crsr1Data[y] = rowbits ;
{
memcpy( (**ch).crsrMask , (**ch).crsr1Data , sizeof( Bits16) ) ;
}
-
+
HUnlock((Handle) ch) ;
M_CURSORDATA->m_hCursor = ch ;
M_CURSORDATA->m_isColorCursor = true ;
if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
{
Str255 theName ;
- wxMacStringToPascal( cursor_file , theName ) ;
-
+ wxMacStringToPascal( cursor_file , theName ) ;
+
wxStAppResource resload ;
Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
if ( resHandle )
M_CURSORDATA->m_isColorCursor = true ;
}
else
- {
+ {
Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
if ( resHandle )
{
wxCursor::wxCursor(int cursor_type)
{
m_refData = new wxCursorRefData;
-
+
switch (cursor_type)
{
case wxCURSOR_COPY_ARROW:
M_CURSORDATA->m_releaseHandle = true ;
}
-void wxCursor::MacInstall() const
+void wxCursor::MacInstall() const
{
gMacCurrentCursor = *this ;
if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
{
cursor.MacInstall() ;
}
-
-
///////////////////////////////////////////////////////////////////////////////
-// Name: mac/dataobj.cpp
+// Name: src/mac/classic/dataobj.cpp
// Purpose: implementation of wxDataObject class
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
// ============================================================================
// declarations
// ============================================================================
// headers
// ----------------------------------------------------------------------------
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
-
#ifndef WX_PRECOMP
-#include "wx/intl.h"
+ #include "wx/intl.h"
#endif
-#include "wx/defs.h"
#include "wx/log.h"
#include "wx/dataobj.h"
// wxFileDataObject
// ----------------------------------------------------------------------------
-bool wxFileDataObject::GetDataHere(
- void* pBuf
-) const
+bool wxFileDataObject::GetDataHere( void* pBuf ) const
{
wxString sFilenames;
}
memcpy(pBuf, sFilenames.mbc_str(), sFilenames.Len() + 1);
- return TRUE;
+ return true;
}
size_t wxFileDataObject::GetDataSize() const
AddFile(wxString::FromAscii((char*)pBuf));
- return TRUE;
+ return true;
}
void wxFileDataObject::AddFile(
}
}
-void wxBitmapDataObject::Init()
-{
+void wxBitmapDataObject::Init()
+{
m_pictHandle = NULL ;
m_pictCreated = false ;
-}
+}
-void wxBitmapDataObject::Clear()
+void wxBitmapDataObject::Clear()
{
if ( m_pictCreated && m_pictHandle )
{
m_pictHandle = NULL ;
}
-bool wxBitmapDataObject::GetDataHere(
- void* pBuf
-) const
+bool wxBitmapDataObject::GetDataHere( void* pBuf ) const
{
if (!m_pictHandle)
{
wxFAIL_MSG(wxT("attempt to copy empty bitmap failed"));
- return FALSE;
+ return false;
}
memcpy(pBuf, *(Handle)m_pictHandle, GetHandleSize((Handle)m_pictHandle));
- return TRUE;
+ return true;
}
size_t wxBitmapDataObject::GetDataSize() const
m_pictHandle = picHandle ;
m_pictCreated = false ;
Rect frame = (**picHandle).picFrame ;
-
+
m_bitmap.SetPict( picHandle ) ;
m_bitmap.SetWidth( frame.right - frame.left ) ;
m_bitmap.SetHeight( frame.bottom - frame.top ) ;
/////////////////////////////////////////////////////////////////////////////
-// Name: dirdlg.cpp
+// Name: src/mac/classic/dirdlg.cpp
// Purpose: wxDirDialog
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/dirdlg.h"
NavReplyRecord mNavReply;
AEDesc* mDefaultLocation = NULL ;
bool mSelectDefault = false ;
-
+
::NavGetDefaultDialogOptions(&mNavOptions);
mNavFilterUPP = nil;
mNavReply.selection.dataHandle = nil;
mNavReply.keyScript = smSystemScript;
mNavReply.fileTranslation = nil;
-
+
// Set default location, the location
// that's displayed when the dialog
// first appears
-
+
if ( mDefaultLocation ) {
-
+
if (mSelectDefault) {
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
} else {
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
}
}
-
+
OSErr err = ::NavChooseFolder(
mDefaultLocation,
&mNavReply,
NULL,
mNavFilterUPP,
0L); // User Data
-
+
if ( (err != noErr) && (err != userCanceledErr) ) {
- m_path = wxT("") ;
+ m_path = wxEmptyString ;
return wxID_CANCEL ;
}
if (mNavReply.validRecord) { // User chose a folder
-
+
FSSpec folderInfo;
FSSpec outFileSpec ;
AEDesc specDesc ;
-
+
OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
if ( err != noErr ) {
- m_path = wxT("") ;
+ m_path = wxEmptyString ;
return wxID_CANCEL ;
- }
+ }
folderInfo = **(FSSpec**) specDesc.dataHandle;
if (specDesc.dataHandle != nil) {
::AEDisposeDesc(&specDesc);
}
// mNavReply.GetFileSpec(folderInfo);
-
+
// The FSSpec from NavChooseFolder is NOT the file spec
// for the folder. The parID field is actually the DirID
// of the folder itself, not the folder's parent, and
// the name field is empty. We must call PBGetCatInfo
// to get the parent DirID and folder name
-
+
Str255 name;
CInfoPBRec thePB; // Directory Info Parameter Block
thePB.dirInfo.ioCompletion = nil;
thePB.dirInfo.ioDrDirID = folderInfo.parID; // Folder's DirID
thePB.dirInfo.ioNamePtr = name;
thePB.dirInfo.ioFDirIndex = -1; // Lookup using Volume and DirID
-
+
err = ::PBGetCatInfoSync(&thePB);
if ( err != noErr ) {
- m_path = wxT("") ;
+ m_path = wxEmptyString;
return wxID_CANCEL ;
- }
+ }
// Create cannonical FSSpec
::FSMakeFSSpec(thePB.dirInfo.ioVRefNum, thePB.dirInfo.ioDrParID,
name, &outFileSpec);
-
+
// outFolderDirID = thePB.dirInfo.ioDrDirID;
m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
return wxID_OK ;
}
return wxID_CANCEL;
}
-
///////////////////////////////////////////////////////////////////////////////
-// Name: dnd.cpp
+// Name: src/mac/classic/dnd.cpp
// Purpose: wxDropTarget, wxDropSource, wxDataObject implementation
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#if wxUSE_DRAG_AND_DROP
void wxMacEnsureTrackingHandlersInstalled() ;
-typedef struct
+typedef struct
{
wxWindow* m_currentTargetWindow ;
wxDropTarget* m_currentTarget ;
wxDropSource* m_currentSource ;
} MacTrackingGlobals ;
-MacTrackingGlobals gTrackingGlobals ;
+MacTrackingGlobals gTrackingGlobals ;
//----------------------------------------------------------------------------
// wxDropTarget
bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
{
if (!m_dataObject)
- return FALSE;
+ return false;
return CurrentDragHasSupportedFormat() ;
}
return GetData() ? def : wxDragNone;
}
-bool wxDropTarget::CurrentDragHasSupportedFormat()
+bool wxDropTarget::CurrentDragHasSupportedFormat()
{
bool supported = false ;
if ( gTrackingGlobals.m_currentSource != NULL )
{
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
-
+
if ( data )
{
size_t formatcount = data->GetFormatCount() ;
for (size_t i = 0; !supported && i < formatcount ; i++)
{
wxDataFormat format = array[i] ;
- if ( m_dataObject->IsSupported( format ) )
+ if ( m_dataObject->IsSupported( format ) )
{
supported = true ;
break ;
UInt16 items ;
OSErr result;
CountDragItems((DragReference)m_currentDrag, &items);
- for (UInt16 index = 1; index <= items && supported == false ; ++index)
+ for (UInt16 index = 1; index <= items && supported == false ; ++index)
{
ItemReference theItem;
FlavorType theType ;
}
}
}
- return supported ;
+ return supported ;
}
bool wxDropTarget::GetData()
{
if (!m_dataObject)
- return FALSE;
-
+ return false;
+
if ( !CurrentDragHasSupportedFormat() )
- return FALSE ;
-
- bool transferred = false ;
+ return false ;
+
+ bool transferred = false ;
if ( gTrackingGlobals.m_currentSource != NULL )
{
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
-
+
if ( data )
{
size_t formatcount = data->GetFormatCount() ;
for (size_t i = 0; !transferred && i < formatcount ; i++)
{
wxDataFormat format = array[i] ;
- if ( m_dataObject->IsSupported( format ) )
+ if ( m_dataObject->IsSupported( format ) )
{
int size = data->GetDataSize( format );
transferred = true ;
-
- if (size == 0)
+
+ if (size == 0)
{
m_dataObject->SetData(format , 0 , 0 ) ;
}
OSErr result;
bool firstFileAdded = false ;
CountDragItems((DragReference)m_currentDrag, &items);
- for (UInt16 index = 1; index <= items; ++index)
+ for (UInt16 index = 1; index <= items; ++index)
{
ItemReference theItem;
FlavorType theType ;
{
FlavorFlags theFlags;
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
- if (result == noErr)
+ if (result == noErr)
{
Size dataSize ;
Ptr theData ;
dataSize++ ;
}
theData = new char[dataSize];
- GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L);
+ GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L);
if( theType == 'TEXT' )
{
- theData[dataSize]=0 ;
- wxString convert( theData , wxConvLocal ) ;
+ theData[dataSize]=0 ;
+ wxString convert( theData , wxConvLocal ) ;
m_dataObject->SetData( format, convert.Length() * sizeof(wxChar), (const wxChar*) convert );
}
else if ( theType == kDragFlavorTypeHFS )
else
{
((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
- firstFileAdded = true ;
+ firstFileAdded = true ;
}
}
else
}
}
}
- return TRUE ;
+ return true ;
}
//-------------------------------------------------------------------------
wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
{
wxASSERT_MSG( m_data, wxT("Drop source: no data") );
-
+
if (!m_data)
return (wxDragResult) wxDragNone;
-
+
if (m_data->GetFormatCount() == 0)
return (wxDragResult) wxDragNone;
-
+
OSErr result;
DragReference theDrag;
RgnHandle dragRegion;
HFSFlavor theFlavor ;
OSErr err = noErr;
CInfoPBRec cat;
-
+
wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
-
+
cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
}
- AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);
- }
+ AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);
+ }
}
else
{
- AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
+ AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
}
delete[] dataPtr ;
}
delete[] formats ;
-
+
dragRegion = NewRgn();
RgnHandle tempRgn = NewRgn() ;
-
+
EventRecord* ev = NULL ;
#if !TARGET_CARBON // TODO
ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
#endif
const short dragRegionOuterBoundary = 10 ;
const short dragRegionInnerBoundary = 9 ;
-
- SetRectRgn( dragRegion , ev->where.h - dragRegionOuterBoundary ,
+
+ SetRectRgn( dragRegion , ev->where.h - dragRegionOuterBoundary ,
ev->where.v - dragRegionOuterBoundary ,
- ev->where.h + dragRegionOuterBoundary ,
+ ev->where.h + dragRegionOuterBoundary ,
ev->where.v + dragRegionOuterBoundary ) ;
-
- SetRectRgn( tempRgn , ev->where.h - dragRegionInnerBoundary ,
+
+ SetRectRgn( tempRgn , ev->where.h - dragRegionInnerBoundary ,
ev->where.v - dragRegionInnerBoundary ,
- ev->where.h + dragRegionInnerBoundary ,
+ ev->where.h + dragRegionInnerBoundary ,
ev->where.v + dragRegionInnerBoundary ) ;
-
+
DiffRgn( dragRegion , tempRgn , dragRegion ) ;
- DisposeRgn( tempRgn ) ;
-
+ DisposeRgn( tempRgn ) ;
+
// TODO:work with promises in order to return data only when drag
// was successfully completed
-
+
gTrackingGlobals.m_currentSource = this ;
result = TrackDrag(theDrag, ev , dragRegion);
DisposeRgn(dragRegion);
DisposeDrag(theDrag);
gTrackingGlobals.m_currentSource = NULL ;
-
+
KeyMap keymap;
GetKeys(keymap);
bool optionDown = keymap[1] & 4;
{
cursor.MacInstall() ;
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, WindowPtr theWindow,
void *handlerRefCon, DragReference theDrag)
-{
+{
MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*) handlerRefCon;
Point mouse, localMouse;
DragAttributes attributes;
GetDragAttributes(theDrag, &attributes);
- wxTopLevelWindowMac* toplevel = wxFindWinFromMacWindow( (WXWindow) theWindow ) ;
+ wxTopLevelWindowMac* toplevel = wxFindWinFromMacWindow( (WXWindow) theWindow ) ;
KeyMap keymap;
GetKeys(keymap);
bool optionDown = keymap[1] & 4;
wxDragResult result = optionDown ? wxDragCopy : wxDragMove;
- switch(theMessage)
+ switch(theMessage)
{
case kDragTrackingEnterHandler:
break;
GlobalToLocal(&localMouse);
-
-// if (attributes & kDragHasLeftSenderWindow)
+
+// if (attributes & kDragHasLeftSenderWindow)
{
wxPoint point(localMouse.h , localMouse.v) ;
wxWindow *win = NULL ;
trackingGlobals->m_currentTarget = win->GetDropTarget() ;
{
- if ( trackingGlobals->m_currentTarget )
- {
- trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
- result = trackingGlobals->m_currentTarget->OnEnter(
- localx , localy , result ) ;
+ if ( trackingGlobals->m_currentTarget )
+ {
+ trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
+ result = trackingGlobals->m_currentTarget->OnEnter(
+ localx , localy , result ) ;
}
-
-
+
+
if ( result != wxDragNone )
{
int x , y ;
}
}
}
-
+
}
// MyTrackItemUnderMouse(localMouse, theWindow);
break;
case kDragTrackingLeaveWindow:
- if (trackingGlobals->m_currentTarget)
+ if (trackingGlobals->m_currentTarget)
{
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
trackingGlobals->m_currentTarget->OnLeave() ;
pascal OSErr wxMacWindowDragReceiveHandler(WindowPtr theWindow,
void *handlerRefCon,
DragReference theDrag)
-{
+{
MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*) handlerRefCon;
if ( trackingGlobals->m_currentTarget )
{
Point mouse,localMouse ;
int localx,localy ;
-
+
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
GetDragMouse(theDrag, &mouse, 0L);
localMouse = mouse;
/////////////////////////////////////////////////////////////////////////////
-// Name: filedlg.cpp
+// Name: src/mac/classic/filedlg.cpp
// Purpose: wxFileDialog
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
#include "wx/app.h"
#include "wx/utils.h"
#include "wx/dialog.h"
// an explanatory text, in that case the first part is name and extension at the same time
wxASSERT_MSG( filterIndex == 0 || !isName , wxT("incorrect format of format string") ) ;
- if ( current.IsEmpty() )
+ if ( current.empty() )
myData->extensions.Add( myData->name[filterIndex] ) ;
else
myData->extensions.Add( current.MakeUpper() ) ;
wxString extension = myData->extensions[i];
if (extension.GetChar(0) == '*')
- extension = extension.Mid(1); // Remove leading *
+ extension = extension.Mid(1); // Remove leading *
if (extension.GetChar(0) == '.')
{
- extension = extension.Mid(1); // Remove leading .
+ extension = extension.Mid(1); // Remove leading .
}
-
+
if (wxFileName::MacFindDefaultTypeAndCreator( extension, &fileType, &creator ))
{
myData->filtermactypes.Add( (OSType)fileType );
}
else
{
- myData->filtermactypes.Add( '****' ) ; // We'll fail safe if it's not recognized
- }
+ myData->filtermactypes.Add( '****' ) ; // We'll fail safe if it's not recognized
+ }
}
}
}
- CFURLRef fullURLRef;
+ CFURLRef fullURLRef;
fullURLRef = ::CFURLCreateFromFSRef(NULL, &fsref);
#ifdef __UNIX__
- CFURLPathStyle pathstyle = kCFURLPOSIXPathStyle;
+ CFURLPathStyle pathstyle = kCFURLPOSIXPathStyle;
#else
- CFURLPathStyle pathstyle = kCFURLHFSPathStyle;
+ CFURLPathStyle pathstyle = kCFURLHFSPathStyle;
#endif
- CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle);
- ::CFRelease( fullURLRef ) ;
- wxString file = wxMacCFStringHolder(cfString).AsString(wxFont::GetDefaultEncoding());
+ CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle);
+ ::CFRelease( fullURLRef ) ;
+ wxString file = wxMacCFStringHolder(cfString).AsString(wxFont::GetDefaultEncoding());
display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
}
OSErr err = ::AEGetNthDesc( &mNavReply.selection , i , typeFSS, &keyWord , &specDesc);
if ( err != noErr )
{
- m_path = wxT("") ;
+ m_path = wxEmptyString ;
return wxID_CANCEL ;
}
outFileSpec = **(FSSpec**) specDesc.dataHandle;
return wxID_CANCEL;
#endif // TARGET_CARBON
}
-
/////////////////////////////////////////////////////////////////////////////
-// Name: font.cpp
+// Name: src/mac/classic/font.cpp
// Purpose: wxFont class
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
#include "wx/string.h"
#include "wx/font.h"
#include "wx/fontutil.h"
, m_family(wxDEFAULT)
, m_style(wxNORMAL)
, m_weight(wxNORMAL)
- , m_underlined(FALSE)
+ , m_underlined(false)
, m_faceName(wxT("Geneva"))
, m_encoding(wxFONTENCODING_DEFAULT)
, m_macFontNum(0)
, m_macFontStyle(0)
, m_macATSUFontID()
{
- Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE,
+ Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, false,
wxT("Geneva"), wxFONTENCODING_DEFAULT);
}
}
virtual ~wxFontRefData();
- void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; }
+ void SetNoAntiAliasing( bool no = true ) { m_noAA = no; }
bool GetNoAntiAliasing() const { return m_noAA; }
-
+
protected:
// common part of all ctors
void Init(int size,
bool m_underlined;
wxString m_faceName;
wxFontEncoding m_encoding;
- bool m_noAA; // No anti-aliasing
-
+ bool m_noAA; // No anti-aliasing
+
public:
short m_macFontNum;
short m_macFontSize;
m_macFontSize = 0;
m_macFontStyle = 0;
m_fontId = 0;
- m_noAA = FALSE;
+ m_noAA = false;
}
wxFontRefData::~wxFontRefData()
m_macFontStyle = 0;
if (m_weight == wxBOLD)
m_macFontStyle |= bold;
- if (m_style == wxITALIC || m_style == wxSLANT)
+ if (m_style == wxITALIC || m_style == wxSLANT)
m_macFontStyle |= italic;
- if (m_underlined)
+ if (m_underlined)
m_macFontStyle |= underline;
m_macFontSize = m_pointSize ;
-
+
//TODO:if we supply the style as an additional parameter we must make a testing
//sequence in order to degrade gracefully while trying to maintain most of the style
//information, meanwhile we just take the normal font and apply the features after
#ifdef __WXDEBUG__
OSStatus status =
#endif // __WXDEBUG__
- ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID);
+ ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID);
/*
status = ATSUFindFontFromName ( (Ptr) m_faceName , strlen( m_faceName ) ,
kFontFullName, kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage , (UInt32*)&m_macATSUFontID ) ;
RealizeResource();
- return TRUE;
+ return true;
}
wxFont::~wxFont()
bool wxFont::RealizeResource()
{
M_FONTDATA->MacFindFont() ;
- return TRUE;
+ return true;
}
void wxFont::SetEncoding(wxFontEncoding encoding)
return &(M_FONTDATA->m_info);
}
-
/////////////////////////////////////////////////////////////////////////////
-// Name: mac/mimetype.cpp
+// Name: src/mac/classic/mimetype.cpp
// Purpose: classes and functions to manage MIME types
// Author: Vadim Zeitlin
// Modified by:
#pragma hdrstop
#endif
-#ifndef WX_PRECOMP
- #include "wx/defs.h"
-#endif
-
#ifndef WX_PRECOMP
#include "wx/string.h"
#if wxUSE_GUI
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#if wxUSE_PALETTE
/////////////////////////////////////////////////////////////////////////////
-// Name: printwin.cpp
+// Name: src/mac/classic/printwin.cpp
// Purpose: wxMacPrinter framework
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
-#include "wx/defs.h"
-
#ifndef WX_PRECOMP
-#include "wx/utils.h"
-#include "wx/dc.h"
-#include "wx/app.h"
-#include "wx/msgdlg.h"
+ #include "wx/utils.h"
+ #include "wx/dc.h"
+ #include "wx/app.h"
+ #include "wx/msgdlg.h"
#endif
#include "wx/mac/uma.h"
#if TARGET_CARBON
-wxNativePrintData* wxNativePrintData::Create()
+wxNativePrintData* wxNativePrintData::Create()
{
return new wxMacCarbonPrintData() ;
}
(void)PMRelease(m_macPrintSettings);
m_macPrintSettings = kPMNoPrintSettings;
}
-
+
if ( m_macPrintSession != kPMNoReference )
{
(void)PMRelease(m_macPrintSession);
}
}
-void wxMacCarbonPrintData::ValidateOrCreate()
+void wxMacCarbonPrintData::ValidateOrCreate()
{
OSStatus err = noErr ;
if ( m_macPrintSession == kPMNoReference )
if ( m_macPageFormat == kPMNoPageFormat)
{
err = PMCreatePageFormat((PMPageFormat *) &m_macPageFormat);
-
+
// Note that PMPageFormat is not session-specific, but calling
// PMSessionDefaultPageFormat assigns values specific to the printer
// associated with the current printing session.
(PMPageFormat) m_macPageFormat,
kPMDontWantBoolean);
}
-
+
// Set up a valid PrintSettings object.
if ( m_macPrintSettings == kPMNoPrintSettings)
{
err = PMCreatePrintSettings((PMPrintSettings *) &m_macPrintSettings);
-
+
// Note that PMPrintSettings is not session-specific, but calling
// PMSessionDefaultPrintSettings assigns values specific to the printer
// associated with the current printing session.
}
else
PMSetColorMode( (PMPrintSettings) m_macPrintSettings, kPMBlackAndWhite ) ;
-
+
// PMDuplexMode not yet accessible via API
// PMQualityMode not yet accessible via API
// todo paperSize
void wxMacCarbonPrintData::TransferTo( wxPrintData* data )
{
OSStatus err = noErr ;
-
+
UInt32 copies ;
err = PMGetCopies( m_macPrintSettings , &copies ) ;
if ( err == noErr )
- data->SetNoCopies( copies ) ;
-
+ data->SetNoCopies( copies ) ;
+
PMOrientation orientation ;
err = PMGetOrientation( m_macPageFormat , &orientation ) ;
if ( err == noErr )
m_printerName = name.AsString() ;
}
#endif
-
+
PMColorMode color ;
err = PMGetColorMode( m_macPrintSettings, &color ) ;
if ( err == noErr )
data->SetColour( !(color == kPMBlackAndWhite) ) ;
-
+
// PMDuplexMode not yet accessible via API
// PMQualityMode not yet accessible via API
// todo paperSize
- PMRect rPaper;
+ PMRect rPaper;
err = PMGetUnadjustedPaperRect( m_macPageFormat, &rPaper);
if ( err == noErr )
{
void wxMacCarbonPrintData::TransferTo( wxPageSetupData* data )
{
- PMRect rPaper;
+ PMRect rPaper;
OSStatus err = PMGetUnadjustedPaperRect(m_macPageFormat, &rPaper);
if ( err == noErr )
{
if ( err == noErr )
{
data->SetMinMarginTopLeft( wxPoint (
- (int)(((double) rPage.left - rPaper.left ) * pt2mm) ,
- (int)(((double) rPage.top - rPaper.top ) * pt2mm) ) ) ;
-
- data->SetMinMarginBottomRight( wxPoint (
+ (int)(((double) rPage.left - rPaper.left ) * pt2mm) ,
+ (int)(((double) rPage.top - rPaper.top ) * pt2mm) ) ) ;
+
+ data->SetMinMarginBottomRight( wxPoint (
(wxCoord)(((double) rPaper.right - rPage.right ) * pt2mm),
(wxCoord)(((double) rPaper.bottom - rPage.bottom ) * pt2mm)) ) ;
- }
- }
+ }
+ }
}
void wxMacCarbonPrintData::TransferTo( wxPrintDialogData* data )
{
wxMacCarbonPrintData *data = (wxMacCarbonPrintData*) d ;
if ( data->m_macPrintSession != kPMNoReference )
- PMRetain( data->m_macPrintSession ) ;
- if ( m_macPrintSession != kPMNoReference )
- {
- PMRelease( m_macPrintSession ) ;
- m_macPrintSession = kPMNoReference ;
- }
- if ( data->m_macPrintSession != kPMNoReference )
- m_macPrintSession = data->m_macPrintSession ;
+ PMRetain( data->m_macPrintSession ) ;
+ if ( m_macPrintSession != kPMNoReference )
+ {
+ PMRelease( m_macPrintSession ) ;
+ m_macPrintSession = kPMNoReference ;
+ }
+ if ( data->m_macPrintSession != kPMNoReference )
+ m_macPrintSession = data->m_macPrintSession ;
if ( data->m_macPrintSettings != kPMNoPrintSettings )
- PMRetain( data->m_macPrintSettings ) ;
- if ( m_macPrintSettings != kPMNoPrintSettings )
- {
- PMRelease( m_macPrintSettings ) ;
- m_macPrintSettings = kPMNoPrintSettings ;
- }
- if ( data->m_macPrintSettings != kPMNoPrintSettings )
- m_macPrintSettings = data->m_macPrintSettings ;
-
- if ( data->m_macPageFormat != kPMNoPageFormat )
- PMRetain( data->m_macPageFormat ) ;
- if ( m_macPageFormat != kPMNoPageFormat )
- {
- PMRelease( m_macPageFormat ) ;
- m_macPageFormat = kPMNoPageFormat ;
- }
- if ( data->m_macPageFormat != kPMNoPageFormat )
- m_macPageFormat = data->m_macPageFormat ;
+ PMRetain( data->m_macPrintSettings ) ;
+ if ( m_macPrintSettings != kPMNoPrintSettings )
+ {
+ PMRelease( m_macPrintSettings ) ;
+ m_macPrintSettings = kPMNoPrintSettings ;
+ }
+ if ( data->m_macPrintSettings != kPMNoPrintSettings )
+ m_macPrintSettings = data->m_macPrintSettings ;
+
+ if ( data->m_macPageFormat != kPMNoPageFormat )
+ PMRetain( data->m_macPageFormat ) ;
+ if ( m_macPageFormat != kPMNoPageFormat )
+ {
+ PMRelease( m_macPageFormat ) ;
+ m_macPageFormat = kPMNoPageFormat ;
+ }
+ if ( data->m_macPageFormat != kPMNoPageFormat )
+ m_macPageFormat = data->m_macPageFormat ;
}
int wxMacCarbonPrintData::ShowPrintDialog()
int result = wxID_CANCEL ;
OSErr err = noErr ;
wxString message ;
-
+
Boolean accepted;
-
+
{
// Display the Print dialog.
if (err == noErr)
int result = wxID_CANCEL ;
OSErr err = noErr ;
wxString message ;
-
+
Boolean accepted;
{
// Display the Page Setup dialog.
{
err = kPMCancel; // user clicked Cancel button
}
- }
-
+ }
+
// If the user did not cancel, flatten and save the PageFormat object
// with our document.
if (err == noErr) {
#else
-wxNativePrintData* wxNativePrintData::Create()
+wxNativePrintData* wxNativePrintData::Create()
{
return new wxMacClassicPrintData() ;
}
DisposeHandle( (Handle) m_macPrintSettings ) ;
}
-void wxMacClassicPrintData::ValidateOrCreate()
+void wxMacClassicPrintData::ValidateOrCreate()
{
if ( m_macPrintSettings == NULL )
{
void wxMacClassicPrintData::TransferTo( wxPrintData* data )
{
data->SetNoCopies( (**m_macPrintSettings).prJob.iCopies );
- data->SetPaperSize( wxSize(
+ data->SetPaperSize( wxSize(
((double) (**m_macPrintSettings).rPaper.right - (**m_macPrintSettings).rPaper.left ) * pt2mm ,
((double) (**m_macPrintSettings).rPaper.bottom - (**m_macPrintSettings).rPaper.top ) * pt2mm ) ) ;
}
int result = wxID_CANCEL ;
OSErr err = noErr ;
wxString message ;
-
+
err = ::UMAPrOpen() ;
if ( err == noErr )
{
{
result = wxID_OK ;
}
-
+
}
else
{
message.Printf( wxT("Print Error %d"), err ) ;
- wxMessageDialog dialog( NULL , message , wxT(""), wxICON_HAND | wxOK) ;
+ wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
dialog.ShowModal();
}
::UMAPrClose() ;
int result = wxID_CANCEL ;
OSErr err = noErr ;
wxString message ;
-
+
err = ::UMAPrOpen() ;
if ( err == noErr )
{
{
result = wxID_OK ;
}
-
+
}
else
{
bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
{
- sm_abortIt = FALSE;
+ sm_abortIt = false;
sm_abortWindow = NULL;
-
+
if (!printout)
- return FALSE;
-
- printout->SetIsPreview(FALSE);
+ return false;
+
+ printout->SetIsPreview(false);
if (m_printDialogData.GetMinPage() < 1)
m_printDialogData.SetMinPage(1);
if (m_printDialogData.GetMaxPage() < 1)
m_printDialogData.SetMaxPage(9999);
- // Create a suitable device context
+ // Create a suitable device context
wxDC *dc = NULL;
if (prompt)
{
{
dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
}
-
-
+
+
// May have pressed cancel.
if (!dc || !dc->Ok())
{
if (dc) delete dc;
- return FALSE;
+ return false;
}
-
+
// on the mac we have always pixels as addressing mode with 72 dpi
-
+
printout->SetPPIScreen(72, 72);
printout->SetPPIPrinter(72, 72);
-
- // Set printout parameters
+
+ // Set printout parameters
printout->SetDC(dc);
-
+
int w, h;
wxCoord ww, hh;
dc->GetSize(&w, &h);
printout->SetPageSizePixels((int)w, (int)h);
dc->GetSizeMM(&ww, &hh);
printout->SetPageSizeMM((int)ww, (int)hh);
-
+
// Create an abort window
wxBeginBusyCursor();
-
+
printout->OnPreparePrinting();
-
+
// Get some parameters from the printout, if defined
int fromPage, toPage;
int minPage, maxPage;
printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
-
+
if (maxPage == 0)
{
wxEndBusyCursor();
- return FALSE;
+ return false;
}
-
+
// Only set min and max, because from and to have been
// set by the user
m_printDialogData.SetMinPage(minPage);
m_printDialogData.SetMaxPage(maxPage);
-
+
wxWindow *win = CreateAbortWindow(parent, printout);
wxSafeYield(win,true);
-
+
if (!win)
{
wxEndBusyCursor();
wxMessageBox(wxT("Sorry, could not create an abort dialog."), wxT("Print Error"), wxOK, parent);
delete dc;
- return FALSE;
+ return false;
}
sm_abortWindow = win;
- sm_abortWindow->Show(TRUE);
+ sm_abortWindow->Show(true);
wxSafeYield(win,true);
-
+
printout->OnBeginPrinting();
-
- bool keepGoing = TRUE;
-
+
+ bool keepGoing = true;
+
int copyCount;
for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
{
}
if (sm_abortIt)
break;
-
+
int pn;
for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
pn++)
{
if (sm_abortIt)
{
- keepGoing = FALSE;
+ keepGoing = false;
break;
}
else
}
printout->OnEndDocument();
}
-
+
printout->OnEndPrinting();
-
+
if (sm_abortWindow)
{
- sm_abortWindow->Show(FALSE);
+ sm_abortWindow->Show(false);
delete sm_abortWindow;
sm_abortWindow = NULL;
}
-
+
wxEndBusyCursor();
-
+
delete dc;
-
- return TRUE;
+
+ return true;
}
wxDC* wxMacPrinter::PrintDialog(wxWindow *parent)
{
wxDC* dc = (wxDC*) NULL;
-
+
wxPrintDialog dialog(parent, & m_printDialogData);
int ret = dialog.ShowModal();
-
+
if (ret == wxID_OK)
{
dc = dialog.GetPrintDC();
m_printDialogData = dialog.GetPrintDialogData();
}
-
+
return dc;
}
{
#if 0
wxPrintDialog dialog(parent, & m_printDialogData);
- dialog.GetPrintDialogData().SetSetupDialog(TRUE);
-
+ dialog.GetPrintDialogData().SetSetupDialog(true);
+
int ret = dialog.ShowModal();
-
+
if (ret == wxID_OK)
{
m_printDialogData = dialog.GetPrintDialogData();
}
-
+
return (ret == wxID_OK);
#endif
return wxID_CANCEL;
bool wxMacPrintPreview::Print(bool interactive)
{
if (!m_printPrintout)
- return FALSE;
+ return false;
wxMacPrinter printer(&m_printDialogData);
return printer.Print(m_previewFrame, m_printPrintout, interactive);
}
{
int screenWidth , screenHeight ;
wxDisplaySize( &screenWidth , &screenHeight ) ;
-
+
m_previewPrintout->SetPPIScreen( 72 , 72 ) ;
m_previewPrintout->SetPPIPrinter( 72 , 72 ) ;
m_previewPrintout->SetPageSizeMM( (int) (8.0 * 25.6), (int) (11.0 * 25.6) );
m_pageWidth = 8 * 72 ;
m_pageHeight = 11 * 72 ;
m_previewScale = 1 ;
-
+
// Get a device context for the currently selected printer
wxPrinterDC printerDC(m_printDialogData.GetPrintData());
if (printerDC.Ok())
// At 100%, the page should look about page-size on the screen.
// m_previewScale = (float)((float)screenWidth/(float)printerWidth);
// m_previewScale = m_previewScale * (float)((float)screenXRes/(float)printerXRes);
-
+
m_previewScale = 1 ;
}
/////////////////////////////////////////////////////////////////////////////
-// Name: radiobut.cpp
+// Name: src/mac/classic/radiobut.cpp
// Purpose: wxRadioButton
// Author: AUTHOR
// Modified by: JS Lair (99/11/15) adding the cyclic groupe notion for radiobox
// Created: ??/??/98
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#include "wx/radiobut.h"
Rect bounds ;
Str255 title ;
-
+
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
+ m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlRadioButtonProc , (long) this ) ;
-
+
MacPostControlCreate() ;
- m_cycle = this ;
-
- if (HasFlag(wxRB_GROUP))
- {
- AddInCycle( NULL ) ;
- }
- else
- {
- /* search backward for last group start */
- wxRadioButton *chief = (wxRadioButton*) NULL;
- wxWindowList::Node *node = parent->GetChildren().GetLast();
- while (node)
+ m_cycle = this ;
+
+ if (HasFlag(wxRB_GROUP))
{
- wxWindow *child = node->GetData();
- if (child->IsKindOf( CLASSINFO( wxRadioButton ) ) )
- {
- chief = (wxRadioButton*) child;
- if (child->HasFlag(wxRB_GROUP)) break;
- }
- node = node->GetPrevious();
+ AddInCycle( NULL ) ;
+ }
+ else
+ {
+ /* search backward for last group start */
+ wxRadioButton *chief = (wxRadioButton*) NULL;
+ wxWindowList::Node *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 ) ;
}
- AddInCycle( chief ) ;
- }
- return TRUE;
+ return true;
}
void wxRadioButton::SetValue(bool val)
wxRadioButton *cycle;
if ( GetControl32BitValue( (ControlHandle) m_macControl ) == val )
return ;
-
+
::SetControl32BitValue( (ControlHandle) m_macControl , val ) ;
- if (val)
+ if (val)
{
cycle=this->NextInCycle();
if (cycle!=NULL) {
ProcessCommand (event);
}
-void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
+void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED(mouseStillDown))
{
if ( GetValue() )
- return ;
-
- wxRadioButton *cycle, *old = NULL ;
+ return ;
+
+ wxRadioButton *cycle, *old = NULL ;
cycle=this->NextInCycle();
if (cycle!=NULL) {
while (cycle!=this) {
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
{
wxRadioButton *next,*current;
-
+
if (cycle==NULL) {
m_cycle=this;
return(this);
}
else {
current=cycle;
- while ((next=current->m_cycle)!=cycle)
+ while ((next=current->m_cycle)!=cycle)
current=current->m_cycle;
m_cycle=cycle;
current->m_cycle=this;
return(cycle);
}
-}
+}
/////////////////////////////////////////////////////////////////////////////
-// Name: scrolbar.cpp
+// Name: src/mac/classic/scrolbar.cpp
// Purpose: wxScrollBar
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#ifndef WX_PRECOMP
#include "wx/intl.h"
const wxString& name)
{
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
- return FALSE;
+ return false;
Rect bounds ;
Str255 title ;
MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
m_macControl = (WXWidget) ::NewControl(MAC_WXHWND(parent->MacGetRootWindow()) ,
- &bounds , title , false , 0 , 0 , 100,
+ &bounds , title , false , 0 , 0 , 100,
kControlScrollBarLiveProc , (long) this) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
MacPostControlCreate() ;
- return TRUE;
+ return true;
}
wxScrollBar::~wxScrollBar()
ProcessCommand(event);
}
-void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown )
+void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown )
{
if ( (ControlHandle) m_macControl == NULL )
return ;
-
+
int position = GetControl32BitValue( (ControlHandle) m_macControl) ;
int minPos = GetControl32BitMinimum( (ControlHandle) m_macControl) ;
int maxPos = GetControl32BitMaximum( (ControlHandle) m_macControl) ;
-
+
wxEventType scrollEvent = wxEVT_NULL;
int nScrollInc = 0;
-
+
// all events have already been reported during mouse down, except for THUMBRELEASE
if ( !mouseStillDown && controlpart !=kControlIndicatorPart )
return ;
-
+
switch( controlpart )
{
case kControlUpButtonPart :
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 )
{
else
GetEventHandler()->ProcessEvent(event);
}
-
/////////////////////////////////////////////////////////////////////////////
-// Name: slider.cpp
+// Name: src/mac/classic/slider.cpp
// Purpose: wxSlider
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#if wxUSE_SLIDER
/////////////////////////////////////////////////////////////////////////////
-// Name: spinbutt.cpp
+// Name: src/mac/classic/spinbutt.cpp
// Purpose: wxSpinButton
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#if wxUSE_SPINBTN
/////////////////////////////////////////////////////////////////////////////
-// Name: spinbutt.cpp
+// Name: src/mac/classic/spinbutt.cpp
// Purpose: wxSpinCtrl
// Author: Robert
// Modified by: Mark Newsam (Based on GTK file)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_SPINCTRL
#ifndef WX_PRECOMP
#include "wx/textctrl.h"
#endif //WX_PRECOMP
-#if wxUSE_SPINCTRL
-
#include "wx/spinbutt.h"
#include "wx/spinctrl.h"
{
// Hand button down events to wxSpinCtrl. Doesn't work.
if (event.GetEventType() == wxEVT_LEFT_DOWN && m_spin->ProcessEvent( event ))
- return TRUE;
+ return true;
return wxTextCtrl::ProcessEvent( event );
}
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl)
-
+
// ============================================================================
// implementation
// ============================================================================
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style,
wxDefaultValidator, name) )
{
- return FALSE;
+ return false;
}
// the string value overrides the numeric one (for backwards compatibility
}
DoSetSize(pos.x , pos.y , csize.x, csize.y);
- return TRUE;
+ return true;
}
wxSpinCtrl::~wxSpinCtrl()
bool wxSpinCtrl::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
bool wxSpinCtrl::Show(bool show)
{
if ( !wxControl::Show(show) )
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
// ----------------------------------------------------------------------------
if ( !m_text->GetValue().ToLong(&l) )
{
// not a number at all
- return FALSE;
+ return false;
}
if ( l < GetMin() || l > GetMax() )
{
// out of range
- return FALSE;
+ return false;
}
*val = l;
- return TRUE;
+ return true;
}
int wxSpinCtrl::GetValue() const
// be selected
if ( (from == -1) && (to == -1) )
{
- from = 0;
+ from = 0;
}
m_text->SetSelection(from, to);
-}
+}
#endif // wxUSE_SPINCTRL
/////////////////////////////////////////////////////////////////////////////
-// Name: statbmp.cpp
+// Name: src/mac/classic/statbmp.cpp
// Purpose: wxStaticBitmap
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#include "wx/statbmp.h"
#include "wx/dcclient.h"
bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
SetBestSize( size ) ;
-
+
return ret;
}
Refresh() ;
}
-void wxStaticBitmap::OnPaint( wxPaintEvent& WXUNUSED(event) )
+void wxStaticBitmap::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
wxPaintDC dc(this);
PrepareDC(dc);
- dc.DrawBitmap( m_bitmap , 0 , 0 , TRUE ) ;
+ dc.DrawBitmap( m_bitmap , 0 , 0 , true ) ;
}
wxSize wxStaticBitmap::DoGetBestSize() const
{
return wxWindow::DoGetBestSize() ;
}
-
/////////////////////////////////////////////////////////////////////////////
-// Name: statbox.cpp
+// Name: src/mac/classic/statbox.cpp
// Purpose: wxStaticBox
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#include "wx/statbox.h"
#include "wx/mac/uma.h"
/*
* Static box
*/
-
+
bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos,
Rect bounds ;
Str255 title ;
-
+
MacPreControlCreate( parent , id , label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
- m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
+
+ m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlGroupBoxTextTitleProc , (long) this ) ;
-
+
MacPostControlCreate() ;
-
- return TRUE;
+
+ return true;
}
/////////////////////////////////////////////////////////////////////////////
-// Name: tabctrl.cpp
+// Name: src/mac/classic/tabctrl.cpp
// Purpose: wxTabCtrl
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#if wxUSE_TAB_DIALOG
Rect bounds ;
Str255 title ;
-
+
m_imageList = NULL;
-
+
MacPreControlCreate( parent , id , wxEmptyString , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
- m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
+
+ m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
kControlTabSmallProc , (long) this ) ;
-
+
MacPostControlCreate() ;
- return TRUE ;
+ return true ;
}
wxTabCtrl::~wxTabCtrl()
bool wxTabCtrl::DeleteAllItems()
{
// TODO
- return FALSE;
+ return false;
}
// Delete an item
bool wxTabCtrl::DeleteItem(int item)
{
// TODO
- return FALSE;
+ return false;
}
// Get the selection
bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const
{
// TODO
- return FALSE;
+ return false;
}
// Get the number of rows
bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data)
{
// TODO
- return FALSE;
+ return false;
}
// Set the selection
bool wxTabCtrl::SetItemText(int item, const wxString& text)
{
// TODO
- return FALSE;
+ return false;
}
// Set the image for an item
bool wxTabCtrl::SetItemImage(int item, int image)
{
// TODO
- return FALSE;
+ return false;
}
// Set the data for an item
bool wxTabCtrl::SetItemData(int item, void* data)
{
// TODO
- return FALSE;
+ return false;
}
// Set the size for a fixed-width tab control
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#if wxUSE_TEXTCTRL
/////////////////////////////////////////////////////////////////////////////
-// Name: src/mac/tglbtn.cpp
+// Name: src/mac/classic/tglbtn.cpp
// Purpose: Definition of the wxToggleButton class, which implements a
// toggle button under wxMac.
// Author: Stefan Csomor
// License: Rocketeer license
/////////////////////////////////////////////////////////////////////////////
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
// ============================================================================
// declatations
// ============================================================================
// headers
// ----------------------------------------------------------------------------
-#include "wx/defs.h"
#include "wx/tglbtn.h"
#if wxUSE_TOGGLEBTN
m_macHorizontalBorder = kMacOSXHorizontalBorder;
m_macVerticalBorder = kMacOSXVerticalBorder;
}
-
+
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
- m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , kControlBehaviorToggles , 1,
+ m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , kControlBehaviorToggles , 1,
kControlBevelButtonNormalBevelProc , (long) this ) ;
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
-
+
MacPostControlCreate() ;
-
- return TRUE;
+
+ return true;
}
wxSize wxToggleButton::DoGetBestSize() const
{
- int wBtn = 70 ;
+ int wBtn = 70 ;
int hBtn = 20 ;
int lBtn = m_label.Length() * 8 + 12 ;
- if (lBtn > wBtn)
+ if (lBtn > wBtn)
wBtn = lBtn;
if ( UMAHasAquaLayout() )
ProcessCommand(event);
}
-void wxToggleButton::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 controlpart , bool WXUNUSED(mouseStillDown) )
+void wxToggleButton::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 controlpart , bool WXUNUSED(mouseStillDown) )
{
if ( controlpart != kControlNoPart )
{
}
#endif // wxUSE_TOGGLEBTN
-
/////////////////////////////////////////////////////////////////////////////
-// Name: tooltip.cpp
+// Name: src/mac/classic/tooltip.cpp
// Purpose: wxToolTip implementation
// Author: Robert Roebling
// Id: $Id$
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#if wxUSE_TOOLTIPS
public :
wxMacToolTip( ) ;
~wxMacToolTip() ;
-
+
void Setup( WindowRef window , const wxString& text , wxPoint localPosition ) ;
long GetMark() { return m_mark ; }
void Draw() ;
void Clear() ;
bool IsShown() { return m_shown ; }
private :
-
+
wxString m_label ;
wxPoint m_position ;
Rect m_rect ;
- WindowRef m_window ;
+ WindowRef m_window ;
PicHandle m_backpict ;
bool m_shown ;
long m_mark ;
void Notify()
{
if ( m_mark == m_tip->GetMark() )
- m_tip->Draw() ;
+ m_tip->Draw() ;
}
protected:
wxMacToolTip* m_tip;
void wxToolTip::SetTip( const wxString &tip )
{
m_text = tip;
-
+
if ( m_window )
{
/*
// update it immediately
wxToolInfo ti(GetHwndOf(m_window));
ti.lpszText = (wxChar *)m_text.c_str();
-
+
(void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti);
*/
}
s_ToolTip.Clear() ;
s_ToolTipArea = wxRect2DInt( event.m_x - 2 , event.m_y - 2 , 4 , 4 ) ;
s_LastWindowEntered = win ;
-
+
WindowRef window = MAC_WXHWND( win->MacGetRootWindow() ) ;
int x = event.m_x ;
int y = event.m_y ;
m_timer = NULL ;
}
-void wxMacToolTip::Setup( WindowRef win , const wxString& text , wxPoint localPosition )
+void wxMacToolTip::Setup( WindowRef win , const wxString& text , wxPoint localPosition )
{
m_mark++ ;
Clear() ;
m_timer = new wxMacToolTipTimer( this , s_ToolTipDelay ) ;
}
-wxMacToolTip::~wxMacToolTip()
+wxMacToolTip::~wxMacToolTip()
{
if ( m_timer ) {
delete m_timer ;
m_timer = NULL;
}
- if ( m_backpict )
+ if ( m_backpict )
Clear() ;
}
{
if ( m_label.Length() == 0 )
return ;
-
+
if ( m_window == s_ToolTipWindowRef )
{
m_shown = true ;
Style fontStyle ;
GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
GetFNum( fontName, &fontId );
-
+
TextFont( fontId ) ;
TextSize( fontSize ) ;
TextFace( fontStyle ) ;
::GetFontInfo(&fontInfo);
short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
short height = 0 ;
-
+
int i = 0 ;
int length = m_label.Length() ;
int width = 0 ;
thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
if ( thiswidth > width )
width = thiswidth ;
-
+
height += lineh ;
laststop = i+1 ;
}
width = thiswidth ;
height += lineh ;
}
-
+
m_rect.left = m_position.x + kTipOffset;
m_rect.top = m_position.y + kTipOffset;
m_rect.right = m_rect.left + width + 2 * kTipBorder;
ClipRect( &m_rect ) ;
BackColor( whiteColor ) ;
ForeColor(blackColor ) ;
- GWorldPtr port ;
+ GWorldPtr port ;
NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ;
CGrafPtr origPort ;
GDHandle origDevice ;
-
+
GetGWorld( &origPort , &origDevice ) ;
SetGWorld( port , NULL ) ;
-
+
m_backpict = OpenPicture(&m_rect);
-
- CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)),
- GetPortBitMapForCopyBits(port),
- &m_rect,
- &m_rect,
- srcCopy,
+
+ CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)),
+ GetPortBitMapForCopyBits(port),
+ &m_rect,
+ &m_rect,
+ srcCopy,
NULL);
ClosePicture();
SetGWorld( origPort , origDevice ) ;
DisposeGWorld( port ) ;
PenNormal() ;
-
+
RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ;
BackColor( whiteColor ) ;
RGBForeColor( &tooltipbackground ) ;
-
+
PaintRect( &m_rect ) ;
ForeColor(blackColor ) ;
FrameRect( &m_rect ) ;
SetThemeTextColor(kThemeTextColorNotification,wxDisplayDepth(),true) ;
::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
-
+
i = 0 ;
laststop = 0 ;
height = 0 ;
-
+
while( i < length )
{
if( text[i] == 13 || text[i] == 10)
i++ ;
}
::DrawText( text , laststop , i - laststop ) ;
- ::TextMode( srcOr ) ;
+ ::TextMode( srcOr ) ;
#endif
}
}
-void wxToolTip::NotifyWindowDelete( WXHWND win )
+void wxToolTip::NotifyWindowDelete( WXHWND win )
{
if ( win == s_ToolTipWindowRef )
{
#if TARGET_CARBON
HMHideTag() ;
m_helpTextRef.Release() ;
-#else
+#else
if ( m_window == s_ToolTipWindowRef && m_backpict )
{
wxMacPortStateHelper help( (GrafPtr) GetWindowPort(m_window) ) ;
}
#endif
-
// Licence: The wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
#if wxUSE_GUI