From 00500f403cff8f1596157337b23fe2b40d51452b Mon Sep 17 00:00:00 2001 From: Robert Roebling <robert@roebling.de> Date: Mon, 17 Dec 2001 09:42:22 +0000 Subject: [PATCH] MAcOS X clears the background (with stripes) for us, so there is no need to do it again. This solves to optical bugs for the wxStatusBar and wxStaticText. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13055 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/statusbr.cpp | 11 ++ src/mac/carbon/settings.cpp | 239 +++++++++++++++++++----------------- src/mac/carbon/stattext.cpp | 226 ++++++++++++++++++---------------- src/mac/settings.cpp | 239 +++++++++++++++++++----------------- src/mac/stattext.cpp | 226 ++++++++++++++++++---------------- 5 files changed, 493 insertions(+), 448 deletions(-) diff --git a/src/generic/statusbr.cpp b/src/generic/statusbr.cpp index d8fb78c69d..c433a1dfde 100644 --- a/src/generic/statusbr.cpp +++ b/src/generic/statusbr.cpp @@ -127,6 +127,17 @@ void wxStatusBarGeneric::SetStatusText(const wxString& text, int number) m_statusStrings[number] = text; +#ifdef __WXMAC__ + int major,minor; + wxGetOsVersion( &major, &minor ); + + if (major >= 10) + { + Refresh(); + return; + } +#endif + wxRect rect; GetFieldRect(number, rect); wxClientDC dc(this); diff --git a/src/mac/carbon/settings.cpp b/src/mac/carbon/settings.cpp index dcfe365753..b272f5f5dd 100644 --- a/src/mac/carbon/settings.cpp +++ b/src/mac/carbon/settings.cpp @@ -6,7 +6,7 @@ // Created: ??/??/98 // RCS-ID: $Id$ // Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -15,73 +15,82 @@ #include "wx/settings.h" #include "wx/gdicmn.h" +#include "wx/utils.h" wxColour wxSystemSettings::GetSystemColour(int index) { - switch( index ) - { - case wxSYS_COLOUR_SCROLLBAR : - case wxSYS_COLOUR_BACKGROUND: - case wxSYS_COLOUR_ACTIVECAPTION: - case wxSYS_COLOUR_INACTIVECAPTION: - case wxSYS_COLOUR_MENU: - case wxSYS_COLOUR_WINDOW: - case wxSYS_COLOUR_WINDOWFRAME: - case wxSYS_COLOUR_ACTIVEBORDER: - case wxSYS_COLOUR_INACTIVEBORDER: - case wxSYS_COLOUR_BTNFACE: - return wxColor( 0xDD , 0xDD , 0xDD ) ; - break ; + int major,minor; + wxGetOsVersion( &major, &minor ); + + switch( index ) + { + case wxSYS_COLOUR_SCROLLBAR : + case wxSYS_COLOUR_BACKGROUND: + case wxSYS_COLOUR_ACTIVECAPTION: + case wxSYS_COLOUR_INACTIVECAPTION: + case wxSYS_COLOUR_MENU: + case wxSYS_COLOUR_WINDOW: + case wxSYS_COLOUR_WINDOWFRAME: + case wxSYS_COLOUR_ACTIVEBORDER: + case wxSYS_COLOUR_INACTIVEBORDER: + case wxSYS_COLOUR_BTNFACE: + return wxColor( 0xDD , 0xDD , 0xDD ) ; + break ; - case wxSYS_COLOUR_LISTBOX : - return wxColor( 0xEE , 0xEE , 0xEE ) ; - break ; - case wxSYS_COLOUR_BTNSHADOW: - return wxColor( 0x44 , 0x44 , 0x44 ) ; - break ; + case wxSYS_COLOUR_LISTBOX : + { + if (major >= 10) + return *wxWHITE ; + else + return wxColor( 0xEE , 0xEE , 0xEE ) ; + break ; + } + case wxSYS_COLOUR_BTNSHADOW: + return wxColor( 0x44 , 0x44 , 0x44 ) ; + break ; - case wxSYS_COLOUR_BTNTEXT: - case wxSYS_COLOUR_MENUTEXT: - case wxSYS_COLOUR_WINDOWTEXT: - case wxSYS_COLOUR_CAPTIONTEXT: - case wxSYS_COLOUR_INFOTEXT: - case wxSYS_COLOUR_INACTIVECAPTIONTEXT: - return *wxBLACK; - break ; - case wxSYS_COLOUR_HIGHLIGHT: - { - RGBColor hilite ; - LMGetHiliteRGB(&hilite) ; - return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ; - } - break ; - case wxSYS_COLOUR_BTNHIGHLIGHT: - case wxSYS_COLOUR_GRAYTEXT: - return wxColor( 0xCC , 0xCC , 0xCC ) ; - break ; - - case wxSYS_COLOUR_3DDKSHADOW: - return wxColor( 0x44 , 0x44 , 0x44 ) ; - break ; - case wxSYS_COLOUR_3DLIGHT: - return wxColor( 0xCC , 0xCC , 0xCC ) ; - break ; - case wxSYS_COLOUR_HIGHLIGHTTEXT : - { - RGBColor hilite ; - LMGetHiliteRGB(&hilite) ; - if ( ( hilite.red + hilite.green + hilite.blue ) == 0 ) - return *wxWHITE ; - else - return *wxBLACK ; - } - break ; - case wxSYS_COLOUR_INFOBK : - case wxSYS_COLOUR_APPWORKSPACE: - return *wxWHITE ; - break ; - } - return *wxWHITE; + case wxSYS_COLOUR_BTNTEXT: + case wxSYS_COLOUR_MENUTEXT: + case wxSYS_COLOUR_WINDOWTEXT: + case wxSYS_COLOUR_CAPTIONTEXT: + case wxSYS_COLOUR_INFOTEXT: + case wxSYS_COLOUR_INACTIVECAPTIONTEXT: + return *wxBLACK; + break ; + case wxSYS_COLOUR_HIGHLIGHT: + { + RGBColor hilite ; + LMGetHiliteRGB(&hilite) ; + return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ; + } + break ; + case wxSYS_COLOUR_BTNHIGHLIGHT: + case wxSYS_COLOUR_GRAYTEXT: + return wxColor( 0xCC , 0xCC , 0xCC ) ; + break ; + + case wxSYS_COLOUR_3DDKSHADOW: + return wxColor( 0x44 , 0x44 , 0x44 ) ; + break ; + case wxSYS_COLOUR_3DLIGHT: + return wxColor( 0xCC , 0xCC , 0xCC ) ; + break ; + case wxSYS_COLOUR_HIGHLIGHTTEXT : + { + RGBColor hilite ; + LMGetHiliteRGB(&hilite) ; + if ( ( hilite.red + hilite.green + hilite.blue ) == 0 ) + return *wxWHITE ; + else + return *wxBLACK ; + } + break ; + case wxSYS_COLOUR_INFOBK : + case wxSYS_COLOUR_APPWORKSPACE: + return *wxWHITE ; + break ; + } + return *wxWHITE; } wxFont wxSystemSettings::GetSystemFont(int index) @@ -92,19 +101,19 @@ wxFont wxSystemSettings::GetSystemFont(int index) case wxSYS_SYSTEM_FONT : case wxSYS_DEVICE_DEFAULT_FONT : case wxSYS_DEFAULT_GUI_FONT : - { - return *wxSMALL_FONT ; - } ; - break ; + { + return *wxSMALL_FONT ; + } ; + break ; case wxSYS_OEM_FIXED_FONT : case wxSYS_ANSI_FIXED_FONT : case wxSYS_SYSTEM_FIXED_FONT : default : - { - return *wxNORMAL_FONT ; - } ; - break ; - + { + return *wxNORMAL_FONT ; + } ; + break ; + } return *wxNORMAL_FONT; } @@ -112,112 +121,112 @@ wxFont wxSystemSettings::GetSystemFont(int index) // Get a system metric, e.g. scrollbar size int wxSystemSettings::GetSystemMetric(int index) { - switch ( index) - { + switch ( index) + { case wxSYS_MOUSE_BUTTONS: - return 2; // we emulate a two button mouse (ctrl + click = right button ) + return 2; // we emulate a two button mouse (ctrl + click = right button ) case wxSYS_BORDER_X: // TODO - return 0; + return 0; case wxSYS_BORDER_Y: // TODO - return 0; + return 0; case wxSYS_CURSOR_X: // TODO - return 0; + return 0; case wxSYS_CURSOR_Y: // TODO - return 0; + return 0; case wxSYS_DCLICK_X: // TODO - return 0; + return 0; case wxSYS_DCLICK_Y: // TODO - return 0; + return 0; case wxSYS_DRAG_X: // TODO - return 0; + return 0; case wxSYS_DRAG_Y: // TODO - return 0; + return 0; case wxSYS_EDGE_X: // TODO - return 0; + return 0; case wxSYS_EDGE_Y: // TODO - return 0; + return 0; case wxSYS_HSCROLL_ARROW_X: - return 16; + return 16; case wxSYS_HSCROLL_ARROW_Y: - return 16; + return 16; case wxSYS_HTHUMB_X: - return 16; + return 16; case wxSYS_ICON_X: // TODO - return 0; + return 0; case wxSYS_ICON_Y: // TODO - return 0; + return 0; case wxSYS_ICONSPACING_X: // TODO - return 0; + return 0; case wxSYS_ICONSPACING_Y: // TODO - return 0; + return 0; case wxSYS_WINDOWMIN_X: // TODO - return 0; + return 0; case wxSYS_WINDOWMIN_Y: // TODO - return 0; + return 0; case wxSYS_SCREEN_X: // TODO - return 0; + return 0; case wxSYS_SCREEN_Y: // TODO - return 0; + return 0; case wxSYS_FRAMESIZE_X: // TODO - return 0; + return 0; case wxSYS_FRAMESIZE_Y: // TODO - return 0; + return 0; case wxSYS_SMALLICON_X: // TODO - return 0; + return 0; case wxSYS_SMALLICON_Y: // TODO - return 0; + return 0; case wxSYS_HSCROLL_Y: - return 16; + return 16; case wxSYS_VSCROLL_X: - return 16; + return 16; case wxSYS_VSCROLL_ARROW_X: - return 16; + return 16; case wxSYS_VSCROLL_ARROW_Y: - return 16; + return 16; case wxSYS_VTHUMB_Y: - return 16; + return 16; case wxSYS_CAPTION_Y: // TODO - return 0; + return 0; case wxSYS_MENU_Y: // TODO - return 0; + return 0; case wxSYS_NETWORK_PRESENT: // TODO - return 0; + return 0; case wxSYS_PENWINDOWS_PRESENT: - return 0; + return 0; case wxSYS_SHOW_SOUNDS: // TODO - return 0; + return 0; case wxSYS_SWAP_BUTTONS: - return 0; - default: - return 0; - } - return 0; + return 0; + default: + return 0; + } + return 0; } bool wxSystemSettings::GetCapability(int index) diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index 8f78cc60ff..62e095f5fa 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -19,6 +19,7 @@ #include "wx/tabctrl.h" #include "wx/dc.h" #include "wx/dcclient.h" +#include "wx/utils.h" #include <stdio.h> @@ -44,15 +45,15 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, m_foregroundColour = parent->GetForegroundColour() ; if ( id == -1 ) - m_windowId = (int)NewControlId(); + m_windowId = (int)NewControlId(); else - m_windowId = id; + m_windowId = id; m_windowStyle = style; m_label = label ; - bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); - SetBestSize( size ) ; + bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); + SetBestSize( size ) ; return ret; } @@ -68,58 +69,58 @@ void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph) bool linedrawn = true; while( paragraph.Length() > 0 ) { - dc.GetTextExtent( paragraph , &width , &height ) ; - - if ( width > m_width ) - { - for ( int p = paragraph.Length() -1 ; p > 0 ; --p ) - { - if ((punct.Find(paragraph[p]) != wxNOT_FOUND) || !linedrawn) - { - int blank = (paragraph[p] == ' ') ? 0 : 1; - - dc.GetTextExtent( paragraph.Left(p + blank) , &width , &height ) ; - - if ( width <= m_width ) - { - int pos = x ; - if ( HasFlag( wxALIGN_CENTER ) ) - { - pos += ( m_width - width ) / 2 ; - } - else if ( HasFlag( wxALIGN_RIGHT ) ) - { - pos += ( m_width - width ) ; - } - - dc.DrawText( paragraph.Left(p + blank), pos , y) ; - y += height ; - paragraph = paragraph.Mid(p+1) ; - linedrawn = true; - break ; - } - } - } - - linedrawn = false; - } - else - { - int pos = x ; - if ( HasFlag( wxALIGN_CENTER ) ) - { - pos += ( m_width - width ) / 2 ; - } - else if ( HasFlag( wxALIGN_RIGHT ) ) - { - pos += ( m_width - width ) ; - } - - dc.DrawText( paragraph, pos , y) ; - paragraph=""; - y += height ; - } - } + dc.GetTextExtent( paragraph , &width , &height ) ; + + if ( width > m_width ) + { + for ( int p = paragraph.Length() -1 ; p > 0 ; --p ) + { + if ((punct.Find(paragraph[p]) != wxNOT_FOUND) || !linedrawn) + { + int blank = (paragraph[p] == ' ') ? 0 : 1; + + dc.GetTextExtent( paragraph.Left(p + blank) , &width , &height ) ; + + if ( width <= m_width ) + { + int pos = x ; + if ( HasFlag( wxALIGN_CENTER ) ) + { + pos += ( m_width - width ) / 2 ; + } + else if ( HasFlag( wxALIGN_RIGHT ) ) + { + pos += ( m_width - width ) ; + } + + dc.DrawText( paragraph.Left(p + blank), pos , y) ; + y += height ; + paragraph = paragraph.Mid(p+1) ; + linedrawn = true; + break ; + } + } + } + + linedrawn = false; + } + else + { + int pos = x ; + if ( HasFlag( wxALIGN_CENTER ) ) + { + pos += ( m_width - width ) / 2 ; + } + else if ( HasFlag( wxALIGN_RIGHT ) ) + { + pos += ( m_width - width ) ; + } + + dc.DrawText( paragraph, pos , y) ; + paragraph=""; + y += height ; + } + } } void wxStaticText::OnDraw( wxDC &dc ) @@ -127,58 +128,65 @@ void wxStaticText::OnDraw( wxDC &dc ) if (m_width <= 0 || m_height <= 0) return; - wxString paragraph; - int i = 0 ; - wxString text = m_label; + wxString paragraph; + int i = 0 ; + wxString text = m_label; + + int major,minor; + wxGetOsVersion( &major, &minor ); PrepareDC(dc); bool doClear = true ; - WindowRef window = GetMacRootWindow() ; - if ( window ) - { - wxWindow* win = wxFindWinFromMacWindow( window ) ; - if ( win ) - { - wxWindow* parent = GetParent() ; - while ( parent ) - { - if( parent->MacGetWindowData() ) - { - break ; - } - - if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) - { - if ( ((wxControl*)parent)->GetMacControl() ) { - Rect rect = { -10000 , -10000 , 10000 , 10000 } ; // MacOS X was having a coord rollover - if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress ) - { - DrawThemeTabPane ( &rect, kThemeStateActive); - doClear = false ; - } - } - break ; - } - - parent = parent->GetParent() ; - } - } - } - if ( doClear ) - dc.Clear() ; - - while (i < text.Length()) - { - paragraph += text[i]; - - if (text[i] == 13 || text[i] == 10) - DrawParagraph(dc, paragraph); - + WindowRef window = GetMacRootWindow() ; + if ( window ) + { + wxWindow* win = wxFindWinFromMacWindow( window ) ; + if ( win ) + { + wxWindow* parent = GetParent() ; + while ( parent ) + { + if( parent->MacGetWindowData() ) + { + break ; + } + + if (major < 10) + { + if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) + { + if ( ((wxControl*)parent)->GetMacControl() ) { + Rect rect = { -10000 , -10000 , 10000 , 10000 } ; // MacOS X was having a coord rollover + if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress ) + { + DrawThemeTabPane ( &rect, kThemeStateActive); + doClear = false ; + } + } + break ; + } + } + + parent = parent->GetParent() ; + } + } + } + + if ( (major < 10) && doClear ) + dc.Clear() ; + + while (i < text.Length()) + { + paragraph += text[i]; + + if (text[i] == 13 || text[i] == 10) + DrawParagraph(dc, paragraph); + ++i; } if (paragraph.Length() > 0) - DrawParagraph(dc, paragraph); + DrawParagraph(dc, paragraph); } void wxStaticText::OnPaint( wxPaintEvent &event ) @@ -189,7 +197,7 @@ void wxStaticText::OnPaint( wxPaintEvent &event ) wxSize wxStaticText::DoGetBestSize() const { - int x,y ; + int x,y ; int widthTextMax = 0, widthLine, heightTextTotal = 0, heightLineDefault = 0, heightLine = 0; @@ -240,13 +248,13 @@ wxSize wxStaticText::DoGetBestSize() const void wxStaticText::SetLabel(const wxString& st ) { - SetTitle( st ) ; - m_label = st ; - if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) - SetSize( GetBestSize() ) ; + SetTitle( st ) ; + m_label = st ; + if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) + SetSize( GetBestSize() ) ; - Refresh() ; - MacUpdateImmediately() ; + Refresh() ; + MacUpdateImmediately() ; // wxClientDC dc(this); // OnDraw( dc ) ; } diff --git a/src/mac/settings.cpp b/src/mac/settings.cpp index dcfe365753..b272f5f5dd 100644 --- a/src/mac/settings.cpp +++ b/src/mac/settings.cpp @@ -6,7 +6,7 @@ // Created: ??/??/98 // RCS-ID: $Id$ // Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -15,73 +15,82 @@ #include "wx/settings.h" #include "wx/gdicmn.h" +#include "wx/utils.h" wxColour wxSystemSettings::GetSystemColour(int index) { - switch( index ) - { - case wxSYS_COLOUR_SCROLLBAR : - case wxSYS_COLOUR_BACKGROUND: - case wxSYS_COLOUR_ACTIVECAPTION: - case wxSYS_COLOUR_INACTIVECAPTION: - case wxSYS_COLOUR_MENU: - case wxSYS_COLOUR_WINDOW: - case wxSYS_COLOUR_WINDOWFRAME: - case wxSYS_COLOUR_ACTIVEBORDER: - case wxSYS_COLOUR_INACTIVEBORDER: - case wxSYS_COLOUR_BTNFACE: - return wxColor( 0xDD , 0xDD , 0xDD ) ; - break ; + int major,minor; + wxGetOsVersion( &major, &minor ); + + switch( index ) + { + case wxSYS_COLOUR_SCROLLBAR : + case wxSYS_COLOUR_BACKGROUND: + case wxSYS_COLOUR_ACTIVECAPTION: + case wxSYS_COLOUR_INACTIVECAPTION: + case wxSYS_COLOUR_MENU: + case wxSYS_COLOUR_WINDOW: + case wxSYS_COLOUR_WINDOWFRAME: + case wxSYS_COLOUR_ACTIVEBORDER: + case wxSYS_COLOUR_INACTIVEBORDER: + case wxSYS_COLOUR_BTNFACE: + return wxColor( 0xDD , 0xDD , 0xDD ) ; + break ; - case wxSYS_COLOUR_LISTBOX : - return wxColor( 0xEE , 0xEE , 0xEE ) ; - break ; - case wxSYS_COLOUR_BTNSHADOW: - return wxColor( 0x44 , 0x44 , 0x44 ) ; - break ; + case wxSYS_COLOUR_LISTBOX : + { + if (major >= 10) + return *wxWHITE ; + else + return wxColor( 0xEE , 0xEE , 0xEE ) ; + break ; + } + case wxSYS_COLOUR_BTNSHADOW: + return wxColor( 0x44 , 0x44 , 0x44 ) ; + break ; - case wxSYS_COLOUR_BTNTEXT: - case wxSYS_COLOUR_MENUTEXT: - case wxSYS_COLOUR_WINDOWTEXT: - case wxSYS_COLOUR_CAPTIONTEXT: - case wxSYS_COLOUR_INFOTEXT: - case wxSYS_COLOUR_INACTIVECAPTIONTEXT: - return *wxBLACK; - break ; - case wxSYS_COLOUR_HIGHLIGHT: - { - RGBColor hilite ; - LMGetHiliteRGB(&hilite) ; - return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ; - } - break ; - case wxSYS_COLOUR_BTNHIGHLIGHT: - case wxSYS_COLOUR_GRAYTEXT: - return wxColor( 0xCC , 0xCC , 0xCC ) ; - break ; - - case wxSYS_COLOUR_3DDKSHADOW: - return wxColor( 0x44 , 0x44 , 0x44 ) ; - break ; - case wxSYS_COLOUR_3DLIGHT: - return wxColor( 0xCC , 0xCC , 0xCC ) ; - break ; - case wxSYS_COLOUR_HIGHLIGHTTEXT : - { - RGBColor hilite ; - LMGetHiliteRGB(&hilite) ; - if ( ( hilite.red + hilite.green + hilite.blue ) == 0 ) - return *wxWHITE ; - else - return *wxBLACK ; - } - break ; - case wxSYS_COLOUR_INFOBK : - case wxSYS_COLOUR_APPWORKSPACE: - return *wxWHITE ; - break ; - } - return *wxWHITE; + case wxSYS_COLOUR_BTNTEXT: + case wxSYS_COLOUR_MENUTEXT: + case wxSYS_COLOUR_WINDOWTEXT: + case wxSYS_COLOUR_CAPTIONTEXT: + case wxSYS_COLOUR_INFOTEXT: + case wxSYS_COLOUR_INACTIVECAPTIONTEXT: + return *wxBLACK; + break ; + case wxSYS_COLOUR_HIGHLIGHT: + { + RGBColor hilite ; + LMGetHiliteRGB(&hilite) ; + return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ; + } + break ; + case wxSYS_COLOUR_BTNHIGHLIGHT: + case wxSYS_COLOUR_GRAYTEXT: + return wxColor( 0xCC , 0xCC , 0xCC ) ; + break ; + + case wxSYS_COLOUR_3DDKSHADOW: + return wxColor( 0x44 , 0x44 , 0x44 ) ; + break ; + case wxSYS_COLOUR_3DLIGHT: + return wxColor( 0xCC , 0xCC , 0xCC ) ; + break ; + case wxSYS_COLOUR_HIGHLIGHTTEXT : + { + RGBColor hilite ; + LMGetHiliteRGB(&hilite) ; + if ( ( hilite.red + hilite.green + hilite.blue ) == 0 ) + return *wxWHITE ; + else + return *wxBLACK ; + } + break ; + case wxSYS_COLOUR_INFOBK : + case wxSYS_COLOUR_APPWORKSPACE: + return *wxWHITE ; + break ; + } + return *wxWHITE; } wxFont wxSystemSettings::GetSystemFont(int index) @@ -92,19 +101,19 @@ wxFont wxSystemSettings::GetSystemFont(int index) case wxSYS_SYSTEM_FONT : case wxSYS_DEVICE_DEFAULT_FONT : case wxSYS_DEFAULT_GUI_FONT : - { - return *wxSMALL_FONT ; - } ; - break ; + { + return *wxSMALL_FONT ; + } ; + break ; case wxSYS_OEM_FIXED_FONT : case wxSYS_ANSI_FIXED_FONT : case wxSYS_SYSTEM_FIXED_FONT : default : - { - return *wxNORMAL_FONT ; - } ; - break ; - + { + return *wxNORMAL_FONT ; + } ; + break ; + } return *wxNORMAL_FONT; } @@ -112,112 +121,112 @@ wxFont wxSystemSettings::GetSystemFont(int index) // Get a system metric, e.g. scrollbar size int wxSystemSettings::GetSystemMetric(int index) { - switch ( index) - { + switch ( index) + { case wxSYS_MOUSE_BUTTONS: - return 2; // we emulate a two button mouse (ctrl + click = right button ) + return 2; // we emulate a two button mouse (ctrl + click = right button ) case wxSYS_BORDER_X: // TODO - return 0; + return 0; case wxSYS_BORDER_Y: // TODO - return 0; + return 0; case wxSYS_CURSOR_X: // TODO - return 0; + return 0; case wxSYS_CURSOR_Y: // TODO - return 0; + return 0; case wxSYS_DCLICK_X: // TODO - return 0; + return 0; case wxSYS_DCLICK_Y: // TODO - return 0; + return 0; case wxSYS_DRAG_X: // TODO - return 0; + return 0; case wxSYS_DRAG_Y: // TODO - return 0; + return 0; case wxSYS_EDGE_X: // TODO - return 0; + return 0; case wxSYS_EDGE_Y: // TODO - return 0; + return 0; case wxSYS_HSCROLL_ARROW_X: - return 16; + return 16; case wxSYS_HSCROLL_ARROW_Y: - return 16; + return 16; case wxSYS_HTHUMB_X: - return 16; + return 16; case wxSYS_ICON_X: // TODO - return 0; + return 0; case wxSYS_ICON_Y: // TODO - return 0; + return 0; case wxSYS_ICONSPACING_X: // TODO - return 0; + return 0; case wxSYS_ICONSPACING_Y: // TODO - return 0; + return 0; case wxSYS_WINDOWMIN_X: // TODO - return 0; + return 0; case wxSYS_WINDOWMIN_Y: // TODO - return 0; + return 0; case wxSYS_SCREEN_X: // TODO - return 0; + return 0; case wxSYS_SCREEN_Y: // TODO - return 0; + return 0; case wxSYS_FRAMESIZE_X: // TODO - return 0; + return 0; case wxSYS_FRAMESIZE_Y: // TODO - return 0; + return 0; case wxSYS_SMALLICON_X: // TODO - return 0; + return 0; case wxSYS_SMALLICON_Y: // TODO - return 0; + return 0; case wxSYS_HSCROLL_Y: - return 16; + return 16; case wxSYS_VSCROLL_X: - return 16; + return 16; case wxSYS_VSCROLL_ARROW_X: - return 16; + return 16; case wxSYS_VSCROLL_ARROW_Y: - return 16; + return 16; case wxSYS_VTHUMB_Y: - return 16; + return 16; case wxSYS_CAPTION_Y: // TODO - return 0; + return 0; case wxSYS_MENU_Y: // TODO - return 0; + return 0; case wxSYS_NETWORK_PRESENT: // TODO - return 0; + return 0; case wxSYS_PENWINDOWS_PRESENT: - return 0; + return 0; case wxSYS_SHOW_SOUNDS: // TODO - return 0; + return 0; case wxSYS_SWAP_BUTTONS: - return 0; - default: - return 0; - } - return 0; + return 0; + default: + return 0; + } + return 0; } bool wxSystemSettings::GetCapability(int index) diff --git a/src/mac/stattext.cpp b/src/mac/stattext.cpp index 8f78cc60ff..62e095f5fa 100644 --- a/src/mac/stattext.cpp +++ b/src/mac/stattext.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -19,6 +19,7 @@ #include "wx/tabctrl.h" #include "wx/dc.h" #include "wx/dcclient.h" +#include "wx/utils.h" #include <stdio.h> @@ -44,15 +45,15 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, m_foregroundColour = parent->GetForegroundColour() ; if ( id == -1 ) - m_windowId = (int)NewControlId(); + m_windowId = (int)NewControlId(); else - m_windowId = id; + m_windowId = id; m_windowStyle = style; m_label = label ; - bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); - SetBestSize( size ) ; + bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); + SetBestSize( size ) ; return ret; } @@ -68,58 +69,58 @@ void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph) bool linedrawn = true; while( paragraph.Length() > 0 ) { - dc.GetTextExtent( paragraph , &width , &height ) ; - - if ( width > m_width ) - { - for ( int p = paragraph.Length() -1 ; p > 0 ; --p ) - { - if ((punct.Find(paragraph[p]) != wxNOT_FOUND) || !linedrawn) - { - int blank = (paragraph[p] == ' ') ? 0 : 1; - - dc.GetTextExtent( paragraph.Left(p + blank) , &width , &height ) ; - - if ( width <= m_width ) - { - int pos = x ; - if ( HasFlag( wxALIGN_CENTER ) ) - { - pos += ( m_width - width ) / 2 ; - } - else if ( HasFlag( wxALIGN_RIGHT ) ) - { - pos += ( m_width - width ) ; - } - - dc.DrawText( paragraph.Left(p + blank), pos , y) ; - y += height ; - paragraph = paragraph.Mid(p+1) ; - linedrawn = true; - break ; - } - } - } - - linedrawn = false; - } - else - { - int pos = x ; - if ( HasFlag( wxALIGN_CENTER ) ) - { - pos += ( m_width - width ) / 2 ; - } - else if ( HasFlag( wxALIGN_RIGHT ) ) - { - pos += ( m_width - width ) ; - } - - dc.DrawText( paragraph, pos , y) ; - paragraph=""; - y += height ; - } - } + dc.GetTextExtent( paragraph , &width , &height ) ; + + if ( width > m_width ) + { + for ( int p = paragraph.Length() -1 ; p > 0 ; --p ) + { + if ((punct.Find(paragraph[p]) != wxNOT_FOUND) || !linedrawn) + { + int blank = (paragraph[p] == ' ') ? 0 : 1; + + dc.GetTextExtent( paragraph.Left(p + blank) , &width , &height ) ; + + if ( width <= m_width ) + { + int pos = x ; + if ( HasFlag( wxALIGN_CENTER ) ) + { + pos += ( m_width - width ) / 2 ; + } + else if ( HasFlag( wxALIGN_RIGHT ) ) + { + pos += ( m_width - width ) ; + } + + dc.DrawText( paragraph.Left(p + blank), pos , y) ; + y += height ; + paragraph = paragraph.Mid(p+1) ; + linedrawn = true; + break ; + } + } + } + + linedrawn = false; + } + else + { + int pos = x ; + if ( HasFlag( wxALIGN_CENTER ) ) + { + pos += ( m_width - width ) / 2 ; + } + else if ( HasFlag( wxALIGN_RIGHT ) ) + { + pos += ( m_width - width ) ; + } + + dc.DrawText( paragraph, pos , y) ; + paragraph=""; + y += height ; + } + } } void wxStaticText::OnDraw( wxDC &dc ) @@ -127,58 +128,65 @@ void wxStaticText::OnDraw( wxDC &dc ) if (m_width <= 0 || m_height <= 0) return; - wxString paragraph; - int i = 0 ; - wxString text = m_label; + wxString paragraph; + int i = 0 ; + wxString text = m_label; + + int major,minor; + wxGetOsVersion( &major, &minor ); PrepareDC(dc); bool doClear = true ; - WindowRef window = GetMacRootWindow() ; - if ( window ) - { - wxWindow* win = wxFindWinFromMacWindow( window ) ; - if ( win ) - { - wxWindow* parent = GetParent() ; - while ( parent ) - { - if( parent->MacGetWindowData() ) - { - break ; - } - - if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) - { - if ( ((wxControl*)parent)->GetMacControl() ) { - Rect rect = { -10000 , -10000 , 10000 , 10000 } ; // MacOS X was having a coord rollover - if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress ) - { - DrawThemeTabPane ( &rect, kThemeStateActive); - doClear = false ; - } - } - break ; - } - - parent = parent->GetParent() ; - } - } - } - if ( doClear ) - dc.Clear() ; - - while (i < text.Length()) - { - paragraph += text[i]; - - if (text[i] == 13 || text[i] == 10) - DrawParagraph(dc, paragraph); - + WindowRef window = GetMacRootWindow() ; + if ( window ) + { + wxWindow* win = wxFindWinFromMacWindow( window ) ; + if ( win ) + { + wxWindow* parent = GetParent() ; + while ( parent ) + { + if( parent->MacGetWindowData() ) + { + break ; + } + + if (major < 10) + { + if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) + { + if ( ((wxControl*)parent)->GetMacControl() ) { + Rect rect = { -10000 , -10000 , 10000 , 10000 } ; // MacOS X was having a coord rollover + if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress ) + { + DrawThemeTabPane ( &rect, kThemeStateActive); + doClear = false ; + } + } + break ; + } + } + + parent = parent->GetParent() ; + } + } + } + + if ( (major < 10) && doClear ) + dc.Clear() ; + + while (i < text.Length()) + { + paragraph += text[i]; + + if (text[i] == 13 || text[i] == 10) + DrawParagraph(dc, paragraph); + ++i; } if (paragraph.Length() > 0) - DrawParagraph(dc, paragraph); + DrawParagraph(dc, paragraph); } void wxStaticText::OnPaint( wxPaintEvent &event ) @@ -189,7 +197,7 @@ void wxStaticText::OnPaint( wxPaintEvent &event ) wxSize wxStaticText::DoGetBestSize() const { - int x,y ; + int x,y ; int widthTextMax = 0, widthLine, heightTextTotal = 0, heightLineDefault = 0, heightLine = 0; @@ -240,13 +248,13 @@ wxSize wxStaticText::DoGetBestSize() const void wxStaticText::SetLabel(const wxString& st ) { - SetTitle( st ) ; - m_label = st ; - if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) - SetSize( GetBestSize() ) ; + SetTitle( st ) ; + m_label = st ; + if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) + SetSize( GetBestSize() ) ; - Refresh() ; - MacUpdateImmediately() ; + Refresh() ; + MacUpdateImmediately() ; // wxClientDC dc(this); // OnDraw( dc ) ; } -- 2.47.2