wxBitmapButton and Windows XP Themes
-
- Knows some wx things
- Posts: 41
- Joined: Wed Oct 27, 2004 6:06 pm
- Location: Western NY
- Contact:
wxBitmapButton and Windows XP Themes
Is there a reason why wxbitmapbutton looks like it does under Windows XP? From looking at the code, the face is owner drawn with no attention to the current theme except for the background color. Is there a technical or other reason why the theme isn't there, or has no one gotten around to it yet? Would wxw want a patch for it?
See here:
http://sourceforge.net/tracker/?group_i ... id=1098555
Not finished yet as I had to fix other things first to get this to work correctly, however I will try and get this done before 2.5.5.
http://sourceforge.net/tracker/?group_i ... id=1098555
Not finished yet as I had to fix other things first to get this to work correctly, however I will try and get this done before 2.5.5.
Exactly that is the problem. Imagine a Win95-Button (but now with read label;)) in WinXP with luna stype... So the style change is wrong. Can WinXP natively draw coloured buttons? If yes the change would be easy, just set the colour and don't let the button be ownerdrawn. But if not one has to draw the other style button like qt...
I assume you mean a standard themed button with red label, correct? This might look fine if using Luna, but what if a user was using a different theme? The ones that look like Aqua would not look good with a red label. Have a look at wxWindow::SetForegroundColour in the docs for an explanation.
I haven't used QT much, what other style button?
I haven't used QT much, what other style button?
-
- Knows some wx things
- Posts: 41
- Joined: Wed Oct 27, 2004 6:06 pm
- Location: Western NY
- Contact:
"Can WinXP natively draw coloured buttons? If yes the change would be easy, just set the colour and don't let the button be ownerdrawn."
I'm not entirely sure this can be done with the native Windows XP themeing API anyhow. If you look at the DrawThemeBackground API Call, there is only a spot to specify the part you want to draw (aka, a button) and the state (disabled, enabled, pressed) the options for a button appear to be:
PART
BP_PUSHBUTTON
STATES
PBS_DEFAULTED, PBS_DISABLED, PBS_HOT, PBS_NORMAL, PBS_PRESSED
You could probably modify the DC after you draw the theme, but there would be no guarentee your color would match the current theme.
I'm not entirely sure this can be done with the native Windows XP themeing API anyhow. If you look at the DrawThemeBackground API Call, there is only a spot to specify the part you want to draw (aka, a button) and the state (disabled, enabled, pressed) the options for a button appear to be:
PART
BP_PUSHBUTTON
STATES
PBS_DEFAULTED, PBS_DISABLED, PBS_HOT, PBS_NORMAL, PBS_PRESSED
You could probably modify the DC after you draw the theme, but there would be no guarentee your color would match the current theme.
-
- Part Of The Furniture
- Posts: 1511
- Joined: Sun Jun 19, 2005 11:37 am
- Location: Singapore
- Contact:
OK this is real REAL late but well.... thats exactly why im posting here... (2.6.2 CVS source)
the patch provided... seems to crash the program after applying it. it seems perfect without it, but after applying it and rebuilding the libraries, it crashes on exit
i can have a look at the source, but so far... i cant find anything wrong.
the patch provided... seems to crash the program after applying it. it seems perfect without it, but after applying it and rebuilding the libraries, it crashes on exit
i can have a look at the source, but so far... i cant find anything wrong.
I Created my own Button some Time ago. I derived it from wxButton and used UXTheme to paint it themed (and also to allow a bitmap and text on the same Button), cause I found both wxBitmapButton and a normal wxButton with colored label rather ugly and unprofessional (I'm using a different label-color and Icon to indicate a button, wich opens a dialog wich has data in the database, so the user can see without clicking if any data is available).
Looks like this:
Looks like this:
Code: Select all
wxUxThemeEngine *pTheme = wxUxThemeEngine::Get();
if (pTheme && !pTheme->IsAppThemed()) pTheme = NULL;
if (pTheme) {
wxUxThemeHandle hTheme(this, L"BUTTON");
if (hTheme) {
long flags = PBS_NORMAL;
if (state & ODS_DISABLED) flags = PBS_DISABLED;
else if (pushed) flags = PBS_PRESSED;
else if (m_mouseOver) flags = PBS_HOT;
else if (selected) flags = PBS_DEFAULTED;
pTheme->DrawThemeBackground(hTheme, (HDC)dc.GetHDC(), BP_PUSHBUTTON, flags, &lpDIS->rcItem, NULL);
}
}
else {
// Copy from wxButton.
}
// Paint Bitmap and Text