IconDes: Button to enter color as text

git-svn-id: svn://ultimatepp.org/upp/trunk@13444 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-06-26 16:58:36 +00:00
parent d451e400fd
commit 721327c4ff
3 changed files with 16 additions and 0 deletions

View file

@ -63,6 +63,7 @@ private:
ColorRampCtrl ramp;
AlphaCtrl alpha;
EditString text;
FrameRight<Button> setcolor;
Ptr<Ctrl> subctrl;
Color GetColor(int i) const;

View file

@ -216,6 +216,21 @@ RGBACtrl::RGBACtrl()
text.SetFont(CourierZ(11));
text.NoWantFocus();
text.SetReadOnly();
text.SetFrame(BlackFrame());
text.AddFrame(setcolor);
setcolor.Width(CtrlImg::color_edit().GetSize().cx + DPI(8));
setcolor.SetImage(CtrlImg::color_edit());
setcolor << [=] {
String text;
if(!IsNull(color) && color != VoidColor())
text = ColorToHtml(color);
EditText(text, "Set Color", "Color value");
Color c = ColorFromText(text);
if(IsNull(c))
return;
Set(c);
UpdateActionRefresh();
};
Add(text);
SyncText();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Before After
Before After