mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Refactor window position & size persistence
in a way that is hopefully robust wrt. platform quirks
This commit is contained in:
parent
2e274b5646
commit
d4371b6089
6 changed files with 153 additions and 51 deletions
|
@ -2,10 +2,16 @@
|
|||
#define slic3r_GUI_Utils_hpp_
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/gdicmn.h>
|
||||
|
||||
class wxCheckBox;
|
||||
class wxTopLevelWindow;
|
||||
class wxRect;
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
@ -36,6 +42,25 @@ private:
|
|||
};
|
||||
|
||||
|
||||
class WindowMetrics
|
||||
{
|
||||
private:
|
||||
wxRect rect;
|
||||
bool maximized;
|
||||
|
||||
WindowMetrics() : maximized(false) {}
|
||||
public:
|
||||
static WindowMetrics from_window(wxTopLevelWindow *window);
|
||||
static boost::optional<WindowMetrics> deserialize(const std::string &str);
|
||||
|
||||
wxRect get_rect() const { return rect; }
|
||||
bool get_maximized() const { return maximized; }
|
||||
|
||||
void sanitize_for_display(const wxRect &screen_rect);
|
||||
std::string serialize();
|
||||
};
|
||||
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue