From 04f0a5f535963ed4f7498dcd9e551802ef75909a Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 24 Mar 2014 12:16:15 +0000 Subject: [PATCH] CtrlCore: TopWindow ChStyle #686 git-svn-id: svn://ultimatepp.org/upp/trunk@7081 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/TopWindow.cpp | 20 +++++++++++++++++++- uppsrc/CtrlCore/TopWindow.h | 10 ++++++++++ uppsrc/CtrlCore/init | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/uppsrc/CtrlCore/TopWindow.cpp b/uppsrc/CtrlCore/TopWindow.cpp index b529a9b1f..3ae930c79 100644 --- a/uppsrc/CtrlCore/TopWindow.cpp +++ b/uppsrc/CtrlCore/TopWindow.cpp @@ -224,7 +224,10 @@ TopWindow& TopWindow::Rejector(Ctrl& m, int ID) void TopWindow::Paint(Draw& w) { - background.Paint(w, Rect(GetSize()), SColorText, SColorShadow); + if(!IsNull(st->background)) + ChPaint(w, GetSize(), st->background); + else + background.Paint(w, GetSize(), SColorText, SColorShadow); } TopWindow& TopWindow::Background(const PaintRect& prect) @@ -469,11 +472,26 @@ struct DialogBackground : public Display { } }; + +CH_STYLE(TopWindow, TopStyle, StyleDefault) +{ + background = Null; +} + +TopWindow& TopWindow::SetStyle(const TopWindow::TopStyle& s) +{ + st = &s; + RefreshLayout(); + RefreshFrame(); + return *this; +} + TopWindow::TopWindow() { GuiLock __; TransparentBackPaint(); background = PaintRect(Single(), Null); + SetStyle(StyleDefault()); center = 1; minsize = Size(80, 20); GuiPlatformConstruct(); diff --git a/uppsrc/CtrlCore/TopWindow.h b/uppsrc/CtrlCore/TopWindow.h index 0996820f2..effed944f 100644 --- a/uppsrc/CtrlCore/TopWindow.h +++ b/uppsrc/CtrlCore/TopWindow.h @@ -17,6 +17,11 @@ public: virtual String GetDesc() const; virtual void ChildGotFocus(); +public: + struct TopStyle : ChStyle { + Value background; + }; + protected: enum { TIMEID_DEFSYNCTITLE = Ctrl::TIMEID_COUNT, @@ -72,6 +77,8 @@ private: bool urgent:1; byte state; Image icon, largeicon; + + const TopStyle *st; void GuiPlatformConstruct(); void GuiPlatformDestruct(); @@ -160,6 +167,9 @@ public: TopWindow& Icon(const Image& m); TopWindow& LargeIcon(const Image& m); TopWindow& Icon(const Image& smallicon, const Image& largeicon); + + static const TopStyle& StyleDefault(); + TopWindow& SetStyle(const TopStyle& s); Image GetIcon() const { return icon; } Image GetLargeIcon() const { return largeicon; } diff --git a/uppsrc/CtrlCore/init b/uppsrc/CtrlCore/init index 27c33a181..aa63470cf 100644 --- a/uppsrc/CtrlCore/init +++ b/uppsrc/CtrlCore/init @@ -3,7 +3,7 @@ #include "Draw/init" #include "plugin\bmp/init" #include "RichText/init" -#define BLITZ_INDEX__ Fe2ff541f9bb9f4ad3f5bcc23a34e1b73 +#define BLITZ_INDEX__ F656a4ea94e4f808b1ec63034b0e6c5ac #include "CtrlCore.icpp" #undef BLITZ_INDEX__ #endif