mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 04:31:58 +08:00
Stubbed out UI_Slider class.
This commit is contained in:
parent
cdb7053034
commit
193297a92d
@ -311,6 +311,7 @@ IF(wxWidgets_FOUND)
|
||||
${GUI_LIBDIR}/OptionsGroup/UI_Point.cpp
|
||||
${GUI_LIBDIR}/OptionsGroup/UI_Point3.cpp
|
||||
${GUI_LIBDIR}/OptionsGroup/UI_Color.cpp
|
||||
${GUI_LIBDIR}/OptionsGroup/UI_Slider.cpp
|
||||
${LIBDIR}/slic3r/GUI/3DScene.cpp
|
||||
)
|
||||
target_compile_features(slic3r_gui PUBLIC cxx_std_14)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "wx/sizer.h"
|
||||
#include <wx/colour.h>
|
||||
#include <wx/clrpicker.h>
|
||||
#include <wx/slider.h>
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
@ -418,6 +419,37 @@ private:
|
||||
wxColourPickerCtrl* _picker {nullptr};
|
||||
};
|
||||
|
||||
class UI_Slider : public UI_Sizer {
|
||||
public:
|
||||
UI_Slider(wxWindow* parent, Slic3r::ConfigOptionDef _opt);
|
||||
UI_Slider(wxWindow* parent, Slic3r::ConfigOptionDef _opt, size_t scale);
|
||||
|
||||
~UI_Slider();
|
||||
|
||||
void set_value(boost::any value) override;
|
||||
std::string get_string() override;
|
||||
double get_double() override;
|
||||
int get_int() override;
|
||||
|
||||
/// Change the scale of the slider bar. Return value from get_X functions does not change.
|
||||
void set_scale(size_t new_scale);
|
||||
|
||||
wxSlider* slider() { return _slider;}
|
||||
wxTextCtrl* textctrl() { return _textctrl;}
|
||||
std::function<void (const std::string&, const double&)> on_change {nullptr};
|
||||
protected:
|
||||
virtual std::string LogChannel() override { return "UI_Slider"s; }
|
||||
private:
|
||||
void _on_change(std::string opt_id) override {
|
||||
if (!this->disable_change_event && this->_slider->IsEnabled() && this->on_change != nullptr) {
|
||||
this->on_change(opt_id, _slider->GetValue() / _scale);
|
||||
}
|
||||
}
|
||||
wxTextCtrl* _textctrl {nullptr};
|
||||
wxSlider* _slider {nullptr};
|
||||
size_t _scale {10};
|
||||
};
|
||||
|
||||
} } // Namespace Slic3r::GUI
|
||||
|
||||
#endif // SLIC3R_FIELD_HPP
|
||||
|
30
src/GUI/OptionsGroup/UI_Slider.cpp
Normal file
30
src/GUI/OptionsGroup/UI_Slider.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include "OptionsGroup/Field.hpp"
|
||||
#include "misc_ui.hpp"
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
UI_Slider::UI_Slider(wxWindow* parent, Slic3r::ConfigOptionDef _opt) : UI_Sizer(parent, _opt), _scale(10) {
|
||||
}
|
||||
UI_Slider::UI_Slider(wxWindow* parent, Slic3r::ConfigOptionDef _opt, size_t scale ) : UI_Sizer(parent, _opt), _scale(scale) {
|
||||
|
||||
}
|
||||
UI_Slider::~UI_Slider() { _slider->Destroy(); _textctrl->Destroy(); }
|
||||
|
||||
void UI_Slider::set_value(boost::any value) {
|
||||
}
|
||||
|
||||
double UI_Slider::get_double() {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
int UI_Slider::get_int() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string UI_Slider::get_string() {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
void UI_Slider::set_scale(size_t new_scale) {
|
||||
}
|
||||
} } // Namespace Slic3r::GUI
|
Loading…
x
Reference in New Issue
Block a user