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
This commit is contained in:
Robert Roebling
2001-12-17 09:42:22 +00:00
parent d21d2e5adf
commit 00500f403c
5 changed files with 493 additions and 448 deletions

View File

@@ -127,6 +127,17 @@ void wxStatusBarGeneric::SetStatusText(const wxString& text, int number)
m_statusStrings[number] = text; m_statusStrings[number] = text;
#ifdef __WXMAC__
int major,minor;
wxGetOsVersion( &major, &minor );
if (major >= 10)
{
Refresh();
return;
}
#endif
wxRect rect; wxRect rect;
GetFieldRect(number, rect); GetFieldRect(number, rect);
wxClientDC dc(this); wxClientDC dc(this);

View File

@@ -6,7 +6,7 @@
// Created: ??/??/98 // Created: ??/??/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) AUTHOR // Copyright: (c) AUTHOR
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -15,73 +15,82 @@
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/utils.h"
wxColour wxSystemSettings::GetSystemColour(int index) wxColour wxSystemSettings::GetSystemColour(int index)
{ {
switch( index ) int major,minor;
{ wxGetOsVersion( &major, &minor );
case wxSYS_COLOUR_SCROLLBAR :
case wxSYS_COLOUR_BACKGROUND: switch( index )
case wxSYS_COLOUR_ACTIVECAPTION: {
case wxSYS_COLOUR_INACTIVECAPTION: case wxSYS_COLOUR_SCROLLBAR :
case wxSYS_COLOUR_MENU: case wxSYS_COLOUR_BACKGROUND:
case wxSYS_COLOUR_WINDOW: case wxSYS_COLOUR_ACTIVECAPTION:
case wxSYS_COLOUR_WINDOWFRAME: case wxSYS_COLOUR_INACTIVECAPTION:
case wxSYS_COLOUR_ACTIVEBORDER: case wxSYS_COLOUR_MENU:
case wxSYS_COLOUR_INACTIVEBORDER: case wxSYS_COLOUR_WINDOW:
case wxSYS_COLOUR_BTNFACE: case wxSYS_COLOUR_WINDOWFRAME:
return wxColor( 0xDD , 0xDD , 0xDD ) ; case wxSYS_COLOUR_ACTIVEBORDER:
break ; case wxSYS_COLOUR_INACTIVEBORDER:
case wxSYS_COLOUR_BTNFACE:
return wxColor( 0xDD , 0xDD , 0xDD ) ;
break ;
case wxSYS_COLOUR_LISTBOX : case wxSYS_COLOUR_LISTBOX :
return wxColor( 0xEE , 0xEE , 0xEE ) ; {
break ; if (major >= 10)
case wxSYS_COLOUR_BTNSHADOW: return *wxWHITE ;
return wxColor( 0x44 , 0x44 , 0x44 ) ; else
break ; return wxColor( 0xEE , 0xEE , 0xEE ) ;
break ;
}
case wxSYS_COLOUR_BTNSHADOW:
return wxColor( 0x44 , 0x44 , 0x44 ) ;
break ;
case wxSYS_COLOUR_BTNTEXT: case wxSYS_COLOUR_BTNTEXT:
case wxSYS_COLOUR_MENUTEXT: case wxSYS_COLOUR_MENUTEXT:
case wxSYS_COLOUR_WINDOWTEXT: case wxSYS_COLOUR_WINDOWTEXT:
case wxSYS_COLOUR_CAPTIONTEXT: case wxSYS_COLOUR_CAPTIONTEXT:
case wxSYS_COLOUR_INFOTEXT: case wxSYS_COLOUR_INFOTEXT:
case wxSYS_COLOUR_INACTIVECAPTIONTEXT: case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
return *wxBLACK; return *wxBLACK;
break ; break ;
case wxSYS_COLOUR_HIGHLIGHT: case wxSYS_COLOUR_HIGHLIGHT:
{ {
RGBColor hilite ; RGBColor hilite ;
LMGetHiliteRGB(&hilite) ; LMGetHiliteRGB(&hilite) ;
return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ; return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ;
} }
break ; break ;
case wxSYS_COLOUR_BTNHIGHLIGHT: case wxSYS_COLOUR_BTNHIGHLIGHT:
case wxSYS_COLOUR_GRAYTEXT: case wxSYS_COLOUR_GRAYTEXT:
return wxColor( 0xCC , 0xCC , 0xCC ) ; return wxColor( 0xCC , 0xCC , 0xCC ) ;
break ; break ;
case wxSYS_COLOUR_3DDKSHADOW: case wxSYS_COLOUR_3DDKSHADOW:
return wxColor( 0x44 , 0x44 , 0x44 ) ; return wxColor( 0x44 , 0x44 , 0x44 ) ;
break ; break ;
case wxSYS_COLOUR_3DLIGHT: case wxSYS_COLOUR_3DLIGHT:
return wxColor( 0xCC , 0xCC , 0xCC ) ; return wxColor( 0xCC , 0xCC , 0xCC ) ;
break ; break ;
case wxSYS_COLOUR_HIGHLIGHTTEXT : case wxSYS_COLOUR_HIGHLIGHTTEXT :
{ {
RGBColor hilite ; RGBColor hilite ;
LMGetHiliteRGB(&hilite) ; LMGetHiliteRGB(&hilite) ;
if ( ( hilite.red + hilite.green + hilite.blue ) == 0 ) if ( ( hilite.red + hilite.green + hilite.blue ) == 0 )
return *wxWHITE ; return *wxWHITE ;
else else
return *wxBLACK ; return *wxBLACK ;
} }
break ; break ;
case wxSYS_COLOUR_INFOBK : case wxSYS_COLOUR_INFOBK :
case wxSYS_COLOUR_APPWORKSPACE: case wxSYS_COLOUR_APPWORKSPACE:
return *wxWHITE ; return *wxWHITE ;
break ; break ;
} }
return *wxWHITE; return *wxWHITE;
} }
wxFont wxSystemSettings::GetSystemFont(int index) wxFont wxSystemSettings::GetSystemFont(int index)
@@ -92,19 +101,19 @@ wxFont wxSystemSettings::GetSystemFont(int index)
case wxSYS_SYSTEM_FONT : case wxSYS_SYSTEM_FONT :
case wxSYS_DEVICE_DEFAULT_FONT : case wxSYS_DEVICE_DEFAULT_FONT :
case wxSYS_DEFAULT_GUI_FONT : case wxSYS_DEFAULT_GUI_FONT :
{ {
return *wxSMALL_FONT ; return *wxSMALL_FONT ;
} ; } ;
break ; break ;
case wxSYS_OEM_FIXED_FONT : case wxSYS_OEM_FIXED_FONT :
case wxSYS_ANSI_FIXED_FONT : case wxSYS_ANSI_FIXED_FONT :
case wxSYS_SYSTEM_FIXED_FONT : case wxSYS_SYSTEM_FIXED_FONT :
default : default :
{ {
return *wxNORMAL_FONT ; return *wxNORMAL_FONT ;
} ; } ;
break ; break ;
} }
return *wxNORMAL_FONT; return *wxNORMAL_FONT;
} }
@@ -112,112 +121,112 @@ wxFont wxSystemSettings::GetSystemFont(int index)
// Get a system metric, e.g. scrollbar size // Get a system metric, e.g. scrollbar size
int wxSystemSettings::GetSystemMetric(int index) int wxSystemSettings::GetSystemMetric(int index)
{ {
switch ( index) switch ( index)
{ {
case wxSYS_MOUSE_BUTTONS: 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: case wxSYS_BORDER_X:
// TODO // TODO
return 0; return 0;
case wxSYS_BORDER_Y: case wxSYS_BORDER_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_CURSOR_X: case wxSYS_CURSOR_X:
// TODO // TODO
return 0; return 0;
case wxSYS_CURSOR_Y: case wxSYS_CURSOR_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_DCLICK_X: case wxSYS_DCLICK_X:
// TODO // TODO
return 0; return 0;
case wxSYS_DCLICK_Y: case wxSYS_DCLICK_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_DRAG_X: case wxSYS_DRAG_X:
// TODO // TODO
return 0; return 0;
case wxSYS_DRAG_Y: case wxSYS_DRAG_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_EDGE_X: case wxSYS_EDGE_X:
// TODO // TODO
return 0; return 0;
case wxSYS_EDGE_Y: case wxSYS_EDGE_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_HSCROLL_ARROW_X: case wxSYS_HSCROLL_ARROW_X:
return 16; return 16;
case wxSYS_HSCROLL_ARROW_Y: case wxSYS_HSCROLL_ARROW_Y:
return 16; return 16;
case wxSYS_HTHUMB_X: case wxSYS_HTHUMB_X:
return 16; return 16;
case wxSYS_ICON_X: case wxSYS_ICON_X:
// TODO // TODO
return 0; return 0;
case wxSYS_ICON_Y: case wxSYS_ICON_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_ICONSPACING_X: case wxSYS_ICONSPACING_X:
// TODO // TODO
return 0; return 0;
case wxSYS_ICONSPACING_Y: case wxSYS_ICONSPACING_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_WINDOWMIN_X: case wxSYS_WINDOWMIN_X:
// TODO // TODO
return 0; return 0;
case wxSYS_WINDOWMIN_Y: case wxSYS_WINDOWMIN_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_SCREEN_X: case wxSYS_SCREEN_X:
// TODO // TODO
return 0; return 0;
case wxSYS_SCREEN_Y: case wxSYS_SCREEN_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_FRAMESIZE_X: case wxSYS_FRAMESIZE_X:
// TODO // TODO
return 0; return 0;
case wxSYS_FRAMESIZE_Y: case wxSYS_FRAMESIZE_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_SMALLICON_X: case wxSYS_SMALLICON_X:
// TODO // TODO
return 0; return 0;
case wxSYS_SMALLICON_Y: case wxSYS_SMALLICON_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_HSCROLL_Y: case wxSYS_HSCROLL_Y:
return 16; return 16;
case wxSYS_VSCROLL_X: case wxSYS_VSCROLL_X:
return 16; return 16;
case wxSYS_VSCROLL_ARROW_X: case wxSYS_VSCROLL_ARROW_X:
return 16; return 16;
case wxSYS_VSCROLL_ARROW_Y: case wxSYS_VSCROLL_ARROW_Y:
return 16; return 16;
case wxSYS_VTHUMB_Y: case wxSYS_VTHUMB_Y:
return 16; return 16;
case wxSYS_CAPTION_Y: case wxSYS_CAPTION_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_MENU_Y: case wxSYS_MENU_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_NETWORK_PRESENT: case wxSYS_NETWORK_PRESENT:
// TODO // TODO
return 0; return 0;
case wxSYS_PENWINDOWS_PRESENT: case wxSYS_PENWINDOWS_PRESENT:
return 0; return 0;
case wxSYS_SHOW_SOUNDS: case wxSYS_SHOW_SOUNDS:
// TODO // TODO
return 0; return 0;
case wxSYS_SWAP_BUTTONS: case wxSYS_SWAP_BUTTONS:
return 0; return 0;
default: default:
return 0; return 0;
} }
return 0; return 0;
} }
bool wxSystemSettings::GetCapability(int index) bool wxSystemSettings::GetCapability(int index)

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) AUTHOR // Copyright: (c) AUTHOR
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -19,6 +19,7 @@
#include "wx/tabctrl.h" #include "wx/tabctrl.h"
#include "wx/dc.h" #include "wx/dc.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/utils.h"
#include <stdio.h> #include <stdio.h>
@@ -44,15 +45,15 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
m_foregroundColour = parent->GetForegroundColour() ; m_foregroundColour = parent->GetForegroundColour() ;
if ( id == -1 ) if ( id == -1 )
m_windowId = (int)NewControlId(); m_windowId = (int)NewControlId();
else else
m_windowId = id; m_windowId = id;
m_windowStyle = style; m_windowStyle = style;
m_label = label ; m_label = label ;
bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
SetBestSize( size ) ; SetBestSize( size ) ;
return ret; return ret;
} }
@@ -68,58 +69,58 @@ void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph)
bool linedrawn = true; bool linedrawn = true;
while( paragraph.Length() > 0 ) while( paragraph.Length() > 0 )
{ {
dc.GetTextExtent( paragraph , &width , &height ) ; dc.GetTextExtent( paragraph , &width , &height ) ;
if ( width > m_width ) if ( width > m_width )
{ {
for ( int p = paragraph.Length() -1 ; p > 0 ; --p ) for ( int p = paragraph.Length() -1 ; p > 0 ; --p )
{ {
if ((punct.Find(paragraph[p]) != wxNOT_FOUND) || !linedrawn) if ((punct.Find(paragraph[p]) != wxNOT_FOUND) || !linedrawn)
{ {
int blank = (paragraph[p] == ' ') ? 0 : 1; int blank = (paragraph[p] == ' ') ? 0 : 1;
dc.GetTextExtent( paragraph.Left(p + blank) , &width , &height ) ; dc.GetTextExtent( paragraph.Left(p + blank) , &width , &height ) ;
if ( width <= m_width ) if ( width <= m_width )
{ {
int pos = x ; int pos = x ;
if ( HasFlag( wxALIGN_CENTER ) ) if ( HasFlag( wxALIGN_CENTER ) )
{ {
pos += ( m_width - width ) / 2 ; pos += ( m_width - width ) / 2 ;
} }
else if ( HasFlag( wxALIGN_RIGHT ) ) else if ( HasFlag( wxALIGN_RIGHT ) )
{ {
pos += ( m_width - width ) ; pos += ( m_width - width ) ;
} }
dc.DrawText( paragraph.Left(p + blank), pos , y) ; dc.DrawText( paragraph.Left(p + blank), pos , y) ;
y += height ; y += height ;
paragraph = paragraph.Mid(p+1) ; paragraph = paragraph.Mid(p+1) ;
linedrawn = true; linedrawn = true;
break ; break ;
} }
} }
} }
linedrawn = false; linedrawn = false;
} }
else else
{ {
int pos = x ; int pos = x ;
if ( HasFlag( wxALIGN_CENTER ) ) if ( HasFlag( wxALIGN_CENTER ) )
{ {
pos += ( m_width - width ) / 2 ; pos += ( m_width - width ) / 2 ;
} }
else if ( HasFlag( wxALIGN_RIGHT ) ) else if ( HasFlag( wxALIGN_RIGHT ) )
{ {
pos += ( m_width - width ) ; pos += ( m_width - width ) ;
} }
dc.DrawText( paragraph, pos , y) ; dc.DrawText( paragraph, pos , y) ;
paragraph=""; paragraph="";
y += height ; y += height ;
} }
} }
} }
void wxStaticText::OnDraw( wxDC &dc ) void wxStaticText::OnDraw( wxDC &dc )
@@ -127,58 +128,65 @@ void wxStaticText::OnDraw( wxDC &dc )
if (m_width <= 0 || m_height <= 0) if (m_width <= 0 || m_height <= 0)
return; return;
wxString paragraph; wxString paragraph;
int i = 0 ; int i = 0 ;
wxString text = m_label; wxString text = m_label;
int major,minor;
wxGetOsVersion( &major, &minor );
PrepareDC(dc); PrepareDC(dc);
bool doClear = true ; bool doClear = true ;
WindowRef window = GetMacRootWindow() ; WindowRef window = GetMacRootWindow() ;
if ( window ) if ( window )
{ {
wxWindow* win = wxFindWinFromMacWindow( window ) ; wxWindow* win = wxFindWinFromMacWindow( window ) ;
if ( win ) if ( win )
{ {
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
while ( parent ) while ( parent )
{ {
if( parent->MacGetWindowData() ) if( parent->MacGetWindowData() )
{ {
break ; break ;
} }
if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) if (major < 10)
{ {
if ( ((wxControl*)parent)->GetMacControl() ) { if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
Rect rect = { -10000 , -10000 , 10000 , 10000 } ; // MacOS X was having a coord rollover {
if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress ) if ( ((wxControl*)parent)->GetMacControl() ) {
{ Rect rect = { -10000 , -10000 , 10000 , 10000 } ; // MacOS X was having a coord rollover
DrawThemeTabPane ( &rect, kThemeStateActive); if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress )
doClear = false ; {
} DrawThemeTabPane ( &rect, kThemeStateActive);
} doClear = false ;
break ; }
} }
break ;
parent = parent->GetParent() ; }
} }
}
} parent = parent->GetParent() ;
if ( doClear ) }
dc.Clear() ; }
}
while (i < text.Length())
{ if ( (major < 10) && doClear )
paragraph += text[i]; dc.Clear() ;
if (text[i] == 13 || text[i] == 10) while (i < text.Length())
DrawParagraph(dc, paragraph); {
paragraph += text[i];
if (text[i] == 13 || text[i] == 10)
DrawParagraph(dc, paragraph);
++i; ++i;
} }
if (paragraph.Length() > 0) if (paragraph.Length() > 0)
DrawParagraph(dc, paragraph); DrawParagraph(dc, paragraph);
} }
void wxStaticText::OnPaint( wxPaintEvent &event ) void wxStaticText::OnPaint( wxPaintEvent &event )
@@ -189,7 +197,7 @@ void wxStaticText::OnPaint( wxPaintEvent &event )
wxSize wxStaticText::DoGetBestSize() const wxSize wxStaticText::DoGetBestSize() const
{ {
int x,y ; int x,y ;
int widthTextMax = 0, widthLine, int widthTextMax = 0, widthLine,
heightTextTotal = 0, heightLineDefault = 0, heightLine = 0; heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
@@ -240,13 +248,13 @@ wxSize wxStaticText::DoGetBestSize() const
void wxStaticText::SetLabel(const wxString& st ) void wxStaticText::SetLabel(const wxString& st )
{ {
SetTitle( st ) ; SetTitle( st ) ;
m_label = st ; m_label = st ;
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
SetSize( GetBestSize() ) ; SetSize( GetBestSize() ) ;
Refresh() ; Refresh() ;
MacUpdateImmediately() ; MacUpdateImmediately() ;
// wxClientDC dc(this); // wxClientDC dc(this);
// OnDraw( dc ) ; // OnDraw( dc ) ;
} }

View File

@@ -6,7 +6,7 @@
// Created: ??/??/98 // Created: ??/??/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) AUTHOR // Copyright: (c) AUTHOR
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -15,73 +15,82 @@
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/utils.h"
wxColour wxSystemSettings::GetSystemColour(int index) wxColour wxSystemSettings::GetSystemColour(int index)
{ {
switch( index ) int major,minor;
{ wxGetOsVersion( &major, &minor );
case wxSYS_COLOUR_SCROLLBAR :
case wxSYS_COLOUR_BACKGROUND: switch( index )
case wxSYS_COLOUR_ACTIVECAPTION: {
case wxSYS_COLOUR_INACTIVECAPTION: case wxSYS_COLOUR_SCROLLBAR :
case wxSYS_COLOUR_MENU: case wxSYS_COLOUR_BACKGROUND:
case wxSYS_COLOUR_WINDOW: case wxSYS_COLOUR_ACTIVECAPTION:
case wxSYS_COLOUR_WINDOWFRAME: case wxSYS_COLOUR_INACTIVECAPTION:
case wxSYS_COLOUR_ACTIVEBORDER: case wxSYS_COLOUR_MENU:
case wxSYS_COLOUR_INACTIVEBORDER: case wxSYS_COLOUR_WINDOW:
case wxSYS_COLOUR_BTNFACE: case wxSYS_COLOUR_WINDOWFRAME:
return wxColor( 0xDD , 0xDD , 0xDD ) ; case wxSYS_COLOUR_ACTIVEBORDER:
break ; case wxSYS_COLOUR_INACTIVEBORDER:
case wxSYS_COLOUR_BTNFACE:
return wxColor( 0xDD , 0xDD , 0xDD ) ;
break ;
case wxSYS_COLOUR_LISTBOX : case wxSYS_COLOUR_LISTBOX :
return wxColor( 0xEE , 0xEE , 0xEE ) ; {
break ; if (major >= 10)
case wxSYS_COLOUR_BTNSHADOW: return *wxWHITE ;
return wxColor( 0x44 , 0x44 , 0x44 ) ; else
break ; return wxColor( 0xEE , 0xEE , 0xEE ) ;
break ;
}
case wxSYS_COLOUR_BTNSHADOW:
return wxColor( 0x44 , 0x44 , 0x44 ) ;
break ;
case wxSYS_COLOUR_BTNTEXT: case wxSYS_COLOUR_BTNTEXT:
case wxSYS_COLOUR_MENUTEXT: case wxSYS_COLOUR_MENUTEXT:
case wxSYS_COLOUR_WINDOWTEXT: case wxSYS_COLOUR_WINDOWTEXT:
case wxSYS_COLOUR_CAPTIONTEXT: case wxSYS_COLOUR_CAPTIONTEXT:
case wxSYS_COLOUR_INFOTEXT: case wxSYS_COLOUR_INFOTEXT:
case wxSYS_COLOUR_INACTIVECAPTIONTEXT: case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
return *wxBLACK; return *wxBLACK;
break ; break ;
case wxSYS_COLOUR_HIGHLIGHT: case wxSYS_COLOUR_HIGHLIGHT:
{ {
RGBColor hilite ; RGBColor hilite ;
LMGetHiliteRGB(&hilite) ; LMGetHiliteRGB(&hilite) ;
return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ; return wxColor( hilite.red >> 8 , hilite.green >> 8 , hilite.blue >> 8 ) ;
} }
break ; break ;
case wxSYS_COLOUR_BTNHIGHLIGHT: case wxSYS_COLOUR_BTNHIGHLIGHT:
case wxSYS_COLOUR_GRAYTEXT: case wxSYS_COLOUR_GRAYTEXT:
return wxColor( 0xCC , 0xCC , 0xCC ) ; return wxColor( 0xCC , 0xCC , 0xCC ) ;
break ; break ;
case wxSYS_COLOUR_3DDKSHADOW: case wxSYS_COLOUR_3DDKSHADOW:
return wxColor( 0x44 , 0x44 , 0x44 ) ; return wxColor( 0x44 , 0x44 , 0x44 ) ;
break ; break ;
case wxSYS_COLOUR_3DLIGHT: case wxSYS_COLOUR_3DLIGHT:
return wxColor( 0xCC , 0xCC , 0xCC ) ; return wxColor( 0xCC , 0xCC , 0xCC ) ;
break ; break ;
case wxSYS_COLOUR_HIGHLIGHTTEXT : case wxSYS_COLOUR_HIGHLIGHTTEXT :
{ {
RGBColor hilite ; RGBColor hilite ;
LMGetHiliteRGB(&hilite) ; LMGetHiliteRGB(&hilite) ;
if ( ( hilite.red + hilite.green + hilite.blue ) == 0 ) if ( ( hilite.red + hilite.green + hilite.blue ) == 0 )
return *wxWHITE ; return *wxWHITE ;
else else
return *wxBLACK ; return *wxBLACK ;
} }
break ; break ;
case wxSYS_COLOUR_INFOBK : case wxSYS_COLOUR_INFOBK :
case wxSYS_COLOUR_APPWORKSPACE: case wxSYS_COLOUR_APPWORKSPACE:
return *wxWHITE ; return *wxWHITE ;
break ; break ;
} }
return *wxWHITE; return *wxWHITE;
} }
wxFont wxSystemSettings::GetSystemFont(int index) wxFont wxSystemSettings::GetSystemFont(int index)
@@ -92,19 +101,19 @@ wxFont wxSystemSettings::GetSystemFont(int index)
case wxSYS_SYSTEM_FONT : case wxSYS_SYSTEM_FONT :
case wxSYS_DEVICE_DEFAULT_FONT : case wxSYS_DEVICE_DEFAULT_FONT :
case wxSYS_DEFAULT_GUI_FONT : case wxSYS_DEFAULT_GUI_FONT :
{ {
return *wxSMALL_FONT ; return *wxSMALL_FONT ;
} ; } ;
break ; break ;
case wxSYS_OEM_FIXED_FONT : case wxSYS_OEM_FIXED_FONT :
case wxSYS_ANSI_FIXED_FONT : case wxSYS_ANSI_FIXED_FONT :
case wxSYS_SYSTEM_FIXED_FONT : case wxSYS_SYSTEM_FIXED_FONT :
default : default :
{ {
return *wxNORMAL_FONT ; return *wxNORMAL_FONT ;
} ; } ;
break ; break ;
} }
return *wxNORMAL_FONT; return *wxNORMAL_FONT;
} }
@@ -112,112 +121,112 @@ wxFont wxSystemSettings::GetSystemFont(int index)
// Get a system metric, e.g. scrollbar size // Get a system metric, e.g. scrollbar size
int wxSystemSettings::GetSystemMetric(int index) int wxSystemSettings::GetSystemMetric(int index)
{ {
switch ( index) switch ( index)
{ {
case wxSYS_MOUSE_BUTTONS: 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: case wxSYS_BORDER_X:
// TODO // TODO
return 0; return 0;
case wxSYS_BORDER_Y: case wxSYS_BORDER_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_CURSOR_X: case wxSYS_CURSOR_X:
// TODO // TODO
return 0; return 0;
case wxSYS_CURSOR_Y: case wxSYS_CURSOR_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_DCLICK_X: case wxSYS_DCLICK_X:
// TODO // TODO
return 0; return 0;
case wxSYS_DCLICK_Y: case wxSYS_DCLICK_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_DRAG_X: case wxSYS_DRAG_X:
// TODO // TODO
return 0; return 0;
case wxSYS_DRAG_Y: case wxSYS_DRAG_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_EDGE_X: case wxSYS_EDGE_X:
// TODO // TODO
return 0; return 0;
case wxSYS_EDGE_Y: case wxSYS_EDGE_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_HSCROLL_ARROW_X: case wxSYS_HSCROLL_ARROW_X:
return 16; return 16;
case wxSYS_HSCROLL_ARROW_Y: case wxSYS_HSCROLL_ARROW_Y:
return 16; return 16;
case wxSYS_HTHUMB_X: case wxSYS_HTHUMB_X:
return 16; return 16;
case wxSYS_ICON_X: case wxSYS_ICON_X:
// TODO // TODO
return 0; return 0;
case wxSYS_ICON_Y: case wxSYS_ICON_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_ICONSPACING_X: case wxSYS_ICONSPACING_X:
// TODO // TODO
return 0; return 0;
case wxSYS_ICONSPACING_Y: case wxSYS_ICONSPACING_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_WINDOWMIN_X: case wxSYS_WINDOWMIN_X:
// TODO // TODO
return 0; return 0;
case wxSYS_WINDOWMIN_Y: case wxSYS_WINDOWMIN_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_SCREEN_X: case wxSYS_SCREEN_X:
// TODO // TODO
return 0; return 0;
case wxSYS_SCREEN_Y: case wxSYS_SCREEN_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_FRAMESIZE_X: case wxSYS_FRAMESIZE_X:
// TODO // TODO
return 0; return 0;
case wxSYS_FRAMESIZE_Y: case wxSYS_FRAMESIZE_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_SMALLICON_X: case wxSYS_SMALLICON_X:
// TODO // TODO
return 0; return 0;
case wxSYS_SMALLICON_Y: case wxSYS_SMALLICON_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_HSCROLL_Y: case wxSYS_HSCROLL_Y:
return 16; return 16;
case wxSYS_VSCROLL_X: case wxSYS_VSCROLL_X:
return 16; return 16;
case wxSYS_VSCROLL_ARROW_X: case wxSYS_VSCROLL_ARROW_X:
return 16; return 16;
case wxSYS_VSCROLL_ARROW_Y: case wxSYS_VSCROLL_ARROW_Y:
return 16; return 16;
case wxSYS_VTHUMB_Y: case wxSYS_VTHUMB_Y:
return 16; return 16;
case wxSYS_CAPTION_Y: case wxSYS_CAPTION_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_MENU_Y: case wxSYS_MENU_Y:
// TODO // TODO
return 0; return 0;
case wxSYS_NETWORK_PRESENT: case wxSYS_NETWORK_PRESENT:
// TODO // TODO
return 0; return 0;
case wxSYS_PENWINDOWS_PRESENT: case wxSYS_PENWINDOWS_PRESENT:
return 0; return 0;
case wxSYS_SHOW_SOUNDS: case wxSYS_SHOW_SOUNDS:
// TODO // TODO
return 0; return 0;
case wxSYS_SWAP_BUTTONS: case wxSYS_SWAP_BUTTONS:
return 0; return 0;
default: default:
return 0; return 0;
} }
return 0; return 0;
} }
bool wxSystemSettings::GetCapability(int index) bool wxSystemSettings::GetCapability(int index)

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) AUTHOR // Copyright: (c) AUTHOR
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -19,6 +19,7 @@
#include "wx/tabctrl.h" #include "wx/tabctrl.h"
#include "wx/dc.h" #include "wx/dc.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/utils.h"
#include <stdio.h> #include <stdio.h>
@@ -44,15 +45,15 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
m_foregroundColour = parent->GetForegroundColour() ; m_foregroundColour = parent->GetForegroundColour() ;
if ( id == -1 ) if ( id == -1 )
m_windowId = (int)NewControlId(); m_windowId = (int)NewControlId();
else else
m_windowId = id; m_windowId = id;
m_windowStyle = style; m_windowStyle = style;
m_label = label ; m_label = label ;
bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
SetBestSize( size ) ; SetBestSize( size ) ;
return ret; return ret;
} }
@@ -68,58 +69,58 @@ void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph)
bool linedrawn = true; bool linedrawn = true;
while( paragraph.Length() > 0 ) while( paragraph.Length() > 0 )
{ {
dc.GetTextExtent( paragraph , &width , &height ) ; dc.GetTextExtent( paragraph , &width , &height ) ;
if ( width > m_width ) if ( width > m_width )
{ {
for ( int p = paragraph.Length() -1 ; p > 0 ; --p ) for ( int p = paragraph.Length() -1 ; p > 0 ; --p )
{ {
if ((punct.Find(paragraph[p]) != wxNOT_FOUND) || !linedrawn) if ((punct.Find(paragraph[p]) != wxNOT_FOUND) || !linedrawn)
{ {
int blank = (paragraph[p] == ' ') ? 0 : 1; int blank = (paragraph[p] == ' ') ? 0 : 1;
dc.GetTextExtent( paragraph.Left(p + blank) , &width , &height ) ; dc.GetTextExtent( paragraph.Left(p + blank) , &width , &height ) ;
if ( width <= m_width ) if ( width <= m_width )
{ {
int pos = x ; int pos = x ;
if ( HasFlag( wxALIGN_CENTER ) ) if ( HasFlag( wxALIGN_CENTER ) )
{ {
pos += ( m_width - width ) / 2 ; pos += ( m_width - width ) / 2 ;
} }
else if ( HasFlag( wxALIGN_RIGHT ) ) else if ( HasFlag( wxALIGN_RIGHT ) )
{ {
pos += ( m_width - width ) ; pos += ( m_width - width ) ;
} }
dc.DrawText( paragraph.Left(p + blank), pos , y) ; dc.DrawText( paragraph.Left(p + blank), pos , y) ;
y += height ; y += height ;
paragraph = paragraph.Mid(p+1) ; paragraph = paragraph.Mid(p+1) ;
linedrawn = true; linedrawn = true;
break ; break ;
} }
} }
} }
linedrawn = false; linedrawn = false;
} }
else else
{ {
int pos = x ; int pos = x ;
if ( HasFlag( wxALIGN_CENTER ) ) if ( HasFlag( wxALIGN_CENTER ) )
{ {
pos += ( m_width - width ) / 2 ; pos += ( m_width - width ) / 2 ;
} }
else if ( HasFlag( wxALIGN_RIGHT ) ) else if ( HasFlag( wxALIGN_RIGHT ) )
{ {
pos += ( m_width - width ) ; pos += ( m_width - width ) ;
} }
dc.DrawText( paragraph, pos , y) ; dc.DrawText( paragraph, pos , y) ;
paragraph=""; paragraph="";
y += height ; y += height ;
} }
} }
} }
void wxStaticText::OnDraw( wxDC &dc ) void wxStaticText::OnDraw( wxDC &dc )
@@ -127,58 +128,65 @@ void wxStaticText::OnDraw( wxDC &dc )
if (m_width <= 0 || m_height <= 0) if (m_width <= 0 || m_height <= 0)
return; return;
wxString paragraph; wxString paragraph;
int i = 0 ; int i = 0 ;
wxString text = m_label; wxString text = m_label;
int major,minor;
wxGetOsVersion( &major, &minor );
PrepareDC(dc); PrepareDC(dc);
bool doClear = true ; bool doClear = true ;
WindowRef window = GetMacRootWindow() ; WindowRef window = GetMacRootWindow() ;
if ( window ) if ( window )
{ {
wxWindow* win = wxFindWinFromMacWindow( window ) ; wxWindow* win = wxFindWinFromMacWindow( window ) ;
if ( win ) if ( win )
{ {
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
while ( parent ) while ( parent )
{ {
if( parent->MacGetWindowData() ) if( parent->MacGetWindowData() )
{ {
break ; break ;
} }
if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) if (major < 10)
{ {
if ( ((wxControl*)parent)->GetMacControl() ) { if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
Rect rect = { -10000 , -10000 , 10000 , 10000 } ; // MacOS X was having a coord rollover {
if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress ) if ( ((wxControl*)parent)->GetMacControl() ) {
{ Rect rect = { -10000 , -10000 , 10000 , 10000 } ; // MacOS X was having a coord rollover
DrawThemeTabPane ( &rect, kThemeStateActive); if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress )
doClear = false ; {
} DrawThemeTabPane ( &rect, kThemeStateActive);
} doClear = false ;
break ; }
} }
break ;
parent = parent->GetParent() ; }
} }
}
} parent = parent->GetParent() ;
if ( doClear ) }
dc.Clear() ; }
}
while (i < text.Length())
{ if ( (major < 10) && doClear )
paragraph += text[i]; dc.Clear() ;
if (text[i] == 13 || text[i] == 10) while (i < text.Length())
DrawParagraph(dc, paragraph); {
paragraph += text[i];
if (text[i] == 13 || text[i] == 10)
DrawParagraph(dc, paragraph);
++i; ++i;
} }
if (paragraph.Length() > 0) if (paragraph.Length() > 0)
DrawParagraph(dc, paragraph); DrawParagraph(dc, paragraph);
} }
void wxStaticText::OnPaint( wxPaintEvent &event ) void wxStaticText::OnPaint( wxPaintEvent &event )
@@ -189,7 +197,7 @@ void wxStaticText::OnPaint( wxPaintEvent &event )
wxSize wxStaticText::DoGetBestSize() const wxSize wxStaticText::DoGetBestSize() const
{ {
int x,y ; int x,y ;
int widthTextMax = 0, widthLine, int widthTextMax = 0, widthLine,
heightTextTotal = 0, heightLineDefault = 0, heightLine = 0; heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
@@ -240,13 +248,13 @@ wxSize wxStaticText::DoGetBestSize() const
void wxStaticText::SetLabel(const wxString& st ) void wxStaticText::SetLabel(const wxString& st )
{ {
SetTitle( st ) ; SetTitle( st ) ;
m_label = st ; m_label = st ;
if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) )
SetSize( GetBestSize() ) ; SetSize( GetBestSize() ) ;
Refresh() ; Refresh() ;
MacUpdateImmediately() ; MacUpdateImmediately() ;
// wxClientDC dc(this); // wxClientDC dc(this);
// OnDraw( dc ) ; // OnDraw( dc ) ;
} }