From 18f3decb46a80b38801dd6590d08eb525d3a3963 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Tue, 18 Apr 2006 09:05:00 +0000 Subject: [PATCH] wx/wxprec.h already includes wx/defs.h (with other minor cleaning). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38790 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/cfsocket.cpp | 2 - src/mac/carbon/imaglist.cpp | 10 +- src/mac/classic/app.cpp | 64 +++++----- src/mac/classic/bitmap.cpp | 34 +++--- src/mac/classic/button.cpp | 41 ++++--- src/mac/classic/checkbox.cpp | 26 ++-- src/mac/classic/control.cpp | 196 ++++++++++++++--------------- src/mac/classic/cursor.cpp | 86 ++++++------- src/mac/classic/dataobj.cpp | 40 +++--- src/mac/classic/dirdlg.cpp | 46 +++---- src/mac/classic/dnd.cpp | 134 ++++++++++---------- src/mac/classic/filedlg.cpp | 36 +++--- src/mac/classic/font.cpp | 36 +++--- src/mac/classic/mimetmac.cpp | 6 +- src/mac/classic/palette.cpp | 6 +- src/mac/classic/printmac.cpp | 230 +++++++++++++++++------------------ src/mac/classic/radiobut.cpp | 78 ++++++------ src/mac/classic/scrolbar.cpp | 33 ++--- src/mac/classic/slider.cpp | 10 +- src/mac/classic/spinbutt.cpp | 10 +- src/mac/classic/spinctrl.cpp | 38 +++--- src/mac/classic/statbmp.cpp | 17 +-- src/mac/classic/statbox.cpp | 24 ++-- src/mac/classic/tabctrl.cpp | 36 +++--- src/mac/classic/textctrl.cpp | 6 +- src/mac/classic/tglbtn.cpp | 26 ++-- src/mac/classic/tooltip.cpp | 71 +++++------ src/mac/classic/uma.cpp | 6 +- 28 files changed, 710 insertions(+), 638 deletions(-) diff --git a/src/mac/carbon/cfsocket.cpp b/src/mac/carbon/cfsocket.cpp index 27cae40423..d32965130a 100644 --- a/src/mac/carbon/cfsocket.cpp +++ b/src/mac/carbon/cfsocket.cpp @@ -19,7 +19,6 @@ #include "wx/app.h" #include "wx/apptrait.h" -#include "wx/defs.h" #include "wx/object.h" #include "wx/string.h" #include "wx/timer.h" @@ -2301,4 +2300,3 @@ IMPLEMENT_DYNAMIC_CLASS(wxSocketModule, wxModule) #endif // wxUSE_SOCKETS - diff --git a/src/mac/carbon/imaglist.cpp b/src/mac/carbon/imaglist.cpp index 466cc56ce1..403567198e 100644 --- a/src/mac/carbon/imaglist.cpp +++ b/src/mac/carbon/imaglist.cpp @@ -1,21 +1,20 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" @@ -262,4 +261,3 @@ bool wxImageList::Draw( } #endif // wxUSE_IMAGLIST - diff --git a/src/mac/classic/app.cpp b/src/mac/classic/app.cpp index a607598c22..3cfa9de109 100644 --- a/src/mac/classic/app.cpp +++ b/src/mac/classic/app.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: app.cpp +// Name: src/mac/classic/app.cpp // Purpose: wxApp // Author: Stefan Csomor // Modified by: @@ -9,7 +9,11 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/defs.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif #include "wx/window.h" #include "wx/frame.h" @@ -72,10 +76,10 @@ extern size_t g_numberOfThreads; // 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 ; @@ -229,7 +233,7 @@ short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU { wxCommandEvent exitEvent(wxEVT_COMMAND_MENU_SELECTED, s_macExitMenuItemId); if (!win->ProcessEvent(exitEvent)) - win->Close(TRUE ) ; + win->Close(true) ; } else { @@ -273,7 +277,7 @@ void wxApp::MacPrintFile(const wxString & fileName ) if (printout) { wxPrinter printer; - printer.Print(view->GetFrame(), printout, TRUE); + printer.Print(view->GetFrame(), printout, true); delete printout; } } @@ -328,13 +332,13 @@ static pascal OSStatus 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... @@ -348,7 +352,7 @@ MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) &menuRef); #endif // 0 - wxEventType type=0; + wxEventType type=0; MenuCommand cmd=0; switch (GetEventKind(event)) { @@ -629,7 +633,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) UMAShowArrowCursor() ; ParamText("\pFatal Error", message, (ConstStr255Param)"\p", (ConstStr255Param)"\p"); itemHit = Alert(128, nil); - return FALSE ; + return false ; } #ifndef __DARWIN__ @@ -735,7 +739,7 @@ bool wxApp::OnInitGui() #endif } - return TRUE ; + return true ; } void wxApp::CleanUp() @@ -1069,18 +1073,18 @@ pascal OSStatus wxMacApplicationEventHandler( EventHandlerCallRef handler , Even 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) { @@ -1092,7 +1096,7 @@ int wxApp::MainLoop() void wxApp::ExitMainLoop() { - m_keepGoing = FALSE; + m_keepGoing = false; } // Is a message/event pending? @@ -1102,7 +1106,7 @@ bool wxApp::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 ; @@ -1145,7 +1149,7 @@ void wxApp::Exit() void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) { if (GetTopWindow()) - GetTopWindow()->Close(TRUE); + GetTopWindow()->Close(true); } // Default behaviour: close the application with prompts. The @@ -1155,7 +1159,7 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event) if (GetTopWindow()) { if (!GetTopWindow()->Close(!event.CanVeto())) - event.Veto(TRUE); + event.Veto(true); } } @@ -1176,10 +1180,10 @@ bool wxApp::Yield(bool onlyIfNeeded) wxFAIL_MSG( wxT("wxYield called recursively" ) ); } - return FALSE; + return false; } - s_inYield = TRUE; + s_inYield = true; #if wxUSE_THREADS YieldToAnyThread() ; @@ -1230,9 +1234,9 @@ bool wxApp::Yield(bool onlyIfNeeded) #endif wxMacProcessNotifierAndPendingEvents() ; - s_inYield = FALSE; + s_inYield = false; - return TRUE; + return true; } // platform specifics @@ -1381,7 +1385,7 @@ void wxApp::MacDoOneEvent() /*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 ) @@ -1508,7 +1512,7 @@ void wxApp::MacHandleHighLevelEvent( 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 ; @@ -1849,7 +1853,7 @@ bool wxGetKeyState(wxKeyCode key) //virtual key code if < 10.2.x, else see below 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)); } @@ -1973,7 +1977,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi } if (!handled) { - event.Skip( FALSE ) ; + event.Skip( false ) ; event.SetEventType( wxEVT_CHAR ) ; // raw value again event.m_keyCode = realkeyval ; @@ -2202,7 +2206,7 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr ) 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; @@ -2303,7 +2307,7 @@ void wxApp::MacHandleMouseMovedEvent(wxInt32 x , wxInt32 y ,wxUint32 modifiers , event.m_leftDown = isDown && !controlDown; - event.m_middleDown = FALSE; + event.m_middleDown = false; event.m_rightDown = isDown && controlDown; event.m_shiftDown = modifiers & shiftKey; diff --git a/src/mac/classic/bitmap.cpp b/src/mac/classic/bitmap.cpp index e51b3ca7b6..952bb1101a 100644 --- a/src/mac/classic/bitmap.cpp +++ b/src/mac/classic/bitmap.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: bitmap.cpp +// Name: src/mac/classic/bitmap.cpp // Purpose: wxBitmap // Author: Stefan Csomor // Modified by: @@ -9,7 +9,11 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/defs.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif #include "wx/bitmap.h" #include "wx/icon.h" @@ -353,7 +357,7 @@ wxBitmapRefData::wxBitmapRefData() : m_width(0) , m_height(0) , m_depth(0) - , m_ok(FALSE) + , m_ok(false) , m_numColors(0) , m_quality(0) { @@ -508,12 +512,12 @@ wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type) 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) @@ -710,7 +714,7 @@ bool wxBitmap::Create(void *data, wxBitmapType type, int width, int height, int 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); @@ -1162,7 +1166,7 @@ bool wxMask::Create(const wxBitmap& bitmap) 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 @@ -1171,7 +1175,7 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) { // 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 @@ -1226,7 +1230,7 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) UnlockPixels( GetGWorldPixMap( (GWorldPtr) bitmap.GetHBITMAP() ) ) ; SetGWorld( origPort , origDevice ) ; - return TRUE; + return true; } bool wxMask::PointMasked(int x, int y) @@ -1260,18 +1264,18 @@ wxBitmapHandler::~wxBitmapHandler() 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; } /* @@ -1317,9 +1321,9 @@ bool wxPICTResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo 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() diff --git a/src/mac/classic/button.cpp b/src/mac/classic/button.cpp index 681d761703..12864683c9 100644 --- a/src/mac/classic/button.cpp +++ b/src/mac/classic/button.cpp @@ -1,15 +1,19 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" @@ -32,7 +36,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl, wxString label(lbl); if (label.empty() && wxIsStockID(id)) label = wxGetStockLabel(id); - + if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) ) return false; @@ -44,16 +48,16 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl, 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() @@ -84,18 +88,18 @@ 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() ) @@ -119,7 +123,7 @@ void wxButton::Command (wxCommandEvent & event) 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 ) { @@ -128,4 +132,3 @@ void wxButton::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 contr ProcessCommand(event); } } - diff --git a/src/mac/classic/checkbox.cpp b/src/mac/classic/checkbox.cpp index 9bf70e9bc1..461c6d1cb9 100644 --- a/src/mac/classic/checkbox.cpp +++ b/src/mac/classic/checkbox.cpp @@ -1,15 +1,19 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" @@ -30,7 +34,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, Rect bounds ; Str255 title ; - + MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; SInt16 maxValue = 1 /* kControlCheckboxCheckedValue */; @@ -39,12 +43,12 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, 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) @@ -88,7 +92,7 @@ void wxCheckBox::DoSet3StateValue(wxCheckBoxState 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(); @@ -143,7 +147,7 @@ bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, // TODO: Create the bitmap checkbox - return FALSE; + return false; } void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap) @@ -167,7 +171,5 @@ bool wxBitmapCheckBox::GetValue() const { // TODO wxFAIL_MSG(wxT("wxBitmapCheckBox::GetValue() not yet implemented")); - return FALSE; + return false; } - - diff --git a/src/mac/classic/control.cpp b/src/mac/classic/control.cpp index b186171c35..4d5f5c15ad 100644 --- a/src/mac/classic/control.cpp +++ b/src/mac/classic/control.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: control.cpp +// Name: src/mac/classic/control.cpp // Purpose: wxControl class // Author: Stefan Csomor // Modified by: @@ -9,7 +9,11 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/defs.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif #include "wx/control.h" #include "wx/panel.h" @@ -30,8 +34,8 @@ 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" @@ -82,7 +86,7 @@ ControlDefUPP wxMacControlActionUPP = NULL ; pascal SInt32 wxMacControlDefinition(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param) { - + wxControl* wx = (wxControl*) wxFindControlFromMacControl( theControl ) ; if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) ) { @@ -132,7 +136,7 @@ pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessa } return status ; } - + wxControl::wxControl() { m_macControl = NULL ; @@ -161,7 +165,7 @@ bool wxControl::Create(wxWindow *parent, wxWindowID id, 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 ) { @@ -178,7 +182,7 @@ bool wxControl::Create(wxWindow *parent, wxWindowID id, 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. @@ -203,7 +207,7 @@ void wxControl::SetLabel(const wxString& title) if ( m_macControl ) { - UMASetControlTitle( (ControlHandle) m_macControl , m_label , m_font.GetEncoding() ) ; + UMASetControlTitle( (ControlHandle) m_macControl , m_label , m_font.GetEncoding() ) ; } Refresh() ; } @@ -212,7 +216,7 @@ wxSize wxControl::DoGetBestSize() const { if ( (ControlHandle) m_macControl == NULL ) return wxWindow::DoGetBestSize() ; - + Rect bestsize = { 0 , 0 , 0 , 0 } ; short baselineoffset ; int bestWidth, bestHeight ; @@ -230,12 +234,12 @@ wxSize wxControl::DoGetBestSize() const } 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 ; @@ -244,7 +248,7 @@ wxSize wxControl::DoGetBestSize() const bestHeight += 2 * m_macVerticalBorder; - + return wxSize(bestWidth, bestHeight); } @@ -282,11 +286,11 @@ void wxRemoveMacControlAssociation(wxControl *control) 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 ; @@ -295,7 +299,7 @@ void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString l m_height = size.y ; m_x = pos.x ; m_y = pos.y ; - + ((Rect*)outBounds)->top = -10; ((Rect*)outBounds)->left = -10; ((Rect*)outBounds)->bottom = 0; @@ -308,7 +312,7 @@ void wxControl::MacPostControlCreate() { wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ; DoSetWindowVariant( m_windowVariant ) ; - /* + /* if ( IsKindOf( CLASSINFO( wxScrollBar ) ) ) { // no font @@ -318,19 +322,19 @@ void wxControl::MacPostControlCreate() 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 ) ; } */ @@ -372,43 +376,43 @@ void wxControl::MacPostControlCreate() #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 ) ) @@ -423,7 +427,7 @@ void wxControl::MacAdjustControlRect() } else if ( IsKindOf( CLASSINFO( wxSpinButton ) ) ) { - bestsize.bottom = 24 ; + bestsize.bottom = 24 ; } } @@ -441,7 +445,7 @@ void wxControl::MacAdjustControlRect() } else m_width = bestsize.right - bestsize.left ; - + m_width += 2 * m_macHorizontalBorder + MacGetLeftBorderSize() + MacGetRightBorderSize() ; } if ( m_height == -1 ) @@ -452,11 +456,11 @@ void wxControl::MacAdjustControlRect() m_height += 2 * m_macVerticalBorder + MacGetTopBorderSize() + MacGetBottomBorderSize() ; } - MacUpdateDimensions() ; + MacUpdateDimensions() ; } } -WXWidget wxControl::MacGetContainerForEmbedding() +WXWidget wxControl::MacGetContainerForEmbedding() { if ( m_macControl ) return m_macControl ; @@ -464,29 +468,29 @@ WXWidget wxControl::MacGetContainerForEmbedding() 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 ; @@ -504,19 +508,19 @@ void wxControl::MacUpdateDimensions() } } -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 ) { @@ -537,7 +541,7 @@ void wxControl::MacSuperShown( bool show ) } } } - + wxWindow::MacSuperShown( show ) ; } @@ -566,11 +570,11 @@ void wxControl::DoSetSize(int x, int y, 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 ) @@ -590,13 +594,13 @@ bool wxControl::Show(bool 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 ) { @@ -605,7 +609,7 @@ bool wxControl::Enable(bool enable) else UMADeactivateControl( (ControlHandle) m_macControl ) ; } - return TRUE ; + return true ; } void wxControl::Refresh(bool eraseBack, const wxRect *rect) @@ -642,18 +646,18 @@ void wxControl::OnPaint(wxPaintEvent& event) } 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 ); @@ -661,7 +665,7 @@ void wxControl::OnKeyDown( wxKeyEvent &event ) 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 ; @@ -673,43 +677,43 @@ void wxControl::OnKeyDown( wxKeyEvent &event ) #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 ; { @@ -719,7 +723,7 @@ void wxControl::OnMouseEvent( wxMouseEvent &event ) { 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 */ ) ; } @@ -729,19 +733,19 @@ void wxControl::OnMouseEvent( wxMouseEvent &event ) } 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") ) ; } @@ -752,16 +756,16 @@ void wxControl::DoSetWindowVariant( wxWindowVariant variant ) { 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 ) @@ -771,38 +775,38 @@ void wxControl::DoSetWindowVariant( wxWindowVariant variant ) 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 ); } diff --git a/src/mac/classic/cursor.cpp b/src/mac/classic/cursor.cpp index 3f7e44d3b7..1b90a15ac5 100644 --- a/src/mac/classic/cursor.cpp +++ b/src/mac/classic/cursor.cpp @@ -1,15 +1,19 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" @@ -41,7 +45,7 @@ wxCursor gMacCurrentCursor ; wxCursorRefData::wxCursorRefData() { - m_width = 16; + m_width = 16; m_height = 16; m_hCursor = NULL ; m_disposeHandle = false ; @@ -59,7 +63,7 @@ wxCursorRefData::~wxCursorRefData() else if ( m_disposeHandle ) { ::DisposeHandle( (Handle ) m_hCursor ) ; - } + } else if ( m_releaseHandle ) { // we don't release the resource since it may already @@ -82,24 +86,24 @@ wxCursor::wxCursor( const wxImage &image ) 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 ) @@ -120,18 +124,18 @@ 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") ); @@ -149,15 +153,15 @@ void wxCursor::CreateFromImage(const wxImage & image) } 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 ) ) ; @@ -166,7 +170,7 @@ void wxCursor::CreateFromImage(const wxImage & image) 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() ; @@ -174,7 +178,7 @@ void wxCursor::CreateFromImage(const wxImage & image) { short rowbits = 0 ; short maskbits = 0 ; - + for ( int x = 0 ; x < w ; ++x ) { long pos = (y * w + x) * 3; @@ -221,36 +225,36 @@ void wxCursor::CreateFromImage(const wxImage & image) } 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() ; @@ -258,7 +262,7 @@ void wxCursor::CreateFromImage(const wxImage & image) { short rowbits = 0 ; short maskbits = 0 ; - + for ( int x = 0 ; x < w ; ++x ) { long pos = (y * w + x) * 3; @@ -267,7 +271,7 @@ void wxCursor::CreateFromImage(const wxImage & image) 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 @@ -279,10 +283,10 @@ void wxCursor::CreateFromImage(const wxImage & image) 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 ; @@ -292,7 +296,7 @@ void wxCursor::CreateFromImage(const wxImage & image) { memcpy( (**ch).crsrMask , (**ch).crsr1Data , sizeof( Bits16) ) ; } - + HUnlock((Handle) ch) ; M_CURSORDATA->m_hCursor = ch ; M_CURSORDATA->m_isColorCursor = true ; @@ -305,8 +309,8 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho 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 ) @@ -320,7 +324,7 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho M_CURSORDATA->m_isColorCursor = true ; } else - { + { Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ; if ( resHandle ) { @@ -352,7 +356,7 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho wxCursor::wxCursor(int cursor_type) { m_refData = new wxCursorRefData; - + switch (cursor_type) { case wxCURSOR_COPY_ARROW: @@ -485,7 +489,7 @@ wxCursor::wxCursor(int cursor_type) M_CURSORDATA->m_releaseHandle = true ; } -void wxCursor::MacInstall() const +void wxCursor::MacInstall() const { gMacCurrentCursor = *this ; if ( m_refData && M_CURSORDATA->m_themeCursor != -1 ) @@ -514,5 +518,3 @@ void wxSetCursor(const wxCursor& cursor) { cursor.MacInstall() ; } - - diff --git a/src/mac/classic/dataobj.cpp b/src/mac/classic/dataobj.cpp index 120e83de9c..1e2bd14fd4 100644 --- a/src/mac/classic/dataobj.cpp +++ b/src/mac/classic/dataobj.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: mac/dataobj.cpp +// Name: src/mac/classic/dataobj.cpp // Purpose: implementation of wxDataObject class // Author: Stefan Csomor // Modified by: @@ -9,6 +9,12 @@ // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + // ============================================================================ // declarations // ============================================================================ @@ -17,13 +23,9 @@ // 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" @@ -166,9 +168,7 @@ bool wxDataObject::IsSupportedFormat( // wxFileDataObject // ---------------------------------------------------------------------------- -bool wxFileDataObject::GetDataHere( - void* pBuf -) const +bool wxFileDataObject::GetDataHere( void* pBuf ) const { wxString sFilenames; @@ -179,7 +179,7 @@ bool wxFileDataObject::GetDataHere( } memcpy(pBuf, sFilenames.mbc_str(), sFilenames.Len() + 1); - return TRUE; + return true; } size_t wxFileDataObject::GetDataSize() const @@ -204,7 +204,7 @@ bool wxFileDataObject::SetData( AddFile(wxString::FromAscii((char*)pBuf)); - return TRUE; + return true; } void wxFileDataObject::AddFile( @@ -252,13 +252,13 @@ void wxBitmapDataObject::SetBitmap( } } -void wxBitmapDataObject::Init() -{ +void wxBitmapDataObject::Init() +{ m_pictHandle = NULL ; m_pictCreated = false ; -} +} -void wxBitmapDataObject::Clear() +void wxBitmapDataObject::Clear() { if ( m_pictCreated && m_pictHandle ) { @@ -267,17 +267,15 @@ void wxBitmapDataObject::Clear() 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 @@ -296,7 +294,7 @@ bool wxBitmapDataObject::SetData( 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 ) ; diff --git a/src/mac/classic/dirdlg.cpp b/src/mac/classic/dirdlg.cpp index 6feb697ede..d58aa0d5f4 100644 --- a/src/mac/classic/dirdlg.cpp +++ b/src/mac/classic/dirdlg.cpp @@ -1,15 +1,20 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" @@ -49,7 +54,7 @@ int wxDirDialog::ShowModal() NavReplyRecord mNavReply; AEDesc* mDefaultLocation = NULL ; bool mSelectDefault = false ; - + ::NavGetDefaultDialogOptions(&mNavOptions); mNavFilterUPP = nil; @@ -63,20 +68,20 @@ int wxDirDialog::ShowModal() 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, @@ -84,36 +89,36 @@ int wxDirDialog::ShowModal() 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; @@ -121,20 +126,19 @@ int wxDirDialog::ShowModal() 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; } - diff --git a/src/mac/classic/dnd.cpp b/src/mac/classic/dnd.cpp index 09745f2f62..2fa7db53cb 100644 --- a/src/mac/classic/dnd.cpp +++ b/src/mac/classic/dnd.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: dnd.cpp +// Name: src/mac/classic/dnd.cpp // Purpose: wxDropTarget, wxDropSource, wxDataObject implementation // Author: Stefan Csomor // Modified by: @@ -9,7 +9,11 @@ // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#include "wx/defs.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif #if wxUSE_DRAG_AND_DROP @@ -26,14 +30,14 @@ void wxMacEnsureTrackingHandlersInstalled() ; -typedef struct +typedef struct { wxWindow* m_currentTargetWindow ; wxDropTarget* m_currentTarget ; wxDropSource* m_currentSource ; } MacTrackingGlobals ; -MacTrackingGlobals gTrackingGlobals ; +MacTrackingGlobals gTrackingGlobals ; //---------------------------------------------------------------------------- // wxDropTarget @@ -56,7 +60,7 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x), bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) ) { if (!m_dataObject) - return FALSE; + return false; return CurrentDragHasSupportedFormat() ; } @@ -73,13 +77,13 @@ wxDragResult wxDropTarget::OnData( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), 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() ; @@ -88,7 +92,7 @@ bool wxDropTarget::CurrentDragHasSupportedFormat() 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 ; @@ -102,7 +106,7 @@ bool wxDropTarget::CurrentDragHasSupportedFormat() 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 ; @@ -120,22 +124,22 @@ bool wxDropTarget::CurrentDragHasSupportedFormat() } } } - 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() ; @@ -144,12 +148,12 @@ bool wxDropTarget::GetData() 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 ) ; } @@ -171,7 +175,7 @@ bool wxDropTarget::GetData() 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 ; @@ -186,7 +190,7 @@ bool wxDropTarget::GetData() { FlavorFlags theFlags; result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags); - if (result == noErr) + if (result == noErr) { Size dataSize ; Ptr theData ; @@ -198,11 +202,11 @@ bool wxDropTarget::GetData() 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 ) @@ -214,7 +218,7 @@ bool wxDropTarget::GetData() else { ((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ; - firstFileAdded = true ; + firstFileAdded = true ; } } else @@ -228,7 +232,7 @@ bool wxDropTarget::GetData() } } } - return TRUE ; + return true ; } //------------------------------------------------------------------------- @@ -268,13 +272,13 @@ wxDropSource::~wxDropSource() 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; @@ -306,9 +310,9 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags)) 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; @@ -327,20 +331,20 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags)) 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() ; @@ -351,29 +355,29 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags)) #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; @@ -388,11 +392,11 @@ bool wxDropSource::MacInstallDefaultCursor(wxDragResult effect) { cursor.MacInstall() ; - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -423,19 +427,19 @@ void wxMacEnsureTrackingHandlersInstalled() 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; @@ -454,8 +458,8 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind GlobalToLocal(&localMouse); - -// if (attributes & kDragHasLeftSenderWindow) + +// if (attributes & kDragHasLeftSenderWindow) { wxPoint point(localMouse.h , localMouse.v) ; wxWindow *win = NULL ; @@ -487,14 +491,14 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind 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 ; @@ -552,12 +556,12 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind } } } - + } // MyTrackItemUnderMouse(localMouse, theWindow); break; case kDragTrackingLeaveWindow: - if (trackingGlobals->m_currentTarget) + if (trackingGlobals->m_currentTarget) { trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ; trackingGlobals->m_currentTarget->OnLeave() ; @@ -573,13 +577,13 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind 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; diff --git a/src/mac/classic/filedlg.cpp b/src/mac/classic/filedlg.cpp index 920f82b3b3..7ebc988bca 100644 --- a/src/mac/classic/filedlg.cpp +++ b/src/mac/classic/filedlg.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: filedlg.cpp +// Name: src/mac/classic/filedlg.cpp // Purpose: wxFileDialog // Author: Stefan Csomor // Modified by: @@ -9,7 +9,12 @@ // 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" @@ -183,7 +188,7 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) // 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() ) ; @@ -200,21 +205,21 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) 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 + } } } } @@ -319,16 +324,16 @@ pascal Boolean CrossPlatformFilterCallback ( - 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 ) ; } @@ -615,7 +620,7 @@ int wxFileDialog::ShowModal() 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; @@ -638,4 +643,3 @@ int wxFileDialog::ShowModal() return wxID_CANCEL; #endif // TARGET_CARBON } - diff --git a/src/mac/classic/font.cpp b/src/mac/classic/font.cpp index ad7abbaaf3..7f4f120eb8 100644 --- a/src/mac/classic/font.cpp +++ b/src/mac/classic/font.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: font.cpp +// Name: src/mac/classic/font.cpp // Purpose: wxFont class // Author: Stefan Csomor // Modified by: @@ -9,7 +9,12 @@ // 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" @@ -33,7 +38,7 @@ public: , 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) @@ -41,7 +46,7 @@ public: , m_macFontStyle(0) , m_macATSUFontID() { - Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE, + Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, false, wxT("Geneva"), wxFONTENCODING_DEFAULT); } @@ -88,9 +93,9 @@ public: } 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, @@ -110,8 +115,8 @@ protected: 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; @@ -152,7 +157,7 @@ void wxFontRefData::Init(int pointSize, m_macFontSize = 0; m_macFontStyle = 0; m_fontId = 0; - m_noAA = FALSE; + m_noAA = false; } wxFontRefData::~wxFontRefData() @@ -205,19 +210,19 @@ void wxFontRefData::MacFindFont() 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 ) ; @@ -257,7 +262,7 @@ bool wxFont::Create(int pointSize, RealizeResource(); - return TRUE; + return true; } wxFont::~wxFont() @@ -267,7 +272,7 @@ wxFont::~wxFont() bool wxFont::RealizeResource() { M_FONTDATA->MacFindFont() ; - return TRUE; + return true; } void wxFont::SetEncoding(wxFontEncoding encoding) @@ -434,4 +439,3 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const return &(M_FONTDATA->m_info); } - diff --git a/src/mac/classic/mimetmac.cpp b/src/mac/classic/mimetmac.cpp index c1dd028eb7..7a99856444 100644 --- a/src/mac/classic/mimetmac.cpp +++ b/src/mac/classic/mimetmac.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: mac/mimetype.cpp +// Name: src/mac/classic/mimetype.cpp // Purpose: classes and functions to manage MIME types // Author: Vadim Zeitlin // Modified by: @@ -16,10 +16,6 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP - #include "wx/defs.h" -#endif - #ifndef WX_PRECOMP #include "wx/string.h" #if wxUSE_GUI diff --git a/src/mac/classic/palette.cpp b/src/mac/classic/palette.cpp index 02720f58d4..9eed7efe5c 100644 --- a/src/mac/classic/palette.cpp +++ b/src/mac/classic/palette.cpp @@ -9,7 +9,11 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/defs.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif #if wxUSE_PALETTE diff --git a/src/mac/classic/printmac.cpp b/src/mac/classic/printmac.cpp index 1896f32e73..f179f5e7f6 100644 --- a/src/mac/classic/printmac.cpp +++ b/src/mac/classic/printmac.cpp @@ -1,28 +1,26 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" @@ -43,7 +41,7 @@ IMPLEMENT_CLASS(wxMacPrintPreview, wxPrintPreviewBase) #if TARGET_CARBON -wxNativePrintData* wxNativePrintData::Create() +wxNativePrintData* wxNativePrintData::Create() { return new wxMacCarbonPrintData() ; } @@ -69,7 +67,7 @@ wxMacCarbonPrintData::~wxMacCarbonPrintData() (void)PMRelease(m_macPrintSettings); m_macPrintSettings = kPMNoPrintSettings; } - + if ( m_macPrintSession != kPMNoReference ) { (void)PMRelease(m_macPrintSession); @@ -77,7 +75,7 @@ wxMacCarbonPrintData::~wxMacCarbonPrintData() } } -void wxMacCarbonPrintData::ValidateOrCreate() +void wxMacCarbonPrintData::ValidateOrCreate() { OSStatus err = noErr ; if ( m_macPrintSession == kPMNoReference ) @@ -88,7 +86,7 @@ void wxMacCarbonPrintData::ValidateOrCreate() 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. @@ -105,12 +103,12 @@ void wxMacCarbonPrintData::ValidateOrCreate() (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. @@ -149,7 +147,7 @@ void wxMacCarbonPrintData::TransferFrom( wxPrintData* data ) } else PMSetColorMode( (PMPrintSettings) m_macPrintSettings, kPMBlackAndWhite ) ; - + // PMDuplexMode not yet accessible via API // PMQualityMode not yet accessible via API // todo paperSize @@ -158,12 +156,12 @@ void wxMacCarbonPrintData::TransferFrom( wxPrintData* data ) 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 ) @@ -184,16 +182,16 @@ void wxMacCarbonPrintData::TransferTo( wxPrintData* data ) 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 ) { @@ -215,7 +213,7 @@ void wxMacCarbonPrintData::TransferFrom( wxPageSetupData *data ) void wxMacCarbonPrintData::TransferTo( wxPageSetupData* data ) { - PMRect rPaper; + PMRect rPaper; OSStatus err = PMGetUnadjustedPaperRect(m_macPageFormat, &rPaper); if ( err == noErr ) { @@ -224,14 +222,14 @@ void wxMacCarbonPrintData::TransferTo( wxPageSetupData* data ) 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 ) @@ -266,34 +264,34 @@ void wxMacCarbonPrintData::CopyFrom( wxNativePrintData* d ) { 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() @@ -301,9 +299,9 @@ int wxMacCarbonPrintData::ShowPrintDialog() int result = wxID_CANCEL ; OSErr err = noErr ; wxString message ; - + Boolean accepted; - + { // Display the Print dialog. if (err == noErr) @@ -337,7 +335,7 @@ int wxMacCarbonPrintData::ShowPageSetupDialog() int result = wxID_CANCEL ; OSErr err = noErr ; wxString message ; - + Boolean accepted; { // Display the Page Setup dialog. @@ -350,8 +348,8 @@ int wxMacCarbonPrintData::ShowPageSetupDialog() { err = kPMCancel; // user clicked Cancel button } - } - + } + // If the user did not cancel, flatten and save the PageFormat object // with our document. if (err == noErr) { @@ -370,7 +368,7 @@ int wxMacCarbonPrintData::ShowPageSetupDialog() #else -wxNativePrintData* wxNativePrintData::Create() +wxNativePrintData* wxNativePrintData::Create() { return new wxMacClassicPrintData() ; } @@ -387,7 +385,7 @@ wxMacClassicPrintData::~wxMacClassicPrintData() DisposeHandle( (Handle) m_macPrintSettings ) ; } -void wxMacClassicPrintData::ValidateOrCreate() +void wxMacClassicPrintData::ValidateOrCreate() { if ( m_macPrintSettings == NULL ) { @@ -420,7 +418,7 @@ void wxMacClassicPrintData::TransferFrom( wxPrintData* data ) 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 ) ) ; } @@ -466,7 +464,7 @@ int wxMacClassicPrintData::ShowPrintDialog() int result = wxID_CANCEL ; OSErr err = noErr ; wxString message ; - + err = ::UMAPrOpen() ; if ( err == noErr ) { @@ -474,12 +472,12 @@ int wxMacClassicPrintData::ShowPrintDialog() { 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() ; @@ -492,7 +490,7 @@ int wxMacClassicPrintData::ShowPageSetupDialog() int result = wxID_CANCEL ; OSErr err = noErr ; wxString message ; - + err = ::UMAPrOpen() ; if ( err == noErr ) { @@ -500,7 +498,7 @@ int wxMacClassicPrintData::ShowPageSetupDialog() { result = wxID_OK ; } - + } else { @@ -529,19 +527,19 @@ wxMacPrinter::~wxMacPrinter(void) 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) { @@ -556,69 +554,69 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool 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 ++) { @@ -630,14 +628,14 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) } 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 @@ -658,36 +656,36 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) } 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; } @@ -695,15 +693,15 @@ bool wxMacPrinter::Setup(wxWindow *parent) { #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; @@ -734,7 +732,7 @@ wxMacPrintPreview::~wxMacPrintPreview(void) bool wxMacPrintPreview::Print(bool interactive) { if (!m_printPrintout) - return FALSE; + return false; wxMacPrinter printer(&m_printDialogData); return printer.Print(m_previewFrame, m_printPrintout, interactive); } @@ -743,7 +741,7 @@ void wxMacPrintPreview::DetermineScaling(void) { 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) ); @@ -751,7 +749,7 @@ void wxMacPrintPreview::DetermineScaling(void) 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()) @@ -773,6 +771,6 @@ void wxMacPrintPreview::DetermineScaling(void) // 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 ; } diff --git a/src/mac/classic/radiobut.cpp b/src/mac/classic/radiobut.cpp index f747deaa01..f58db33087 100644 --- a/src/mac/classic/radiobut.cpp +++ b/src/mac/classic/radiobut.cpp @@ -1,15 +1,19 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" @@ -29,38 +33,38 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, 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) @@ -68,9 +72,9 @@ 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) { @@ -94,12 +98,12 @@ void wxRadioButton::Command (wxCommandEvent & event) 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) { @@ -128,17 +132,17 @@ void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpar 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); } -} +} diff --git a/src/mac/classic/scrolbar.cpp b/src/mac/classic/scrolbar.cpp index 3da8ecd289..fc41820841 100644 --- a/src/mac/classic/scrolbar.cpp +++ b/src/mac/classic/scrolbar.cpp @@ -1,15 +1,19 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" @@ -34,7 +38,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, const wxString& name) { if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) - return FALSE; + return false; Rect bounds ; Str255 title ; @@ -42,7 +46,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, 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") ) ; @@ -51,7 +55,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, MacPostControlCreate() ; - return TRUE; + return true; } wxScrollBar::~wxScrollBar() @@ -99,22 +103,22 @@ void wxScrollBar::Command(wxCommandEvent& event) 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 : @@ -144,16 +148,16 @@ void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart 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 ) { @@ -174,4 +178,3 @@ void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart else GetEventHandler()->ProcessEvent(event); } - diff --git a/src/mac/classic/slider.cpp b/src/mac/classic/slider.cpp index 57d74bc8c4..361175dd9b 100644 --- a/src/mac/classic/slider.cpp +++ b/src/mac/classic/slider.cpp @@ -1,15 +1,19 @@ ///////////////////////////////////////////////////////////////////////////// -// 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 diff --git a/src/mac/classic/spinbutt.cpp b/src/mac/classic/spinbutt.cpp index 5471cc8b14..b058518a13 100644 --- a/src/mac/classic/spinbutt.cpp +++ b/src/mac/classic/spinbutt.cpp @@ -1,15 +1,19 @@ ///////////////////////////////////////////////////////////////////////////// -// 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 diff --git a/src/mac/classic/spinctrl.cpp b/src/mac/classic/spinctrl.cpp index 4a6f5516db..e71f35859b 100644 --- a/src/mac/classic/spinctrl.cpp +++ b/src/mac/classic/spinctrl.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: spinbutt.cpp +// Name: src/mac/classic/spinbutt.cpp // Purpose: wxSpinCtrl // Author: Robert // Modified by: Mark Newsam (Based on GTK file) @@ -8,14 +8,18 @@ // 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" @@ -58,7 +62,7 @@ protected: { // 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 ); } @@ -116,7 +120,7 @@ BEGIN_EVENT_TABLE(wxSpinCtrlButton, wxSpinButton) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl) - + // ============================================================================ // implementation // ============================================================================ @@ -145,7 +149,7 @@ bool wxSpinCtrl::Create(wxWindow *parent, if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, name) ) { - return FALSE; + return false; } // the string value overrides the numeric one (for backwards compatibility @@ -171,7 +175,7 @@ bool wxSpinCtrl::Create(wxWindow *parent, } DoSetSize(pos.x , pos.y , csize.x, csize.y); - return TRUE; + return true; } wxSpinCtrl::~wxSpinCtrl() @@ -216,15 +220,15 @@ void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) 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; } // ---------------------------------------------------------------------------- @@ -237,18 +241,18 @@ bool wxSpinCtrl::GetTextValue(int *val) const 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 @@ -321,9 +325,9 @@ void wxSpinCtrl::SetSelection(long from, long to) // be selected if ( (from == -1) && (to == -1) ) { - from = 0; + from = 0; } m_text->SetSelection(from, to); -} +} #endif // wxUSE_SPINCTRL diff --git a/src/mac/classic/statbmp.cpp b/src/mac/classic/statbmp.cpp index 506299c958..0282d8491b 100644 --- a/src/mac/classic/statbmp.cpp +++ b/src/mac/classic/statbmp.cpp @@ -1,15 +1,19 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" @@ -54,7 +58,7 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id, bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); SetBestSize( size ) ; - + return ret; } @@ -66,16 +70,15 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap) 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() ; } - diff --git a/src/mac/classic/statbox.cpp b/src/mac/classic/statbox.cpp index 8eea7cd8be..2f51bf3d23 100644 --- a/src/mac/classic/statbox.cpp +++ b/src/mac/classic/statbox.cpp @@ -1,15 +1,19 @@ ///////////////////////////////////////////////////////////////////////////// -// 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" @@ -23,7 +27,7 @@ END_EVENT_TABLE() /* * Static box */ - + bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, @@ -37,13 +41,13 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, 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; } diff --git a/src/mac/classic/tabctrl.cpp b/src/mac/classic/tabctrl.cpp index a21ba6ecdd..6e1b7019ed 100644 --- a/src/mac/classic/tabctrl.cpp +++ b/src/mac/classic/tabctrl.cpp @@ -1,15 +1,19 @@ ///////////////////////////////////////////////////////////////////////////// -// 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 @@ -36,16 +40,16 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons 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() @@ -60,14 +64,14 @@ void wxTabCtrl::Command(wxCommandEvent& event) bool wxTabCtrl::DeleteAllItems() { // TODO - return FALSE; + return false; } // Delete an item bool wxTabCtrl::DeleteItem(int item) { // TODO - return FALSE; + return false; } // Get the selection @@ -101,7 +105,7 @@ int wxTabCtrl::GetItemCount() const bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const { // TODO - return FALSE; + return false; } // Get the number of rows @@ -143,7 +147,7 @@ int wxTabCtrl::HitTest(const wxPoint& pt, long& flags) bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data) { // TODO - return FALSE; + return false; } // Set the selection @@ -163,21 +167,21 @@ void wxTabCtrl::SetImageList(wxImageList* imageList) 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 diff --git a/src/mac/classic/textctrl.cpp b/src/mac/classic/textctrl.cpp index a268a4d250..7a5b5c8a92 100644 --- a/src/mac/classic/textctrl.cpp +++ b/src/mac/classic/textctrl.cpp @@ -9,7 +9,11 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/defs.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif #if wxUSE_TEXTCTRL diff --git a/src/mac/classic/tglbtn.cpp b/src/mac/classic/tglbtn.cpp index 553c993e9f..0b2cca731e 100644 --- a/src/mac/classic/tglbtn.cpp +++ b/src/mac/classic/tglbtn.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// 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 @@ -10,6 +10,12 @@ // License: Rocketeer license ///////////////////////////////////////////////////////////////////////////// +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + // ============================================================================ // declatations // ============================================================================ @@ -18,7 +24,6 @@ // headers // ---------------------------------------------------------------------------- -#include "wx/defs.h" #include "wx/tglbtn.h" #if wxUSE_TOGGLEBTN @@ -63,25 +68,25 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, 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() ) @@ -108,7 +113,7 @@ void wxToggleButton::Command(wxCommandEvent & event) 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 ) { @@ -120,4 +125,3 @@ void wxToggleButton::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 } #endif // wxUSE_TOGGLEBTN - diff --git a/src/mac/classic/tooltip.cpp b/src/mac/classic/tooltip.cpp index 5ce94cf3f0..9c7c664c2a 100644 --- a/src/mac/classic/tooltip.cpp +++ b/src/mac/classic/tooltip.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: tooltip.cpp +// Name: src/mac/classic/tooltip.cpp // Purpose: wxToolTip implementation // Author: Robert Roebling // Id: $Id$ @@ -7,7 +7,11 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/defs.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif #if wxUSE_TOOLTIPS @@ -30,18 +34,18 @@ class wxMacToolTip 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 ; @@ -60,7 +64,7 @@ public: void Notify() { if ( m_mark == m_tip->GetMark() ) - m_tip->Draw() ; + m_tip->Draw() ; } protected: wxMacToolTip* m_tip; @@ -92,14 +96,14 @@ wxToolTip::~wxToolTip() 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); */ } @@ -149,7 +153,7 @@ void wxToolTip::RelayEvent( wxWindow *win , wxMouseEvent &event ) 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 ; @@ -184,7 +188,7 @@ wxMacToolTip::wxMacToolTip() 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() ; @@ -198,13 +202,13 @@ void wxMacToolTip::Setup( WindowRef win , const wxString& text , wxPoint localP 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() ; } @@ -215,7 +219,7 @@ void wxMacToolTip::Draw() { if ( m_label.Length() == 0 ) return ; - + if ( m_window == s_ToolTipWindowRef ) { m_shown = true ; @@ -244,7 +248,7 @@ void wxMacToolTip::Draw() Style fontStyle ; GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; GetFNum( fontName, &fontId ); - + TextFont( fontId ) ; TextSize( fontSize ) ; TextFace( fontStyle ) ; @@ -252,7 +256,7 @@ void wxMacToolTip::Draw() ::GetFontInfo(&fontInfo); short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading; short height = 0 ; - + int i = 0 ; int length = m_label.Length() ; int width = 0 ; @@ -267,7 +271,7 @@ void wxMacToolTip::Draw() thiswidth = ::TextWidth( text , laststop , i - laststop ) ; if ( thiswidth > width ) width = thiswidth ; - + height += lineh ; laststop = i+1 ; } @@ -280,7 +284,7 @@ void wxMacToolTip::Draw() 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; @@ -311,41 +315,41 @@ void wxMacToolTip::Draw() 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) @@ -358,12 +362,12 @@ void wxMacToolTip::Draw() 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 ) { @@ -384,7 +388,7 @@ void wxMacToolTip::Clear() #if TARGET_CARBON HMHideTag() ; m_helpTextRef.Release() ; -#else +#else if ( m_window == s_ToolTipWindowRef && m_backpict ) { wxMacPortStateHelper help( (GrafPtr) GetWindowPort(m_window) ) ; @@ -401,4 +405,3 @@ void wxMacToolTip::Clear() } #endif - diff --git a/src/mac/classic/uma.cpp b/src/mac/classic/uma.cpp index 65799b4286..5f586ad85c 100644 --- a/src/mac/classic/uma.cpp +++ b/src/mac/classic/uma.cpp @@ -9,7 +9,11 @@ // Licence: The wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/defs.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif #if wxUSE_GUI -- 2.45.2