2020-10-13 10:17:39 +00:00
|
|
|
#ifndef slic3r_OG_CustomCtrl_hpp_
|
|
|
|
#define slic3r_OG_CustomCtrl_hpp_
|
|
|
|
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/settings.h>
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
#include "libslic3r/Config.hpp"
|
|
|
|
#include "libslic3r/PrintConfig.hpp"
|
|
|
|
|
|
|
|
#include "OptionsGroup.hpp"
|
|
|
|
#include "I18N.hpp"
|
|
|
|
|
|
|
|
// Translate the ifdef
|
|
|
|
#ifdef __WXOSX__
|
|
|
|
#define wxOSX true
|
|
|
|
#else
|
|
|
|
#define wxOSX false
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace Slic3r { namespace GUI {
|
|
|
|
|
|
|
|
// Static text shown among the options.
|
2020-10-30 11:24:33 +00:00
|
|
|
class OG_CustomCtrl :public wxPanel
|
2020-10-13 10:17:39 +00:00
|
|
|
{
|
2020-10-22 20:38:23 +00:00
|
|
|
wxFont m_font;
|
|
|
|
int m_v_gap;
|
|
|
|
int m_h_gap;
|
2020-10-23 17:17:10 +00:00
|
|
|
int m_em_unit;
|
2020-10-13 10:17:39 +00:00
|
|
|
|
2020-10-23 17:17:10 +00:00
|
|
|
wxSize m_bmp_mode_sz;
|
|
|
|
wxSize m_bmp_blinking_sz;
|
2020-10-13 10:17:39 +00:00
|
|
|
|
|
|
|
struct CtrlLine {
|
2020-10-22 20:38:23 +00:00
|
|
|
wxCoord height { wxDefaultCoord };
|
|
|
|
OG_CustomCtrl* ctrl { nullptr };
|
|
|
|
const Line& og_line;
|
2020-10-13 10:17:39 +00:00
|
|
|
|
|
|
|
bool draw_just_act_buttons { false };
|
|
|
|
bool is_visible { true };
|
2020-10-29 20:53:33 +00:00
|
|
|
bool is_focused { false };
|
2020-10-13 10:17:39 +00:00
|
|
|
|
2020-10-26 18:38:09 +00:00
|
|
|
CtrlLine( wxCoord height,
|
|
|
|
OG_CustomCtrl* ctrl,
|
|
|
|
const Line& og_line,
|
|
|
|
bool draw_just_act_buttons = false);
|
2020-10-23 17:17:10 +00:00
|
|
|
~CtrlLine() { ctrl = nullptr; }
|
|
|
|
|
|
|
|
void correct_items_positions();
|
|
|
|
void msw_rescale();
|
2020-10-22 20:38:23 +00:00
|
|
|
void update_visibility(ConfigOptionMode mode);
|
|
|
|
|
2020-10-13 10:17:39 +00:00
|
|
|
void render(wxDC& dc, wxCoord v_pos);
|
|
|
|
wxCoord draw_mode_bmp(wxDC& dc, wxCoord v_pos);
|
2020-10-29 20:53:33 +00:00
|
|
|
wxCoord draw_text (wxDC& dc, wxPoint pos, const wxString& text, const wxColour* color, int width, bool is_url = false);
|
2020-10-27 21:19:12 +00:00
|
|
|
wxPoint draw_blinking_bmp(wxDC& dc, wxPoint pos, bool is_blinking, size_t rect_id = 0);
|
|
|
|
wxCoord draw_act_bmps(wxDC& dc, wxPoint pos, const wxBitmap& bmp_undo_to_sys, const wxBitmap& bmp_undo, bool is_blinking, size_t rect_id = 0);
|
2020-10-29 20:53:33 +00:00
|
|
|
bool launch_browser() const;
|
2020-10-26 18:38:09 +00:00
|
|
|
|
|
|
|
std::vector<wxRect> rects_undo_icon;
|
|
|
|
std::vector<wxRect> rects_undo_to_sys_icon;
|
2020-10-29 20:53:33 +00:00
|
|
|
wxRect rect_label;
|
2020-10-13 10:17:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<CtrlLine> ctrl_lines;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OG_CustomCtrl( wxWindow* parent,
|
|
|
|
OptionsGroup* og,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
const wxValidator& val = wxDefaultValidator,
|
|
|
|
const wxString& name = wxEmptyString);
|
|
|
|
~OG_CustomCtrl() {}
|
|
|
|
|
|
|
|
void OnPaint(wxPaintEvent&);
|
|
|
|
void OnMotion(wxMouseEvent& event);
|
|
|
|
void OnLeftDown(wxMouseEvent& event);
|
2020-11-03 12:40:49 +00:00
|
|
|
void OnLeaveWin(wxMouseEvent& event);
|
2020-10-13 10:17:39 +00:00
|
|
|
|
|
|
|
void init_ctrl_lines();
|
|
|
|
bool update_visibility(ConfigOptionMode mode);
|
2020-10-22 20:38:23 +00:00
|
|
|
void correct_window_position(wxWindow* win, const Line& line, Field* field = nullptr);
|
|
|
|
void correct_widgets_position(wxSizer* widget, const Line& line, Field* field = nullptr);
|
|
|
|
|
2020-10-13 10:17:39 +00:00
|
|
|
void msw_rescale();
|
|
|
|
void sys_color_changed();
|
|
|
|
|
|
|
|
wxPoint get_pos(const Line& line, Field* field = nullptr);
|
2020-10-21 20:26:41 +00:00
|
|
|
int get_height(const Line& line);
|
2020-10-13 10:17:39 +00:00
|
|
|
|
2020-10-22 20:38:23 +00:00
|
|
|
OptionsGroup* opt_group;
|
2020-10-13 10:17:39 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
#endif /* slic3r_OG_CustomCtrl_hpp_ */
|