summaryrefslogtreecommitdiff
path: root/src/Fl_Window_Driver.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-11-04 11:30:45 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2023-11-05 19:42:55 +0100
commit0ae927a00e9ecd45a45edf004e939ab2e5ce4813 (patch)
treed2d585d0d6088494b23529fc43dde9a7cdf330b3 /src/Fl_Window_Driver.cxx
parenta31409f7bbe7db51f63c79b16358d64ae6e2d4bb (diff)
Add Fl_Window::maximize() and Fl_Window::un_maximize()
Diffstat (limited to 'src/Fl_Window_Driver.cxx')
-rw-r--r--src/Fl_Window_Driver.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx
index 25d2554c6..085c9f61e 100644
--- a/src/Fl_Window_Driver.cxx
+++ b/src/Fl_Window_Driver.cxx
@@ -286,6 +286,34 @@ Fl_Window *Fl_Window_Driver::find(fl_uintptr_t xid) {
return 0;
}
+
+void Fl_Window_Driver::maximize() {
+ *no_fullscreen_x() = x();
+ *no_fullscreen_y() = y();
+ *no_fullscreen_w() = w();
+ *no_fullscreen_h() = h();
+ int X,Y,W,H;
+ Fl::screen_work_area(X, Y, W, H, screen_num());
+ int width = decorated_w();
+ int height = decorated_h();
+ int dw = (width - w());
+ int dh = (height - h() - dw);
+ bool need_hide_show = maximize_needs_hide();
+ if (need_hide_show) hide(); // pb may occur in subwindow without this
+ resize(X + dw/2, Y + dh + dw/2, W - dw, H - dh - dw);
+ if (need_hide_show) show();
+}
+
+
+void Fl_Window_Driver::un_maximize() {
+ resize(*no_fullscreen_x(), *no_fullscreen_y(),
+ *no_fullscreen_w(), *no_fullscreen_h());
+ *no_fullscreen_x() = 0;
+ *no_fullscreen_y() = 0;
+ *no_fullscreen_w() = 0;
+ *no_fullscreen_h() = 0;
+}
+
/**
\}
\endcond