PrusaSlicer-NonPlainar/src/slic3r/GUI/GUI_Utils.hpp

69 lines
1.5 KiB
C++
Raw Normal View History

2018-10-04 09:12:55 +00:00
#ifndef slic3r_GUI_Utils_hpp_
#define slic3r_GUI_Utils_hpp_
#include <functional>
#include <string>
#include <boost/optional.hpp>
2018-10-04 09:12:55 +00:00
#include <wx/filedlg.h>
#include <wx/gdicmn.h>
2018-10-04 09:12:55 +00:00
class wxCheckBox;
class wxTopLevelWindow;
class wxRect;
2018-10-04 09:12:55 +00:00
namespace Slic3r {
namespace GUI {
class CheckboxFileDialog : public wxFileDialog
{
public:
CheckboxFileDialog(wxWindow *parent,
const wxString &checkbox_label,
bool checkbox_value,
const wxString &message = wxFileSelectorPromptStr,
const wxString &default_dir = wxEmptyString,
const wxString &default_file = wxEmptyString,
const wxString &wildcard = wxFileSelectorDefaultWildcardStr,
long style = wxFD_DEFAULT_STYLE,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
const wxString &name = wxFileDialogNameStr
);
bool get_checkbox_value() const;
private:
std::function<wxWindow*(wxWindow*)> extra_control_creator;
wxCheckBox *cbox;
2018-10-19 11:38:35 +00:00
static wxWindow* control_creator_trampoline(wxWindow *);
2018-10-04 09:12:55 +00:00
};
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();
};
2018-10-04 09:12:55 +00:00
}}
#endif