MaxMinimize on titlebar doubleclick

This commit is contained in:
Mirek Fidler 2026-01-01 17:44:14 +01:00
parent 3ad4fcf83b
commit 231b26fcb7
5 changed files with 12 additions and 3 deletions

View file

@ -2,7 +2,7 @@
namespace Upp {
#define LLOG(x) // DLOG(x)
#define LLOG(x) DLOG(x)
Ptr<Ctrl> Ctrl::eventCtrl;
Ptr<Ctrl> Ctrl::mouseCtrl;

View file

@ -36,6 +36,12 @@ void TopWindow::CustomBarIcon::MouseLeave()
Refresh();
}
void TopWindow::BarCtrl::LeftDouble(Point p, dword keyflags)
{
DLOG("HERE!");
WhenAction();
}
void TopWindow::Init()
{
custom_titlebar_metrics__ = [](const TopWindow *tw, TopWindow::CustomTitleBarMetrics& m) {
@ -124,7 +130,7 @@ Ctrl *TopWindow::MakeCustomTitleBar__(Color bk, int mincy)
if(w)
gtk_window_iconify(w);
};
maxicon << [=] {
*custom_bar ^= maxicon ^= [=] {
GtkWindow *w = gtk();
if(w) {
if(gtk_window_is_maximized(w))

View file

@ -14,10 +14,13 @@
void Set(const Image& m) { if(!m.IsSame(img)) { img = m; Refresh(); }}
};
struct BarCtrl : public Ctrl {
void LeftDouble(Point p, dword keyflags) override;
};
One<FrameTop<Ctrl>> custom_bar_frame;
One<FrameRight<Ctrl>> custom_bar_icons;
One<Ctrl> custom_bar;
One<BarCtrl> custom_bar;
CustomBarIcon minicon, maxicon, closeicon;
Color custom_titlebar_bk = SColorFace();
int custom_titlebar_cy = -1;