1 - Moved settingsdlg.[h,cpp] and wxinfo.[h,cpp] to demo where they belong
2 - removed pf_sample from library - this was test code 3 - modified newbmpbutton to create all button images once at initial creation 4 - newbmpbutton only refreses when necessary 5 - non-msw platforms may now disable (enable(FALSE)) a button - this will half-grey the image and draw text in disabled color. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -10,8 +10,10 @@ RULE=bin
|
|||||||
BIN_TARGET=fl_demo
|
BIN_TARGET=fl_demo
|
||||||
|
|
||||||
# define library sources
|
# define library sources
|
||||||
BIN_CPP_SRC=\
|
BIN_CPP_SRC= \
|
||||||
fl_demo.cpp\
|
fl_demo.cpp \
|
||||||
|
settingsdlg.cpp \
|
||||||
|
wxinfo.cpp
|
||||||
|
|
||||||
#define library objects
|
#define library objects
|
||||||
BIN_OBJ=\
|
BIN_OBJ=\
|
||||||
|
@@ -769,7 +769,7 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent )
|
|||||||
new cbDynToolBarDimHandler()
|
new cbDynToolBarDimHandler()
|
||||||
);
|
);
|
||||||
|
|
||||||
cbDimInfo sizes4( 430,35, // when docked horizontally
|
cbDimInfo sizes4( 450,35, // when docked horizontally
|
||||||
44,375, // when docked vertically
|
44,375, // when docked vertically
|
||||||
80,100, // when floated
|
80,100, // when floated
|
||||||
TRUE, // the bar is fixed-size
|
TRUE, // the bar is fixed-size
|
||||||
@@ -790,8 +790,6 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent )
|
|||||||
pTBar2->AddTool( 4, wxBitmap("nextmark_icon") );
|
pTBar2->AddTool( 4, wxBitmap("nextmark_icon") );
|
||||||
pTBar2->AddTool( 5, wxBitmap("prevmark_icon") );
|
pTBar2->AddTool( 5, wxBitmap("prevmark_icon") );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wxDynamicToolBar* pTBar3 = new wxDynamicToolBar( mpInternalFrm, -1 );
|
wxDynamicToolBar* pTBar3 = new wxDynamicToolBar( mpInternalFrm, -1 );
|
||||||
|
|
||||||
pTBar3->AddTool( 1, wxBitmap("open_icon"), " Open " );
|
pTBar3->AddTool( 1, wxBitmap("open_icon"), " Open " );
|
||||||
@@ -821,7 +819,6 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent )
|
|||||||
pTBar2->AddTool( 4, nextmark_xpm );
|
pTBar2->AddTool( 4, nextmark_xpm );
|
||||||
pTBar2->AddTool( 5, prevmark_xpm );
|
pTBar2->AddTool( 5, prevmark_xpm );
|
||||||
|
|
||||||
|
|
||||||
wxDynamicToolBar* pTBar3 = new wxDynamicToolBar( mpInternalFrm, -1 );
|
wxDynamicToolBar* pTBar3 = new wxDynamicToolBar( mpInternalFrm, -1 );
|
||||||
|
|
||||||
pTBar3->AddTool( 1, wxBitmap(open_xpm), " Open " );
|
pTBar3->AddTool( 1, wxBitmap(open_xpm), " Open " );
|
||||||
@@ -832,6 +829,8 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent )
|
|||||||
pTBar3->AddTool( 5, wxBitmap(copy_xpm), " Copy " );
|
pTBar3->AddTool( 5, wxBitmap(copy_xpm), " Copy " );
|
||||||
pTBar3->AddTool( 6, wxBitmap(paste_xpm), " Paste " );
|
pTBar3->AddTool( 6, wxBitmap(paste_xpm), " Paste " );
|
||||||
|
|
||||||
|
pTBar3->EnableTool( 2, FALSE );
|
||||||
|
|
||||||
wxDynamicToolBar* pTBar4 = new wxDynamicToolBar( mpInternalFrm, -1 );
|
wxDynamicToolBar* pTBar4 = new wxDynamicToolBar( mpInternalFrm, -1 );
|
||||||
|
|
||||||
pTBar4->AddTool( 1, wxBitmap(bookmarks_xpm), "Bookmarks ", TRUE );
|
pTBar4->AddTool( 1, wxBitmap(bookmarks_xpm), "Bookmarks ", TRUE );
|
||||||
@@ -839,6 +838,8 @@ void MyFrame::AddSearchToolbars( wxFrameLayout& layout, wxWindow* pParent )
|
|||||||
pTBar4->AddTool( 3, wxBitmap(prevmark_xpm), "Prev bookmark ", TRUE );
|
pTBar4->AddTool( 3, wxBitmap(prevmark_xpm), "Prev bookmark ", TRUE );
|
||||||
//pTBar4->AddSeparator();
|
//pTBar4->AddSeparator();
|
||||||
pTBar4->AddTool( 4, wxBitmap(search_xpm),"Search ", TRUE );
|
pTBar4->AddTool( 4, wxBitmap(search_xpm),"Search ", TRUE );
|
||||||
|
|
||||||
|
pTBar4->EnableTool( 4, FALSE );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
layout.AddBar( pTBar2,
|
layout.AddBar( pTBar2,
|
||||||
|
@@ -40,13 +40,10 @@ hintanimpl.cpp \
|
|||||||
newbmpbtn.cpp \
|
newbmpbtn.cpp \
|
||||||
objstore.cpp \
|
objstore.cpp \
|
||||||
panedrawpl.cpp \
|
panedrawpl.cpp \
|
||||||
pf_sample.cpp \
|
|
||||||
rowdragpl.cpp \
|
rowdragpl.cpp \
|
||||||
rowlayoutpl.cpp \
|
rowlayoutpl.cpp \
|
||||||
settingsdlg.cpp \
|
|
||||||
toolwnd.cpp \
|
toolwnd.cpp \
|
||||||
updatesmgr.cpp \
|
updatesmgr.cpp
|
||||||
wxinfo.cpp
|
|
||||||
|
|
||||||
#define library objects
|
#define library objects
|
||||||
LIB_OBJ= \
|
LIB_OBJ= \
|
||||||
@@ -64,7 +61,7 @@ ADD_COMPILE=
|
|||||||
include ../../../../template.mak
|
include ../../../../template.mak
|
||||||
|
|
||||||
install::
|
install::
|
||||||
@echo "Installing library files and headers for libwx_gl_gtk.."
|
@echo "Installing library files and headers for libwx_fl_gtk.."
|
||||||
@echo " Creating directory.."
|
@echo " Creating directory.."
|
||||||
@$(WXBASEDIR)/mkinstalldirs /usr/local/include/wx_fl
|
@$(WXBASEDIR)/mkinstalldirs /usr/local/include/wx_fl
|
||||||
@echo " Copying headers from framelayout/src"
|
@echo " Copying headers from framelayout/src"
|
||||||
|
@@ -71,7 +71,6 @@ static int* create_array( int width, int height, int fill = 0 )
|
|||||||
static void gray_out_pixmap( int* src, int* dest, int width, int height )
|
static void gray_out_pixmap( int* src, int* dest, int width, int height )
|
||||||
{
|
{
|
||||||
// assuming the pixels along the edges are of the background color
|
// assuming the pixels along the edges are of the background color
|
||||||
int bgCol = GET_ELEM(src,0,0);
|
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 1;
|
int y = 1;
|
||||||
@@ -80,9 +79,6 @@ static void gray_out_pixmap( int* src, int* dest, int width, int height )
|
|||||||
{
|
{
|
||||||
int cur = GET_ELEM(src,x,y);
|
int cur = GET_ELEM(src,x,y);
|
||||||
|
|
||||||
int r = GET_RED(cur);
|
|
||||||
int g = GET_GREEN(cur);
|
|
||||||
int b = GET_BLUE(cur);
|
|
||||||
|
|
||||||
if ( IS_IN_ARRAY(x-1,y-1) )
|
if ( IS_IN_ARRAY(x-1,y-1) )
|
||||||
{
|
{
|
||||||
@@ -167,11 +163,6 @@ void greay_out_image_on_dc( wxDC& dc, int width, int height )
|
|||||||
wxColour col;
|
wxColour col;
|
||||||
dc.GetPixel( x,y, &col );
|
dc.GetPixel( x,y, &col );
|
||||||
|
|
||||||
int r = col.Red(),
|
|
||||||
g = col.Green(),
|
|
||||||
b = col.Blue();
|
|
||||||
|
|
||||||
int o = MAKE_INT_COLOR( r,g,b );
|
|
||||||
|
|
||||||
GET_ELEM(src,x,y) = MAKE_INT_COLOR( col.Red(), col.Green(), col.Blue() );
|
GET_ELEM(src,x,y) = MAKE_INT_COLOR( col.Red(), col.Green(), col.Blue() );
|
||||||
}
|
}
|
||||||
@@ -233,37 +224,38 @@ wxNewBitmapButton::wxNewBitmapButton( const wxBitmap& labelBitmap,
|
|||||||
int marginY,
|
int marginY,
|
||||||
int textToLabelGap,
|
int textToLabelGap,
|
||||||
bool isSticky)
|
bool isSticky)
|
||||||
: mpDepressedImg( NULL ),
|
: mTextToLabelGap ( textToLabelGap ),
|
||||||
|
mMarginX( marginX ),
|
||||||
|
mMarginY( marginY ),
|
||||||
|
mTextAlignment( alignText ),
|
||||||
|
mIsSticky( isSticky ),
|
||||||
|
mIsFlat( isFlat ),
|
||||||
|
mLabelText( labelText ),
|
||||||
|
mImageFileType( -1 ),
|
||||||
|
mDepressedBmp( labelBitmap ),
|
||||||
|
|
||||||
|
mpDepressedImg( NULL ),
|
||||||
mpPressedImg ( NULL ),
|
mpPressedImg ( NULL ),
|
||||||
mpDisabledImg ( NULL ),
|
mpDisabledImg ( NULL ),
|
||||||
mpFocusedImg ( NULL ),
|
mpFocusedImg ( NULL ),
|
||||||
|
|
||||||
mMarginX( marginX ),
|
|
||||||
mMarginY( marginY ),
|
|
||||||
mTextAlignment( alignText ),
|
|
||||||
mIsFlat( isFlat ),
|
|
||||||
|
|
||||||
mIsPressed ( FALSE ),
|
|
||||||
mDragStarted ( FALSE ),
|
mDragStarted ( FALSE ),
|
||||||
|
mIsPressed ( FALSE ),
|
||||||
|
mIsInFocus( FALSE ),
|
||||||
mPrevPressedState( FALSE ),
|
mPrevPressedState( FALSE ),
|
||||||
mTextToLabelGap ( textToLabelGap ),
|
mPrevInFocusState( FALSE ),
|
||||||
|
mHasFocusedBmp( FALSE ),
|
||||||
|
mFiredEventType( firedEventType ),
|
||||||
|
|
||||||
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
|
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
|
||||||
mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ),
|
mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ),
|
||||||
mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
|
mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
|
||||||
mLightPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
|
mLightPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
|
||||||
|
|
||||||
mFiredEventType( firedEventType ),
|
|
||||||
mIsSticky( isSticky ),
|
|
||||||
mIsCreated( FALSE ),
|
mIsCreated( FALSE ),
|
||||||
mSizeIsSet( FALSE ),
|
mSizeIsSet( FALSE )
|
||||||
|
|
||||||
mHasFocusedBmp( FALSE ),
|
|
||||||
mIsInFocus( FALSE ),
|
|
||||||
|
|
||||||
mDepressedBmp( labelBitmap ),
|
|
||||||
mLabelText( labelText ),
|
|
||||||
mImageFileType( -1 )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,39 +270,38 @@ wxNewBitmapButton::wxNewBitmapButton( const wxString& bitmapFileName,
|
|||||||
int textToLabelGap,
|
int textToLabelGap,
|
||||||
bool isSticky)
|
bool isSticky)
|
||||||
|
|
||||||
: mpDepressedImg( NULL ),
|
: mTextToLabelGap ( 2 ),
|
||||||
|
mMarginX( 2 ),
|
||||||
|
mMarginY( 2 ),
|
||||||
|
mTextAlignment( alignText ),
|
||||||
|
mIsSticky( FALSE ),
|
||||||
|
mIsFlat( isFlat ),
|
||||||
|
mLabelText( labelText ),
|
||||||
|
mImageFileName( bitmapFileName ),
|
||||||
|
mImageFileType( bitmapFileType ),
|
||||||
|
|
||||||
|
mpDepressedImg( NULL ),
|
||||||
mpPressedImg ( NULL ),
|
mpPressedImg ( NULL ),
|
||||||
mpDisabledImg ( NULL ),
|
mpDisabledImg ( NULL ),
|
||||||
mpFocusedImg ( NULL ),
|
mpFocusedImg ( NULL ),
|
||||||
|
|
||||||
mMarginX( 2 ),
|
|
||||||
mMarginY( 2 ),
|
|
||||||
mTextAlignment( alignText ),
|
|
||||||
mIsFlat( isFlat ),
|
|
||||||
|
|
||||||
mIsPressed ( FALSE ),
|
|
||||||
mDragStarted ( FALSE ),
|
mDragStarted ( FALSE ),
|
||||||
|
mIsPressed ( FALSE ),
|
||||||
|
mIsInFocus ( FALSE ),
|
||||||
mPrevPressedState( FALSE ),
|
mPrevPressedState( FALSE ),
|
||||||
mTextToLabelGap ( 2 ),
|
mPrevInFocusState( FALSE ),
|
||||||
|
mHasFocusedBmp( FALSE ),
|
||||||
|
mFiredEventType( wxEVT_COMMAND_MENU_SELECTED ),
|
||||||
|
|
||||||
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
|
mBlackPen( wxColour( 0, 0, 0), 1, wxSOLID ),
|
||||||
mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ),
|
mDarkPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID ),
|
||||||
mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
|
mGrayPen ( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), 1, wxSOLID ),
|
||||||
mLightPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
|
mLightPen( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHIGHLIGHT), 1, wxSOLID ),
|
||||||
|
|
||||||
mFiredEventType( wxEVT_COMMAND_MENU_SELECTED ),
|
|
||||||
mIsSticky( FALSE ),
|
|
||||||
mIsCreated( FALSE ),
|
mIsCreated( FALSE ),
|
||||||
mSizeIsSet( FALSE ),
|
mSizeIsSet( FALSE )
|
||||||
|
|
||||||
mHasFocusedBmp( FALSE ),
|
|
||||||
mIsInFocus( FALSE ),
|
|
||||||
|
|
||||||
mLabelText( labelText ),
|
|
||||||
mImageFileName( bitmapFileName ),
|
|
||||||
mImageFileType( bitmapFileType )
|
|
||||||
{
|
{
|
||||||
//mDepressedBmp.LoadFile( bitmapFileName, bitmapFileType );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNewBitmapButton::~wxNewBitmapButton(void)
|
wxNewBitmapButton::~wxNewBitmapButton(void)
|
||||||
@@ -379,6 +370,11 @@ wxBitmap* wxNewBitmapButton::GetStateLabel()
|
|||||||
return mpDisabledImg;
|
return mpDisabledImg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
|
||||||
bool isEnabled, bool isPressed )
|
bool isEnabled, bool isPressed )
|
||||||
{
|
{
|
||||||
@@ -461,10 +457,11 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
|
|||||||
|
|
||||||
if ( hasImage )
|
if ( hasImage )
|
||||||
{
|
{
|
||||||
|
|
||||||
destDc.Blit( imgPos.x, imgPos.y,
|
destDc.Blit( imgPos.x, imgPos.y,
|
||||||
srcBmp->GetWidth()+1,
|
srcBmp->GetWidth()+1,
|
||||||
srcBmp->GetHeight()+1,
|
srcBmp->GetHeight()+1,
|
||||||
&srcDc, 0,0, wxCOPY,TRUE );
|
&srcDc, 0,0, wxCOPY,TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hasText )
|
if ( hasText )
|
||||||
@@ -482,17 +479,73 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
|
|||||||
|
|
||||||
destDc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT) );
|
destDc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT) );
|
||||||
|
|
||||||
// Should be wxSYS_COLOUR_BTNTEXT, but gtk gives white?
|
if( isEnabled ){
|
||||||
destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT) );
|
destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT) );
|
||||||
|
}else{
|
||||||
|
destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW) );
|
||||||
|
}
|
||||||
destDc.SetTextBackground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE) );
|
destDc.SetTextBackground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE) );
|
||||||
|
|
||||||
destDc.DrawText( mLabelText, txtPos.x, txtPos.y );
|
destDc.DrawText( mLabelText, txtPos.x, txtPos.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isEnabled )
|
|
||||||
|
|
||||||
|
destDc.SetBrush( grayBrush );
|
||||||
|
destDc.SetPen( nullPen );
|
||||||
|
|
||||||
|
destDc.DrawRectangle( 0,0, destDim.x+1, destDim.y+1 );
|
||||||
|
|
||||||
|
if ( isPressed )
|
||||||
|
{
|
||||||
|
++imgPos.x; ++imgPos.y;
|
||||||
|
++txtPos.x; ++txtPos.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( hasImage )
|
||||||
|
{
|
||||||
|
|
||||||
|
destDc.Blit( imgPos.x, imgPos.y,
|
||||||
|
srcBmp->GetWidth()+1,
|
||||||
|
srcBmp->GetHeight()+1,
|
||||||
|
&srcDc, 0,0, wxCOPY,TRUE );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( hasText )
|
||||||
|
{
|
||||||
|
wxWindow* pTopWnd = this;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
wxWindow* pParent = pTopWnd->GetParent();
|
||||||
|
|
||||||
|
if ( pParent == 0 ) break;
|
||||||
|
|
||||||
|
pTopWnd = pParent;
|
||||||
|
} while(1);
|
||||||
|
|
||||||
|
destDc.SetFont( wxSystemSettings::GetSystemFont( wxSYS_DEFAULT_GUI_FONT) );
|
||||||
|
|
||||||
|
if( isEnabled ){
|
||||||
|
destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT) );
|
||||||
|
}else{
|
||||||
|
destDc.SetTextForeground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW) );
|
||||||
|
}
|
||||||
|
destDc.SetTextBackground( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE) );
|
||||||
|
|
||||||
|
destDc.DrawText( mLabelText, txtPos.x, txtPos.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !isEnabled ){
|
||||||
|
|
||||||
|
#ifdef __WXMSW // This is currently MSW specific
|
||||||
greay_out_image_on_dc( destDc, destDim.x, destDim.y );
|
greay_out_image_on_dc( destDc, destDim.x, destDim.y );
|
||||||
|
#else
|
||||||
|
wxBrush checkerBrush( wxBitmap( (const char*)_gDisableImage,8,8) );
|
||||||
|
checkerBrush.SetColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) );
|
||||||
|
destDc.SetBrush( checkerBrush );
|
||||||
|
destDc.DrawRectangle( imgPos.x, imgPos.y, srcBmp->GetWidth()+1, srcBmp->GetHeight()+1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
// adjust button size to fit the new dimensions of the label
|
// adjust button size to fit the new dimensions of the label
|
||||||
if ( !mSizeIsSet && 0 )
|
if ( !mSizeIsSet && 0 )
|
||||||
{
|
{
|
||||||
@@ -503,6 +556,17 @@ void wxNewBitmapButton::RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void wxNewBitmapButton::RenderAllLabelImages()
|
||||||
|
{
|
||||||
|
if( !mIsCreated ) return;
|
||||||
|
RenderLabelImage( mpDisabledImg, &mDepressedBmp, FALSE );
|
||||||
|
RenderLabelImage( mpPressedImg, &mDepressedBmp, TRUE, TRUE );
|
||||||
|
RenderLabelImage( mpDepressedImg, &mDepressedBmp, TRUE, FALSE );
|
||||||
|
if ( mHasFocusedBmp ){
|
||||||
|
RenderLabelImage( mpFocusedImg, &mFocusedBmp, TRUE, FALSE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxNewBitmapButton::RenderLabelImages()
|
void wxNewBitmapButton::RenderLabelImages()
|
||||||
{
|
{
|
||||||
@@ -572,7 +636,8 @@ void wxNewBitmapButton::SetLabel(const wxBitmap& labelBitmap,
|
|||||||
mLabelText = labelText;
|
mLabelText = labelText;
|
||||||
mDepressedBmp = labelBitmap;
|
mDepressedBmp = labelBitmap;
|
||||||
|
|
||||||
RenderLabelImages();
|
//RenderLabelImages();
|
||||||
|
RenderAllLabelImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNewBitmapButton::SetAlignments( int alignText,
|
void wxNewBitmapButton::SetAlignments( int alignText,
|
||||||
@@ -587,7 +652,8 @@ void wxNewBitmapButton::SetAlignments( int alignText,
|
|||||||
mTextAlignment = alignText;
|
mTextAlignment = alignText;
|
||||||
mTextToLabelGap = textToLabelGap;
|
mTextToLabelGap = textToLabelGap;
|
||||||
|
|
||||||
RenderLabelImages();
|
//RenderLabelImages();
|
||||||
|
RenderAllLabelImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
@@ -636,6 +702,8 @@ bool wxNewBitmapButton::IsInWindow( int x, int y )
|
|||||||
|
|
||||||
void wxNewBitmapButton::OnMouseMove( wxMouseEvent& event )
|
void wxNewBitmapButton::OnMouseMove( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
|
mPrevPressedState=mIsPressed;
|
||||||
|
mPrevInFocusState=mIsInFocus;
|
||||||
if ( !mIsInFocus && IsInWindow( event.m_x, event.m_y ) )
|
if ( !mIsInFocus && IsInWindow( event.m_x, event.m_y ) )
|
||||||
{
|
{
|
||||||
if ( !mDragStarted )
|
if ( !mDragStarted )
|
||||||
@@ -659,16 +727,11 @@ void wxNewBitmapButton::OnMouseMove( wxMouseEvent& event )
|
|||||||
mIsPressed = TRUE;
|
mIsPressed = TRUE;
|
||||||
else
|
else
|
||||||
mIsPressed = FALSE;
|
mIsPressed = FALSE;
|
||||||
|
|
||||||
if ( mIsPressed != mPrevPressedState )
|
|
||||||
|
|
||||||
Refresh();
|
|
||||||
|
|
||||||
mPrevPressedState = mIsPressed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FOR NOW::
|
if((mIsPressed != mPrevPressedState)||(mIsInFocus!=mPrevInFocusState)){
|
||||||
Refresh();
|
Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNewBitmapButton::OnSize( wxSizeEvent& event )
|
void wxNewBitmapButton::OnSize( wxSizeEvent& event )
|
||||||
@@ -678,6 +741,7 @@ void wxNewBitmapButton::OnSize( wxSizeEvent& event )
|
|||||||
|
|
||||||
void wxNewBitmapButton::Reshape( )
|
void wxNewBitmapButton::Reshape( )
|
||||||
{
|
{
|
||||||
|
|
||||||
bool wasCreated = mIsCreated;
|
bool wasCreated = mIsCreated;
|
||||||
mIsCreated = TRUE;
|
mIsCreated = TRUE;
|
||||||
|
|
||||||
@@ -693,7 +757,8 @@ void wxNewBitmapButton::Reshape( )
|
|||||||
//wxMessageBox("Image Loaded!!!");
|
//wxMessageBox("Image Loaded!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderLabelImages();
|
//RenderLabelImages();
|
||||||
|
RenderAllLabelImages();
|
||||||
|
|
||||||
wxBitmap* pCurImg = GetStateLabel();
|
wxBitmap* pCurImg = GetStateLabel();
|
||||||
|
|
||||||
@@ -713,7 +778,7 @@ void wxNewBitmapButton::DrawLabel( wxDC& dc )
|
|||||||
wxSizeEvent evt;
|
wxSizeEvent evt;
|
||||||
OnSize( evt ); // fake it up!
|
OnSize( evt ); // fake it up!
|
||||||
|
|
||||||
RenderLabelImages();
|
//RenderLabelImages();
|
||||||
pCurBmp = GetStateLabel();
|
pCurBmp = GetStateLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,7 +799,7 @@ void wxNewBitmapButton::OnPaint( wxPaintEvent& event )
|
|||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
|
|
||||||
// first, make sure images for current state are prepared
|
// first, make sure images for current state are prepared
|
||||||
RenderLabelImages();
|
//RenderLabelImages();
|
||||||
|
|
||||||
DrawLabel( dc );
|
DrawLabel( dc );
|
||||||
|
|
||||||
|
@@ -42,11 +42,11 @@ protected:
|
|||||||
int mMarginY;
|
int mMarginY;
|
||||||
int mTextAlignment;
|
int mTextAlignment;
|
||||||
bool mIsSticky;
|
bool mIsSticky;
|
||||||
|
bool mIsFlat;
|
||||||
|
|
||||||
wxString mLabelText;
|
wxString mLabelText;
|
||||||
wxString mImageFileName;
|
wxString mImageFileName;
|
||||||
int mImageFileType;
|
int mImageFileType;
|
||||||
bool mIsFlat;
|
|
||||||
|
|
||||||
wxBitmap mDepressedBmp; // source image for rendering
|
wxBitmap mDepressedBmp; // source image for rendering
|
||||||
// labels for particular state
|
// labels for particular state
|
||||||
@@ -64,6 +64,7 @@ protected:
|
|||||||
bool mIsPressed;
|
bool mIsPressed;
|
||||||
bool mIsInFocus;
|
bool mIsInFocus;
|
||||||
bool mPrevPressedState;
|
bool mPrevPressedState;
|
||||||
|
bool mPrevInFocusState;
|
||||||
|
|
||||||
bool mHasFocusedBmp;
|
bool mHasFocusedBmp;
|
||||||
|
|
||||||
@@ -142,6 +143,7 @@ public:
|
|||||||
bool isPressed = FALSE);
|
bool isPressed = FALSE);
|
||||||
|
|
||||||
virtual void RenderLabelImages();
|
virtual void RenderLabelImages();
|
||||||
|
virtual void RenderAllLabelImages();
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
void OnLButtonDown( wxMouseEvent& event );
|
void OnLButtonDown( wxMouseEvent& event );
|
||||||
|
Reference in New Issue
Block a user