mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
CtrlCore, ide: Custom TitleBar
This commit is contained in:
parent
ff0949a4a5
commit
0b44641396
21 changed files with 716 additions and 201 deletions
|
|
@ -1,11 +1,11 @@
|
|||
LAYOUT(CompareDirLayout, 496, 492)
|
||||
ITEM(Label, dv___0, SetLabel(t_("Folder &A:")).LeftPosZ(4, 52).TopPosZ(4, 19))
|
||||
ITEM(EditField, path_a, HSizePosZ(56, 4).TopPosZ(4, 19))
|
||||
ITEM(Label, dv___2, SetLabel(t_("Folder &B:")).LeftPosZ(4, 52).TopPosZ(26, 19))
|
||||
ITEM(EditField, path_b, HSizePosZ(56, 4).TopPosZ(26, 19))
|
||||
ITEM(Label, dv___4, SetLabel(t_("File &mask:")).LeftPosZ(4, 52).TopPosZ(48, 19))
|
||||
ITEM(EditField, file_mask, HSizePosZ(56, 68).TopPosZ(48, 19))
|
||||
ITEM(Button, refresh, SetLabel(t_("&Refresh")).RightPosZ(4, 60).TopPosZ(48, 18))
|
||||
ITEM(Upp::Label, dv___0, SetLabel(t_("Folder &A:")).LeftPosZ(4, 52).TopPosZ(4, 19))
|
||||
ITEM(Upp::EditField, path_a, HSizePosZ(56, 4).TopPosZ(4, 19))
|
||||
ITEM(Upp::Label, dv___2, SetLabel(t_("Folder &B:")).LeftPosZ(4, 52).TopPosZ(26, 19))
|
||||
ITEM(Upp::EditField, path_b, HSizePosZ(56, 4).TopPosZ(26, 19))
|
||||
ITEM(Upp::Label, dv___4, SetLabel(t_("File &mask:")).LeftPosZ(4, 52).TopPosZ(48, 19))
|
||||
ITEM(Upp::EditField, file_mask, HSizePosZ(56, 68).TopPosZ(48, 19))
|
||||
ITEM(Upp::Button, refresh, SetLabel(t_("&Refresh")).RightPosZ(4, 60).TopPosZ(48, 18))
|
||||
ITEM(Splitter, splitter, HSizePosZ(4, 4).VSizePosZ(70, 4))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
|
|||
9
examples/CustomTitlebar/CustomTitlebar.upp
Normal file
9
examples/CustomTitlebar/CustomTitlebar.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
55
examples/CustomTitlebar/main.cpp
Normal file
55
examples/CustomTitlebar/main.cpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct MyApp : TopWindow {
|
||||
void Paint(Draw& w) override {
|
||||
Size sz = GetSize();
|
||||
// w.DrawRect(sz, WhiteGray()); return;
|
||||
|
||||
auto h = GetCustomTitleBarMetrics().height;
|
||||
Color c2 = SLtCyan();
|
||||
for(int i = 0; i < h; i++)
|
||||
w.DrawRect(0, i, sz.cx, 1, Blend(WhiteGray(), c2, i * 255 / h));
|
||||
}
|
||||
|
||||
void Layout() override {
|
||||
auto m = GetCustomTitleBarMetrics();
|
||||
int h = bar.GetHeight();
|
||||
bar.LeftPos(m.lm, bar.GetWidth()).TopPos((m.height - h) / 2, h);
|
||||
}
|
||||
|
||||
void MainMenu(Bar& bar)
|
||||
{
|
||||
bar.Sub("File", [=](Bar& bar) {
|
||||
bar.Add("Exit", [=] { Break(); });
|
||||
});
|
||||
}
|
||||
|
||||
MenuBar bar;
|
||||
LineEdit editor;
|
||||
|
||||
MyApp() {
|
||||
Icon(CtrlImg::select_all());
|
||||
|
||||
CustomTitleBar(200);
|
||||
|
||||
Add(bar);
|
||||
bar.Transparent();
|
||||
bar.Set([=](Bar& bar) {
|
||||
MainMenu(bar);
|
||||
});
|
||||
|
||||
DDUMP(bar.GetWidth());
|
||||
DDUMP(bar.GetHeight());
|
||||
|
||||
DDUMP(GetCustomTitleBarMetrics().height);
|
||||
|
||||
Add(editor.VSizePos(GetCustomTitleBarMetrics().height).HSizePos());
|
||||
};
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
MyApp().Sizeable().Zoomable().Run();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue