2024-07-17 02:51:02 +00:00
|
|
|
#ifndef slic3r_DragDropPanel_hpp_
|
|
|
|
#define slic3r_DragDropPanel_hpp_
|
|
|
|
|
|
|
|
#include "GUI.hpp"
|
|
|
|
#include "GUI_Utils.hpp"
|
|
|
|
|
|
|
|
#include <wx/simplebook.h>
|
|
|
|
#include <wx/dialog.h>
|
|
|
|
#include <wx/timer.h>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
namespace Slic3r { namespace GUI {
|
|
|
|
class ColorPanel;
|
|
|
|
class DragDropPanel : public wxPanel
|
|
|
|
{
|
|
|
|
public:
|
2024-08-09 09:46:11 +00:00
|
|
|
DragDropPanel(wxWindow *parent, const wxString &label, bool is_auto);
|
2024-07-17 02:51:02 +00:00
|
|
|
|
|
|
|
void AddColorBlock(const wxColour &color, int filament_id);
|
|
|
|
void RemoveColorBlock(ColorPanel *panel);
|
|
|
|
void DoDragDrop(ColorPanel *panel, const wxColour &color, int filament_id);
|
|
|
|
|
|
|
|
std::vector<int> GetAllFilaments() const;
|
|
|
|
|
|
|
|
void set_is_draging(bool is_draging) { m_is_draging = is_draging; }
|
|
|
|
bool is_draging() const { return m_is_draging; }
|
|
|
|
|
2024-09-23 03:38:10 +00:00
|
|
|
std::vector<ColorPanel *> get_filament_blocks() const { return m_filament_blocks; }
|
|
|
|
|
2024-07-17 02:51:02 +00:00
|
|
|
private:
|
|
|
|
wxBoxSizer *m_sizer;
|
|
|
|
wxGridSizer *m_grid_item_sizer;
|
2024-08-09 09:46:11 +00:00
|
|
|
bool m_is_auto;
|
2024-07-17 02:51:02 +00:00
|
|
|
|
2024-09-23 03:38:10 +00:00
|
|
|
std::vector<ColorPanel *> m_filament_blocks;
|
2024-07-17 02:51:02 +00:00
|
|
|
private:
|
|
|
|
bool m_is_draging = false;
|
|
|
|
};
|
2024-09-23 03:38:10 +00:00
|
|
|
|
|
|
|
/////////////// ColorPanel start ////////////////////////
|
|
|
|
// The UI panel of drag item
|
|
|
|
class ColorPanel : public wxPanel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ColorPanel(DragDropPanel *parent, const wxColour &color, int filament_id);
|
|
|
|
|
|
|
|
wxColour GetColor() const { return GetBackgroundColour(); }
|
|
|
|
int GetFilamentId() const { return m_filament_id; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
void OnLeftDown(wxMouseEvent &event);
|
|
|
|
void OnLeftUp(wxMouseEvent &event);
|
|
|
|
void OnPaint(wxPaintEvent &event);
|
|
|
|
|
|
|
|
DragDropPanel *m_parent;
|
|
|
|
wxColor m_color;
|
|
|
|
int m_filament_id;
|
|
|
|
};
|
2024-07-17 02:51:02 +00:00
|
|
|
}} // namespace Slic3r::GUI
|
|
|
|
|
|
|
|
#endif /* slic3r_DragDropPanel_hpp_ */
|