1. Made use system colors/fonts

2. Made able to use xpm's and honor xpm transparency


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
J. Russell Smyth 1999-03-14 00:26:08 +00:00
parent cb0f2f5446
commit 8a704c2b39
6 changed files with 59 additions and 55 deletions

View File

@ -122,8 +122,9 @@ wxTabbedWindow::wxTabbedWindow()
mBorderOnlyWidth( 8 ),
mWhitePen( wxColour(255,255,255), 1, wxSOLID ),
mGrayPen ( wxColour(192,192,192), 1, wxSOLID ),
mDarkPen ( wxColour(128,128,128), 1, wxSOLID ),
mLightPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID),
mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ),
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
// state variables
@ -321,7 +322,7 @@ void wxTabbedWindow::DrawDecorations( wxDC& dc )
// layer 1 (upper white)
DrawShadedRect( curX+0, curY+0, xSize-0, ySize-0,
mWhitePen, mBlackPen, dc );
mLightPen, mBlackPen, dc );
// layer 2 (upper gray)
DrawShadedRect( curX+1, curY+1, xSize-2-1, ySize-2-1,
@ -329,7 +330,7 @@ void wxTabbedWindow::DrawDecorations( wxDC& dc )
// layer 3 (upper darkGray)
DrawShadedRect( curX+2, curY+2, xSize-3-2, ySize-3-2,
mDarkPen, mWhitePen, dc );
mDarkPen, mLightPen, dc );
// layer 4 (upper black)
DrawShadedRect( curX+3, curY+3, xSize-4-3, ySize-4-3,
@ -365,7 +366,7 @@ void wxTabbedWindow::DrawDecorations( wxDC& dc )
dc.DrawLine( curX+1, curY-1, curX+xSize-2, curY-1 );
}
dc.SetPen( mWhitePen );
dc.SetPen( mLightPen );
if ( tabNo == mActiveTab )
dc.DrawLine( curX, curY-2, curX, curY+ySize-2 );
@ -401,7 +402,7 @@ void wxTabbedWindow::DrawDecorations( wxDC& dc )
curY + ( ySize - tab.ImgHeight() ) / 2,
tab.ImgWidth(),
tab.ImgHeight(),
&tmpDc, 0, 0, wxCOPY
&tmpDc, 0, 0, wxCOPY,true
);
}
@ -487,15 +488,16 @@ void wxTabbedWindow::HideInactiveTabs( bool andRepaint )
wxFont wxTabbedWindow::GetLabelingFont()
{
#if 0
wxFont font;
#ifdef __WINDOWS__
font.SetFaceName("MS Sans Serif");
#else
font.SetFamily( wxSWISS );
font.SetFamily( wxDEFAULT );
#endif
font.SetStyle(40);
font.SetWeight(40);
font.SetStyle(wxNORMAL);
font.SetWeight(wxNORMAL);
font.SetPointSize( 8 );
#ifdef __WINDOWS__
@ -503,6 +505,8 @@ wxFont wxTabbedWindow::GetLabelingFont()
#endif
return font;
#endif
return wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT);
}
void wxTabbedWindow::RecalcLayout(bool andRepaint)
@ -637,7 +641,7 @@ void wxTabbedWindow::OnPaint( wxPaintEvent& event )
void wxTabbedWindow::OnSize ( wxSizeEvent& event )
{
SetBackgroundColour( wxColour( 192,192,192 ) );
SetBackgroundColour( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) );
RecalcLayout(TRUE);
}
@ -685,7 +689,7 @@ wxPaggedWindow::wxPaggedWindow()
mTabTrianGap(4),
mWhiteBrush( wxColour(255,255,255), wxSOLID ),
mGrayBrush ( wxColour(192,192,192), wxSOLID ),
mGrayBrush ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), wxSOLID ),
mCurentRowOfs( 0 ),
mAdjustableTitleRowLen( 300 ),
@ -707,16 +711,17 @@ wxPaggedWindow::~wxPaggedWindow()
wxFont wxPaggedWindow::GetLabelingFont()
{
#if 0
wxFont font;
#ifdef __WINDOWS__
font.SetFaceName("Arial");
#else
font.SetFamily( wxSWISS );
font.SetFamily( wxDEFAULT );
#endif
font.SetStyle(40);
font.SetWeight(40);
font.SetStyle(wxNORMAL);
font.SetWeight(wxNORMAL);
font.SetPointSize( 8 );
#ifdef __WINDOWS__
@ -724,6 +729,8 @@ wxFont wxPaggedWindow::GetLabelingFont()
#endif
return font;
#endif
return wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT);
}
void wxPaggedWindow::OnTabAdded( twTabInfo* pInfo )
@ -803,7 +810,7 @@ void wxPaggedWindow::DrawPaperBar( twTabInfo& tab, int x, int y,
y + ( tab.mDims.y - tab.ImgHeight() ) / 2,
tab.ImgWidth(),
tab.ImgHeight(),
&tmpDc, 0, 0, wxCOPY
&tmpDc, 0, 0, wxCOPY,true
);
}
@ -830,7 +837,7 @@ void wxPaggedWindow::DrawDecorations( wxDC& dc )
int ySize = height - mVertGap*2;
DrawShadedRect( curX, curY, xSize, ySize,
mDarkPen, mWhitePen, dc );
mDarkPen, mLightPen, dc );
DrawShadedRect( curX+1, curY+1, xSize-2, ySize-2,
mBlackPen, mGrayPen, dc );
@ -891,7 +898,7 @@ void wxPaggedWindow::DrawDecorations( wxDC& dc )
{
DrawPaperBar( tab, curX, curY, mWhiteBrush, mBlackPen, tmpDc );
tmpDc.SetPen( mWhitePen );
tmpDc.SetPen( mLightPen );
tmpDc.DrawLine( curX - mTabTrianGap+1, curY,
curX + tab.mDims.x + mTabTrianGap, curY );
@ -912,7 +919,7 @@ void wxPaggedWindow::DrawDecorations( wxDC& dc )
curX = mTitleRowLen - 6;
DrawShadedRect( curX+0, 0+0, 6, mTitleHeight, mGrayPen, mBlackPen, tmpDc );
DrawShadedRect( curX+1, 0+1, 6-2, mTitleHeight-2, mWhitePen, mDarkPen, tmpDc );
DrawShadedRect( curX+1, 0+1, 6-2, mTitleHeight-2, mLightPen, mDarkPen, tmpDc );
DrawShadedRect( curX+2, 0+2, 6-4, mTitleHeight-4, mGrayPen, mGrayPen, tmpDc );

View File

@ -67,8 +67,9 @@ public:
// public properties (invoke ReclaclLayout(TRUE) to apply changes)
wxPen mWhitePen; // default: RGB(255,255,255)
wxPen mGrayPen; // default: RGB(192,192,192)
wxPen mDarkPen; // default: RGB(128,128,128)
wxPen mLightPen; // wxSYS_COLOUR_3DHIGHLIGHT
wxPen mGrayPen; // wxSYS_COLOUR_3DFACE
wxPen mDarkPen; // wxSYS_COLOUR_3DSHADOW
wxPen mBlackPen; // default: RGB( 0, 0, 0)
int mVertGap; // default: 3

View File

@ -232,11 +232,11 @@ wxFrameLayout::wxFrameLayout(void)
: mpFrame ( NULL ),
mpFrameClient( NULL ),
mDarkPen ( wxColour(128,128,128), 1, wxSOLID ),
mLightPen ( wxColour(255,255,255), 1, wxSOLID ),
mGrayPen ( wxColour(192,192,192), 1, wxSOLID ),
mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ),
mLightPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHILIGHT), 1, wxSOLID ),
mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mBlackPen ( wxColour( 0, 0, 0), 1, wxSOLID ),
mBorderPen( wxColour(192,192,192), 1, wxSOLID ),
mBorderPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mpPaneInFocus( NULL ),
mpLRUPane ( NULL ),
@ -245,9 +245,9 @@ wxFrameLayout::wxFrameLayout(void)
mpTopPlugin ( NULL ),
mpCaputesInput( NULL ),
mRecalcPending( TRUE ),
mCheckFocusWhenIdle( FALSE ),
mRecalcPending( TRUE ),
mClientWndRefreshPending( FALSE )
{
CreateCursors();
@ -264,11 +264,11 @@ wxFrameLayout::wxFrameLayout( wxWindow* pParentFrame, wxWindow* pFrameClient, bo
: mpFrame( pParentFrame ),
mpFrameClient(pFrameClient),
mDarkPen ( wxColour(128,128,128), 1, wxSOLID ),
mLightPen ( wxColour(255,255,255), 1, wxSOLID ),
mGrayPen ( wxColour(192,192,192), 1, wxSOLID ),
mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ),
mLightPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHILIGHT), 1, wxSOLID ),
mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mBlackPen ( wxColour( 0, 0, 0), 1, wxSOLID ),
mBorderPen( wxColour(192,192,192), 1, wxSOLID ),
mBorderPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mpPaneInFocus( NULL ),
mpLRUPane ( NULL ),
@ -301,7 +301,7 @@ wxFrameLayout::wxFrameLayout( wxWindow* pParentFrame, wxWindow* pFrameClient, bo
// DBG:: set RED color of frame's background for the
// prurpose of tracking engine bugs "visually"
GetParentFrame().SetBackgroundColour( wxColour(192,192,192) );
GetParentFrame().SetBackgroundColour( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) );
}
mFloatingOn = CanReparent();

View File

@ -148,11 +148,11 @@ public: /* protected really, acessed only by plugins and serializers */
// pens for decoration and shades
wxPen mDarkPen; // default wxColour(128,128,128)
wxPen mLightPen; // default white
wxPen mGrayPen; // default wxColour(192,192,192)
wxPen mDarkPen; // default wxSYS_COLOUR_3DSHADOW
wxPen mLightPen; // default wxSYS_COLOUR_3DHILIGHT
wxPen mGrayPen; // default wxSYS_COLOUR_3DFACE
wxPen mBlackPen; // default wxColour( 0, 0, 0)
wxPen mBorderPen; // default wxColour(128,192,192)
wxPen mBorderPen; // default wxSYS_COLOUR_3DFACE
wxPen mNullPen; // transparent pen

View File

@ -67,7 +67,7 @@ wxDynamicToolBar::wxDynamicToolBar(wxWindow *parent, const wxWindowID id,
{
Create(parent, id, pos, size, style, orientation, RowsOrColumns, name);
SetBackgroundColour( wxColour(192,192,192) );
SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE) );
}
bool wxDynamicToolBar::Create(wxWindow *parent, const wxWindowID id,
@ -82,7 +82,7 @@ bool wxDynamicToolBar::Create(wxWindow *parent, const wxWindowID id,
if ( ! wxWindow::Create(parent, id, pos, size, style, name) )
return FALSE;
SetBackgroundColour( wxColour( 192,192,192 ) );
SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ));
return TRUE;
}

View File

@ -152,8 +152,8 @@ void greay_out_image_on_dc( wxDC& dc, int width, int height )
wxColour bgCol;
dc.GetPixel( 0, 0, &bgCol );
wxPen darkPen ( wxColour(128,128,128),1, wxSOLID );
wxPen lightPen( wxColour(255,255,255),1, wxSOLID );
wxPen darkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW),1, wxSOLID );
wxPen lightPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT),1, wxSOLID );
wxPen bgPen ( bgCol, 1, wxSOLID );
int* src = create_array( width, height, MASK_BG );
@ -249,10 +249,9 @@ wxNewBitmapButton::wxNewBitmapButton( const wxBitmap& labelBitmap,
mTextToLabelGap ( textToLabelGap ),
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
mDarkPen ( wxColour(128,128,128), 1, wxSOLID ),
mGrayPen ( wxColour(192,192,192),
1, wxSOLID ),
mLightPen( wxColour(255,255,255), 1, wxSOLID ),
mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ),
mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mLightPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
mFiredEventType( firedEventType ),
mIsSticky( isSticky ),
@ -295,10 +294,9 @@ wxNewBitmapButton::wxNewBitmapButton( const wxString& bitmapFileName,
mTextToLabelGap ( 2 ),
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
mDarkPen ( wxColour(128,128,128), 1, wxSOLID ),
mGrayPen ( wxColour(192,192,192),
1, wxSOLID ),
mLightPen( wxColour(255,255,255), 1, wxSOLID ),
mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ),
mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mLightPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
mFiredEventType( wxEVT_COMMAND_MENU_SELECTED ),
mIsSticky( FALSE ),
@ -390,7 +388,6 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
wxMemoryDC srcDc;
srcDc.SelectObject( *srcBmp );
wxFont fnt( 9, wxDECORATIVE , wxNORMAL, wxNORMAL );
bool hasText = ( mTextAlignment != NB_NO_TEXT ) &&
( mLabelText.length() != 0 );
@ -405,7 +402,7 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
{
long txtWidth, txtHeight;
srcDc.SetFont( fnt );
srcDc.SetFont( wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT) );
srcDc.GetTextExtent( mLabelText, &txtWidth, &txtHeight );
if ( mTextAlignment == NB_ALIGN_TEXT_RIGHT )
@ -448,8 +445,7 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
wxMemoryDC destDc;
destDc.SelectObject( *destBmp );
// FOR NOW:: hard-coded label background
wxBrush grayBrush( wxColour(192,192,192), wxSOLID );
wxBrush grayBrush( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE), wxSOLID );
wxPen nullPen( wxColour(0,0,0), 1, wxTRANSPARENT );
destDc.SetBrush( grayBrush );
@ -468,7 +464,7 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
destDc.Blit( imgPos.x, imgPos.y,
srcBmp->GetWidth()+1,
srcBmp->GetHeight()+1,
&srcDc, 0,0, wxCOPY );
&srcDc, 0,0, wxCOPY,TRUE );
}
if ( hasText )
@ -484,11 +480,11 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
pTopWnd = pParent;
} while(1);
destDc.SetFont( fnt );
destDc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_SYSTEM_FONT) );
// FOR NOW:: hard-coded text colors
destDc.SetTextForeground( wxColour( 0, 0, 0) );
destDc.SetTextBackground( wxColour(192,192,192) );
// Should be wxSYS_COLOUR_BTNTEXT, but gtk gives white?
destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT) );
destDc.SetTextBackground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE) );
destDc.DrawText( mLabelText, txtPos.x, txtPos.y );
}