mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 22:02:58 -06:00
229 lines
5 KiB
C++
229 lines
5 KiB
C++
#include "StylerTest.h"
|
|
|
|
#define IMAGECLASS StylerTestImg
|
|
#define IMAGEFILE <StylerTest/StylerTest.iml>
|
|
#include <Draw/iml_source.h>
|
|
|
|
static Color SColorEditPaper = LtRed;
|
|
static Color SColorEditText = Yellow;
|
|
static Color SColorEditHighlight = Yellow;
|
|
static Color SColorEditHighlightText = Blue;
|
|
|
|
static Color SColorButtonFace = LtRed;
|
|
static Color SColorButtonText = Blue;
|
|
|
|
static Color SColorSpinButtonMonoColor = LtRed;
|
|
static Color SColorSpinButtonMonoColorh = White;
|
|
static Color SColorSpinButtonMonoColorp = LtBlue;
|
|
static Color SColorSpinButtonMonoColord = LtYellow;
|
|
|
|
CH_LOCSTYLE(EditField, Style, EditFieldStyleDFM)
|
|
{
|
|
paper = SColorEditPaper;
|
|
disabled = SColorFace();
|
|
focus = paper;
|
|
invalid = Blend(paper, Color(255, 0, 0), 32);
|
|
text = SColorEditText;
|
|
textdisabled = SColorDisabled;
|
|
selected = SColorEditHighlight;
|
|
selectedtext = SColorEditHighlightText;
|
|
for(int i = 0; i < 4; i++)
|
|
edge[i] = CtrlsImg::EFE();
|
|
activeedge = false;
|
|
vfm = 2;
|
|
}
|
|
|
|
CH_LOCSTYLE(Button, Style, ButtonStyleDFM)
|
|
{
|
|
look[0] = SColorButtonFace;
|
|
look[1] = SColorFace();
|
|
look[2] = LtBlue();
|
|
look[3] = LtYellow();
|
|
// CtrlsImageLook(look, StylerTestImg::I_B);
|
|
|
|
// monocolor[0] = monocolor[1] = monocolor[2] = monocolor[3] =
|
|
// Blend(Blend(SColorHighlight, SColorShadow), SColorLabel, 80);
|
|
monocolor[0] = SColorSpinButtonMonoColor;
|
|
monocolor[1] = SColorSpinButtonMonoColorh;
|
|
monocolor[2] = SColorSpinButtonMonoColorp;
|
|
monocolor[3] = SColorSpinButtonMonoColord;
|
|
|
|
textcolor[0] = textcolor[1] = textcolor[2] = SColorButtonText;
|
|
textcolor[3] = SColorDisabled();
|
|
font = StdFont();
|
|
pressoffset = Point(0, 0);
|
|
focusmargin = 3;
|
|
overpaint = 0;
|
|
transparent = true;
|
|
}
|
|
|
|
CH_LOCSTYLE(SpinButtons, Style, SpinButtonStyleDFM)
|
|
{
|
|
inc = dec = ButtonStyleDFM();
|
|
CtrlsImageLook(inc.look, CtrlsImg::I_EB, CtrlsImg::SpU(), inc.monocolor);
|
|
CtrlsImageLook(dec.look, CtrlsImg::I_EB, CtrlsImg::SpD(), dec.monocolor);
|
|
width = 12;
|
|
}
|
|
|
|
void StylerTest::ReloadChamCB()
|
|
{
|
|
chc.Update();
|
|
ApplyOwnStyle();
|
|
}
|
|
|
|
void StylerTest::ReloadCB()
|
|
{
|
|
Refresh();
|
|
}
|
|
|
|
void StylerTest::Menu(Bar& bar)
|
|
{
|
|
bar.Add(true, "Refresh", CtrlImg::help(), THISBACK(ReloadCB));
|
|
bar.Add(false, "Refresh(dis)", CtrlImg::help(), THISBACK(ReloadCB));
|
|
}
|
|
|
|
void StylerTest::ApplyOwnStyle()
|
|
{
|
|
return;
|
|
//recalculate own colors
|
|
ChFinish();
|
|
|
|
EditField::Style& stef = EditField::StyleDefault().Write();
|
|
stef = EditFieldStyleDFM();
|
|
|
|
{
|
|
Button::Style& stbt = Button::StyleNormal().Write();
|
|
stbt = ButtonStyleDFM();
|
|
}
|
|
|
|
SpinButtons::Style& stspbt = SpinButtons::StyleDefault().Write();
|
|
stspbt = SpinButtonStyleDFM();
|
|
|
|
RefreshGlobalStyles();
|
|
RefreshLayoutDeepAll();
|
|
}
|
|
|
|
StylerTest::StylerTest()
|
|
{
|
|
CtrlLayout(*this, "Window title");
|
|
Sizeable().Zoomable();
|
|
|
|
sc <<= THISBACK(ReloadChamCB);
|
|
Add(sc.LeftPos(0,200).BottomPos(0,200));
|
|
|
|
chc <<= THISBACK(ApplyOwnStyle);
|
|
Add(chc.RightPos(0,400).BottomPos(0,200));
|
|
|
|
InitDummys();
|
|
b.SetStyle(ButtonStyleDFM());
|
|
|
|
ApplyOwnStyle();
|
|
}
|
|
|
|
void StylerTest::InitDummys()
|
|
{
|
|
//dummys
|
|
|
|
mbar.Set( THISBACK( Menu ) );
|
|
tool.Set( THISBACK( Menu ) );
|
|
|
|
AddFrame(mbar);
|
|
AddFrame(tool);
|
|
AddFrame(stbar);
|
|
|
|
bo.SetLabel("But.Opt.");
|
|
|
|
de.SetData("This is a\nDocEdit example text");
|
|
le.SetData("LineEdit");
|
|
ef.SetData("EditField");
|
|
es.SetData("EditString");
|
|
|
|
ei = 100;
|
|
ei64 = 22342599399929;
|
|
ed = 10.3;
|
|
|
|
einn <<= 100;
|
|
ei64nn <<= 22342599399929;
|
|
ednn <<= 10.3;
|
|
|
|
eis <<= 100;
|
|
ei64s <<= 22342599399929;
|
|
eds <<= 10.3;
|
|
|
|
einns <<= 100;
|
|
ei64nns <<= 22342599399929;
|
|
ednns <<= 10.3;
|
|
|
|
edt <<= GetSysDate();
|
|
etm <<= GetSysTime();
|
|
|
|
edtnn <<= GetSysDate();
|
|
etmnn <<= GetSysTime();
|
|
|
|
ddt <<= GetSysDate();
|
|
dtm <<= GetSysTime();
|
|
|
|
ac.AddColumn("One");
|
|
ac.AddColumn("Two");
|
|
ac.Add("Hello", 1234);
|
|
ac.Add(23.8, "servus");
|
|
ac.Add("foo", true);
|
|
ac.Add("bar", "lee");
|
|
ac.Add(23.8, "servus");
|
|
ac.Add("foo", true);
|
|
ac.Add("bar", "lee");
|
|
ac.Add(23.8, "servus");
|
|
ac.Add("foo", true);
|
|
ac.Add("bar", "lee");
|
|
ac.Add(23.8, "servus");
|
|
ac.Add("foo", true);
|
|
ac.Add("bar", "lee");
|
|
|
|
StringStream s;
|
|
Color cl;
|
|
s % cl;
|
|
|
|
sl <<= 0;
|
|
|
|
dl.Add(0,"First");
|
|
dl.Add(1,"Second");
|
|
dl.Add(2,"Third");
|
|
dl.Add(3,"Fourth");
|
|
|
|
|
|
Vector<int> parent, parent2;
|
|
parent.Add(0);
|
|
tr.SetRoot(Image(), "The Tree");
|
|
for(int i = 1; i < 10000; i++) {
|
|
parent.Add(tr.Add(parent[rand() % parent.GetCount()], Image(),
|
|
FormatIntRoman(i, true)));
|
|
if((rand() & 3) == 0)
|
|
tr.Open(parent.Top());
|
|
}
|
|
tr.Open(0);
|
|
|
|
{
|
|
TreeCtrl& tree = dtr->MultiSelect();
|
|
Vector<int> parent, parent2;
|
|
parent.Add(0);
|
|
tree.SetRoot(Image(), "The Tree");
|
|
for(int i = 1; i < 10000; i++) {
|
|
parent.Add(tree.Add(parent[rand() % parent.GetCount()], Image(),
|
|
FormatIntRoman(i, true)));
|
|
if((rand() & 3) == 0)
|
|
tree.Open(parent.Top());
|
|
}
|
|
tree.Open(0);
|
|
}
|
|
|
|
tb.Add(arc.Add(new EditString()).SizePos(),"First");
|
|
tb.Add(arc.Add(new EditString()).SizePos(),"Second");
|
|
tb.Add(arc.Add(new EditString()).SizePos(),"Third");
|
|
|
|
}
|
|
|
|
GUI_APP_MAIN
|
|
{
|
|
StylerTest().Run();
|
|
}
|
|
|