Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GUI_Tags.hpp « GUI « slic3r « src - github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9279cb3dc83ec575bc3bdaa31372f11e0dbcf576 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef slic3r_GUI_Tags_hpp_
#define slic3r_GUI_Tags_hpp_

#include "libslic3r/Config.hpp"

#include <wx/checklst.h>
#include <wx/combo.h>

#include "wxExtensions.hpp"

namespace Slic3r {
namespace GUI {


// ----------------------------------------------------------------------------
// ModeButton
// ----------------------------------------------------------------------------

class ModeButton : public ScalableButton
{
public:
    ModeButton(
        wxWindow*           parent,
        wxWindowID          id,
        const std::string&  icon_name = "",
        const wxString&     mode = wxEmptyString,
        const wxSize&       size = wxDefaultSize,
        const wxPoint&      pos = wxDefaultPosition);

    ModeButton(
        wxWindow*           parent,
        const wxString&     mode,
        const std::string&  icon_name,
        int                 px_cnt);

    ModeButton(wxWindow* parent,
        const wxString&     mode,
        wxBitmap*           bitmap,
        int                 px_cnt);

    ~ModeButton() {}

    void Init(const wxString& mode);

    void    OnButton(wxCommandEvent& event);
    void    OnEnterBtn(wxMouseEvent& event) { focus_button(true); event.Skip(); }
    void    OnLeaveBtn(wxMouseEvent& event) { focus_button(m_is_selected); event.Skip(); }

    void    SetState(const bool state);
    bool    is_selected() { return m_is_selected; }

protected:
    void    focus_button(const bool focus);

private:
    bool        m_is_selected = false;

    wxString    m_tt_selected;
    wxString    m_tt_focused;
};



// ----------------------------------------------------------------------------
// ModeSizer
// ----------------------------------------------------------------------------

class ModeSizer : public wxFlexGridSizer
{
public:
    ModeSizer( wxWindow *parent, int hgap, int max_col);
    ~ModeSizer() {}

    void SetMode(const ConfigOptionMode mode);

    void set_items_flag(int flag);
    void set_items_border(int border);

    void msw_rescale();
    const std::vector<ModeButton*>& get_btns() { return m_mode_btns; }

private:
    std::vector<ConfigOptionMode> m_bt_mode;
    std::vector<ModeButton*> m_mode_btns;
    wxWindow*                m_parent {nullptr};
    double                   m_hgap_unscaled;
};

} // namespace slic3r
} // namespace GUI
#endif // slic3r_GUI_Tags_hpp_