// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#define GET_RED(col) col & 0xFF
-#define GET_GREEN(col) (col >> 8) & 0xFF
-#define GET_BLUE(col) (col >> 16) & 0xFF
+#define GET_RED(col) col & 0xFF
+#define GET_GREEN(col) (col >> 8) & 0xFF
+#define GET_BLUE(col) (col >> 16) & 0xFF
#define MAKE_INT_COLOR(red,green,blue) ( (red) | \
( ( (green) << 8 ) & 0xFF00 ) | \
( ( (blue) << 16) & 0xFF0000) \
#define MAKE_INT_COLOR(red,green,blue) ( (red) | \
( ( (green) << 8 ) & 0xFF00 ) | \
( ( (blue) << 16) & 0xFF0000) \
#define IS_GREATER(col1,col2) ( ( (GET_RED(col1) ) > (GET_RED(col2) ) + MIN_COLOR_DIFF ) && \
( (GET_GREEN(col1)) > (GET_GREEN(col2)) + MIN_COLOR_DIFF ) && \
#define IS_GREATER(col1,col2) ( ( (GET_RED(col1) ) > (GET_RED(col2) ) + MIN_COLOR_DIFF ) && \
( (GET_GREEN(col1)) > (GET_GREEN(col2)) + MIN_COLOR_DIFF ) && \
GET_ELEM(dest,x,y) = MASK_BG;
if ( GET_ELEM(dest,x-1,y-1 ) == MASK_DARK )
GET_ELEM(dest,x,y) = MASK_BG;
if ( GET_ELEM(dest,x-1,y-1 ) == MASK_DARK )
- mDragStarted ( FALSE ),
- mIsPressed ( FALSE ),
- mIsInFocus ( FALSE ),
- mIsToggled ( FALSE ),
- mHasFocusedBmp( FALSE ),
+ mDragStarted ( false ),
+ mIsPressed ( false ),
+ mIsInFocus ( false ),
+ mIsToggled ( false ),
+ mHasFocusedBmp( false ),
mFiredEventType( firedEventType ),
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
mFiredEventType( firedEventType ),
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mLightPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mLightPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
- mDragStarted ( FALSE ),
- mIsPressed ( FALSE ),
- mIsInFocus ( FALSE ),
- mIsToggled ( FALSE ),
- mHasFocusedBmp( FALSE ),
+ mDragStarted ( false ),
+ mIsPressed ( false ),
+ mIsInFocus ( false ),
+ mIsToggled ( false ),
+ mHasFocusedBmp( false ),
mFiredEventType( wxEVT_COMMAND_MENU_SELECTED ),
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
mFiredEventType( wxEVT_COMMAND_MENU_SELECTED ),
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mLightPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
mGrayPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
mLightPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
int height = pBmp->GetHeight() + (outerLevel + 2)*2 - 1;
int width = pBmp->GetWidth() + (outerLevel + 2)*2 - 1;
int height = pBmp->GetHeight() + (outerLevel + 2)*2 - 1;
int width = pBmp->GetWidth() + (outerLevel + 2)*2 - 1;
dc.SetPen( upperLeftSidePen );
dc.DrawLine( x,y, x + width, y );
dc.DrawLine( x,y, x, y + height );
dc.SetPen( upperLeftSidePen );
dc.DrawLine( x,y, x + width, y );
dc.DrawLine( x,y, x, y + height );
+ dc.DrawLine( x,y+1, x + width , y +1 ); // top
+ dc.DrawLine( x+1,y, x+1, y + height ); // left
dc.SetPen( lowerRightSidePen );
dc.DrawLine( x + width, y, x + width, y + height + 1 );
dc.DrawLine( x, y + height, x + width, y + height );
dc.SetPen( lowerRightSidePen );
dc.DrawLine( x + width, y, x + width, y + height + 1 );
dc.DrawLine( x, y + height, x + width, y + height );
+ dc.DrawLine( x + width-1, y+1, x + width-1, y + height +1 ); // right
+ dc.DrawLine( x +1, y + height-1, x + width, y + height-1 ); // bottom
static const unsigned char _gDisableImage[] = { 0x55,0xAA,0x55,0xAA,
0x55,0xAA,0x55,0xAA,
0x55,0xAA,0x55,0xAA,
0x55,0xAA,0x55,0xAA
};
static const unsigned char _gDisableImage[] = { 0x55,0xAA,0x55,0xAA,
0x55,0xAA,0x55,0xAA,
0x55,0xAA,0x55,0xAA,
0x55,0xAA,0x55,0xAA
};
void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
bool isEnabled, bool isPressed )
{
void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
bool isEnabled, bool isPressed )
{
destDc.SelectObject( *destBmp );
wxBrush grayBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE), wxSOLID );
destDc.SelectObject( *destBmp );
wxBrush grayBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE), wxSOLID );
destDc.DrawRectangle( 0,0, destDim.x+1, destDim.y+1 );
if ( isPressed )
destDc.DrawRectangle( 0,0, destDim.x+1, destDim.y+1 );
if ( isPressed )
- srcBmp->GetWidth()+1,
- srcBmp->GetHeight()+1,
- &srcDc, 0,0, wxCOPY,TRUE );
+ srcBmp->GetWidth(),
+ srcBmp->GetHeight(),
+ &srcDc, 0,0, wxCOPY,true );
#ifdef __WXMSW__ // This is currently MSW specific
gray_out_image_on_dc( destDc, destDim.x, destDim.y );
#else
#ifdef __WXMSW__ // This is currently MSW specific
gray_out_image_on_dc( destDc, destDim.x, destDim.y );
#else
- wxBrush checkerBrush( wxBitmap( (const char*)_gDisableImage,8,8) );
+ wxBitmap bmp( (const char*)_gDisableImage,8,8);
+ wxBrush checkerBrush(bmp);
checkerBrush.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
destDc.SetBrush( checkerBrush );
destDc.DrawRectangle( imgPos.x, imgPos.y, srcBmp->GetWidth()+1, srcBmp->GetHeight()+1);
checkerBrush.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
destDc.SetBrush( checkerBrush );
destDc.DrawRectangle( imgPos.x, imgPos.y, srcBmp->GetWidth()+1, srcBmp->GetHeight()+1);
destBmp->GetWidth() + mMarginX*2,
destBmp->GetHeight() + mMarginY*2, 0
);
destBmp->GetWidth() + mMarginX*2,
destBmp->GetHeight() + mMarginY*2, 0
);
- RenderLabelImage( mpDisabledImg, &mDepressedBmp, FALSE );
- RenderLabelImage( mpPressedImg, &mDepressedBmp, TRUE, TRUE );
- RenderLabelImage( mpDepressedImg, &mDepressedBmp, TRUE, FALSE );
+ RenderLabelImage( mpDisabledImg, &mDepressedBmp, false );
+ RenderLabelImage( mpPressedImg, &mDepressedBmp, true, true );
+ RenderLabelImage( mpDepressedImg, &mDepressedBmp, true, false );
- RenderLabelImage( mpFocusedImg, &mFocusedBmp, TRUE, FALSE );
+ RenderLabelImage( mpFocusedImg, &mFocusedBmp, true, false );
- RenderLabelImage( mpPressedImg, &mDepressedBmp, TRUE, TRUE );
+ RenderLabelImage( mpPressedImg, &mDepressedBmp, true, true );
- RenderLabelImage( mpFocusedImg, &mFocusedBmp, TRUE, FALSE );
+ RenderLabelImage( mpFocusedImg, &mFocusedBmp, true, false );
- RenderLabelImage( mpDepressedImg, &mDepressedBmp, TRUE, FALSE );
+ RenderLabelImage( mpDepressedImg, &mDepressedBmp, true, false );
- RenderLabelImage( mpDepressedImg, &mDepressedBmp, TRUE, FALSE );
+ RenderLabelImage( mpDepressedImg, &mDepressedBmp, true, false );
{
// fire event, if mouse was released
// within the bounds of button
{
// fire event, if mouse was released
// within the bounds of button