mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
by setting fancy theme thingy just once the problems go away
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1580 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <util/prec.hpp>
|
#include <util/prec.hpp>
|
||||||
#include <gui/control/gallery_list.hpp>
|
#include <gui/control/gallery_list.hpp>
|
||||||
|
#include <gui/util.hpp>
|
||||||
#include <gfx/gfx.hpp>
|
#include <gfx/gfx.hpp>
|
||||||
#include <wx/dcbuffer.h>
|
#include <wx/dcbuffer.h>
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ GalleryList::GalleryList(Window* parent, int id, int direction, bool always_focu
|
|||||||
col.can_select = true;
|
col.can_select = true;
|
||||||
col.selection = NO_SELECTION;
|
col.selection = NO_SELECTION;
|
||||||
subcolumns.push_back(col);
|
subcolumns.push_back(col);
|
||||||
|
enable_themed_selection_rectangle(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GalleryList::selectSubColumn(size_t subcol) {
|
void GalleryList::selectSubColumn(size_t subcol) {
|
||||||
@@ -302,7 +304,15 @@ void GalleryList::OnDraw(DC& dc) {
|
|||||||
for (size_t j = 0 ; j < subcolumns.size() ; ++j) {
|
for (size_t j = 0 ; j < subcolumns.size() ; ++j) {
|
||||||
const SubColumn& col = subcolumns[j];
|
const SubColumn& col = subcolumns[j];
|
||||||
bool selected = i == col.selection;
|
bool selected = i == col.selection;
|
||||||
Color c = selected ? ( has_focus && j == active_subcolumn
|
bool focused = has_focus && j == active_subcolumn;
|
||||||
|
wxRect rect(pos.x + col.offset.x - BORDER, pos.y + col.offset.y - BORDER,
|
||||||
|
col.size.x + 2*BORDER, col.size.y + 2*BORDER);
|
||||||
|
#if 1
|
||||||
|
if (selected) {
|
||||||
|
draw_selection_rectangle(this,dc,rect, selected,focused);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Color c = selected ? ( focused
|
||||||
? wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)
|
? wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)
|
||||||
: lerp(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
|
: lerp(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
|
||||||
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), subcolumnActivity(j))
|
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), subcolumnActivity(j))
|
||||||
@@ -310,8 +320,8 @@ void GalleryList::OnDraw(DC& dc) {
|
|||||||
: unselected;
|
: unselected;
|
||||||
dc.SetPen(c);
|
dc.SetPen(c);
|
||||||
dc.SetBrush(lerp(background, c, 0.3));
|
dc.SetBrush(lerp(background, c, 0.3));
|
||||||
dc.DrawRectangle(pos.x + col.offset.x - BORDER, pos.y + col.offset.y - BORDER,
|
dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
|
||||||
col.size.x + 2*BORDER, col.size.y + 2*BORDER);
|
#endif
|
||||||
}
|
}
|
||||||
// draw item
|
// draw item
|
||||||
drawItem(dc, pos.x, pos.y, i);
|
drawItem(dc, pos.x, pos.y, i);
|
||||||
|
|||||||
+9
-2
@@ -357,8 +357,8 @@ void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool sele
|
|||||||
r.right = rect.x + rect.width;
|
r.right = rect.x + rect.width;
|
||||||
r.bottom = rect.y + rect.height;
|
r.bottom = rect.y + rect.height;
|
||||||
if (hTheme) {
|
if (hTheme) {
|
||||||
//wxUxThemeEngine::Get()->SetWindowTheme((HWND)win->GetHWND(), L"Explorer", NULL);
|
//themeEngine->SetWindowTheme((HWND)win->GetHWND(), L"Explorer", NULL);
|
||||||
wxUxThemeEngine::Get()->DrawThemeBackground(
|
themeEngine->DrawThemeBackground(
|
||||||
(HTHEME)hTheme,
|
(HTHEME)hTheme,
|
||||||
(HDC)dc.GetHDC(),
|
(HDC)dc.GetHDC(),
|
||||||
LVP_LISTITEM,
|
LVP_LISTITEM,
|
||||||
@@ -371,3 +371,10 @@ void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool sele
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void enable_themed_selection_rectangle(Window* win) {
|
||||||
|
wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get();
|
||||||
|
if (themeEngine && themeEngine->IsAppThemed()) {
|
||||||
|
themeEngine->SetWindowTheme((HWND)win->GetHWND(), L"Explorer", NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -78,5 +78,8 @@ void draw_radiobox(Window* win, DC& dc, const wxRect& rect, bool checked, bool e
|
|||||||
/// Draws a (fancy) selection rectangle
|
/// Draws a (fancy) selection rectangle
|
||||||
void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool selected = true, bool focused = true, bool hot = false);
|
void draw_selection_rectangle(Window* win, DC& dc, const wxRect& rect, bool selected = true, bool focused = true, bool hot = false);
|
||||||
|
|
||||||
|
/// Enable fancy themed selection rectangle on windows
|
||||||
|
void enable_themed_selection_rectangle(Window* win);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : EOF
|
// ----------------------------------------------------------------------------- : EOF
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user