CtrlCore: TopWindow ChStyle #686

git-svn-id: svn://ultimatepp.org/upp/trunk@7081 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-03-24 12:16:15 +00:00
parent e0712b7518
commit 04f0a5f535
3 changed files with 30 additions and 2 deletions

View file

@ -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<DialogBackground>(), Null);
SetStyle(StyleDefault());
center = 1;
minsize = Size(80, 20);
GuiPlatformConstruct();

View file

@ -17,6 +17,11 @@ public:
virtual String GetDesc() const;
virtual void ChildGotFocus();
public:
struct TopStyle : ChStyle<TopStyle> {
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; }

View file

@ -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