From 32b79c324ede67191f61d4c815001fa9f07cf8be Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 31 Aug 2018 16:41:38 +0000 Subject: [PATCH] CtrlCore: Cocoa Minimize, Maximize, Overlap git-svn-id: svn://ultimatepp.org/upp/trunk@12218 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/CocoCreate.mm | 36 +++++++++++++++++++++++++++++++++++ uppsrc/CtrlCore/CocoTop.cpp | 16 ---------------- uppsrc/CtrlCore/cocotodo.txt | 14 +++++++------- 3 files changed, 43 insertions(+), 23 deletions(-) diff --git a/uppsrc/CtrlCore/CocoCreate.mm b/uppsrc/CtrlCore/CocoCreate.mm index ef7f74b14..ecfe2d590 100644 --- a/uppsrc/CtrlCore/CocoCreate.mm +++ b/uppsrc/CtrlCore/CocoCreate.mm @@ -225,6 +225,10 @@ void Upp::TopWindow::Open(Ctrl *owner) SyncCaption(); SyncSizeHints(); PlaceFocus(); + if(state == MAXIMIZED) + Maximize(); + if(state == MINIMIZED) + Minimize(); // if(top) // top->placefocus = true; } @@ -315,4 +319,36 @@ void Upp::TopWindow::SerializePlacement(Stream& s, bool reminimize) SetRect(rect); } +void Upp::TopWindow::Maximize(bool effect) +{ + state = MAXIMIZED; + if(top && top->coco && top->coco->window && !top->coco->window.zoomed) { + if(effect) + [top->coco->window performZoom:top->coco->window]; + else + [top->coco->window zoom:top->coco->window]; + } +} + +void Upp::TopWindow::Minimize(bool effect) +{ + state = MINIMIZED; + if(top && top->coco && top->coco->window && !top->coco->window.miniaturized) { + if(effect) + [top->coco->window performMiniaturize:top->coco->window]; + else + [top->coco->window miniaturize:top->coco->window]; + } +} + +void Upp::TopWindow::Overlap(bool effect) +{ + state = OVERLAPPED; + if(top && top->coco && top->coco->window && top->coco->window.zoomed) + [top->coco->window zoom:top->coco->window]; + if(top && top->coco && top->coco->window && top->coco->window.miniaturized) + [top->coco->window deminiaturize:top->coco->window]; +} + + #endif diff --git a/uppsrc/CtrlCore/CocoTop.cpp b/uppsrc/CtrlCore/CocoTop.cpp index cae3a162f..a69a5f5d4 100644 --- a/uppsrc/CtrlCore/CocoTop.cpp +++ b/uppsrc/CtrlCore/CocoTop.cpp @@ -6,27 +6,11 @@ NAMESPACE_UPP #define LLOG(x) // LOG(x) -void TopWindow::Minimize(bool effect) -{ - state = MINIMIZED; -} - TopWindow& TopWindow::FullScreen(bool b) { return *this; } -void TopWindow::Maximize(bool effect) -{ - state = MAXIMIZED; -} - -void TopWindow::Overlap(bool effect) -{ - GuiLock __; - state = OVERLAPPED; -} - TopWindow& TopWindow::TopMost(bool b, bool stay_top) { GuiLock __; diff --git a/uppsrc/CtrlCore/cocotodo.txt b/uppsrc/CtrlCore/cocotodo.txt index 1f165a382..9c06d7339 100644 --- a/uppsrc/CtrlCore/cocotodo.txt +++ b/uppsrc/CtrlCore/cocotodo.txt @@ -1,7 +1,5 @@ sooner: -- replacement fonts -- minimize, maximaze - fix package organiser link options (joining link options missing space) - implement missing Draw ops @@ -30,14 +28,16 @@ later: - keynames apple style -- Mac menu -- Clipboard types -- Drag&Drop -- System colors -- Chameleon +* Mac menu +* Clipboard types +* Drag&Drop +* System colors +* Chameleon done: +- replacement fonts +- minimize, maximaze - void WakeUpGuiThread(void) - not all additional cursors are correct - ignoreclick