mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-24 06:12:35 -06:00
Merge continued
git-svn-id: svn://ultimatepp.org/upp/trunk@10263 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
adf46bd64e
commit
2e4b276e07
3860 changed files with 1161787 additions and 438 deletions
71
uppdev/DropPane/DropPane.cpp
Normal file
71
uppdev/DropPane/DropPane.cpp
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
#include "DropPane.h"
|
||||
|
||||
DropPane::DropPane()
|
||||
{
|
||||
Add(btnDrop);
|
||||
btnDrop.WhenAction = THISBACK(Togle);
|
||||
btnDrop.Set(true);
|
||||
btnDrop.Add(lblText);
|
||||
lblText.SetAlign(ALIGN_CENTER);
|
||||
lastHeight = 20;
|
||||
}
|
||||
|
||||
DropPane::~DropPane()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DropPane::SetRect(int x, int y, int cx, int cy)
|
||||
{
|
||||
Ctrl::SetRect(x, y, cx, cy);
|
||||
if (btnDrop.Get())
|
||||
lastHeight = cy;
|
||||
btnDrop.SetRect(3, 0, cx - 7, 20);
|
||||
lblText.SetRect(0, 0, btnDrop.GetRect().Width(), btnDrop.GetRect().Height());
|
||||
}
|
||||
|
||||
void DropPane::Paint(Draw& w)
|
||||
{
|
||||
Size sz = GetSize();
|
||||
btnDrop.SetRect(3, 0, sz.cx - 7, 20);
|
||||
lblText.SetRect(0, 0, btnDrop.GetRect().Width(), btnDrop.GetRect().Height());
|
||||
if (btnDrop.Get())
|
||||
lastHeight = sz.cy;
|
||||
if(!IsTransparent())
|
||||
w.DrawRect(sz, /*SColorInfoText()*/SColorFace);
|
||||
|
||||
int d = 5;
|
||||
if (btnDrop.Get() == false)
|
||||
sz.cy = 16;
|
||||
|
||||
w.Begin();
|
||||
|
||||
w.DrawRect(1, d, sz.cx - 2, 1, SColorShadow);
|
||||
w.DrawRect(1, d + 1, sz.cx - 2, 1, SColorLight);
|
||||
|
||||
w.DrawRect(0, d, 1, sz.cy - d - 1, SColorShadow);
|
||||
w.DrawRect(1, d + 1, 1, sz.cy - d - 2, SColorLight);
|
||||
|
||||
w.DrawRect(sz.cx - 2, d, 1, sz.cy - d, SColorShadow);
|
||||
w.DrawRect(sz.cx - 1, d, 1, sz.cy - d, SColorLight);
|
||||
|
||||
w.DrawRect(1, sz.cy - 2, sz.cx - 2, 1, SColorShadow);
|
||||
w.DrawRect(1, sz.cy - 1, sz.cx - 2, 1, SColorLight);
|
||||
|
||||
w.End();
|
||||
}
|
||||
|
||||
void DropPane::SetLabel(const char* label)
|
||||
{
|
||||
lblText.SetLabel(label);
|
||||
}
|
||||
|
||||
void DropPane::Togle()
|
||||
{
|
||||
Rect r = GetRect();
|
||||
if (btnDrop.Get())
|
||||
SetRect(r.left, r.top, r.Width(), lastHeight);
|
||||
else
|
||||
SetRect(r.left, r.top, r.Width(), 20);
|
||||
WhenAction();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue