mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Add the full source of BambuStudio
using version 1.0.10
This commit is contained in:
parent
30bcadab3e
commit
1555904bef
3771 changed files with 1251328 additions and 0 deletions
137
src/slic3r/GUI/ImageGrid.h
Normal file
137
src/slic3r/GUI/ImageGrid.h
Normal file
|
@ -0,0 +1,137 @@
|
|||
//
|
||||
// ImageGrid.h
|
||||
// libslic3r_gui
|
||||
//
|
||||
// Created by cmguo on 2021/12/7.
|
||||
//
|
||||
|
||||
#ifndef ImageGrid_h
|
||||
#define ImageGrid_h
|
||||
|
||||
#include <wx/window.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "Widgets/StateColor.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
|
||||
class Button;
|
||||
class Label;
|
||||
|
||||
class PrinterFileSystem;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class MachineObject;
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class ImageGrid : public wxWindow
|
||||
{
|
||||
public:
|
||||
ImageGrid(wxWindow * parent);
|
||||
|
||||
void SetFileSystem(boost::shared_ptr<PrinterFileSystem> file_sys);
|
||||
|
||||
void SetStatus(wxBitmap const & icon, wxString const &msg);
|
||||
|
||||
boost::shared_ptr<PrinterFileSystem> GetFileSystem() { return m_file_sys; }
|
||||
|
||||
void SetFileType(int type);
|
||||
|
||||
void SetGroupMode(int mode);
|
||||
|
||||
void SetSelecting(bool selecting);
|
||||
|
||||
bool IsSelecting() { return m_selecting; }
|
||||
|
||||
void DoActionOnSelection(int action);
|
||||
|
||||
public:
|
||||
void Rescale();
|
||||
|
||||
protected:
|
||||
void Select(size_t index);
|
||||
|
||||
void DoAction(size_t index, int action);
|
||||
|
||||
void UpdateFileSystem();
|
||||
|
||||
void UpdateLayout();
|
||||
|
||||
void UpdateFocusRange();
|
||||
|
||||
std::pair<int, size_t> HitTest(wxPoint const &pt);
|
||||
|
||||
protected:
|
||||
|
||||
void changedEvent(wxCommandEvent& evt);
|
||||
|
||||
void paintEvent(wxPaintEvent& evt);
|
||||
|
||||
size_t firstItem(wxSize const &size, wxPoint &off);
|
||||
|
||||
wxBitmap createAlphaBitmap(wxSize size, wxColour color, int alpha1, int alpha2);
|
||||
|
||||
wxBitmap createCircleBitmap(wxSize size, int borderWidth, int percent, wxColour fillColor, wxColour borderColor = wxTransparentColour);
|
||||
|
||||
void render(wxDC &dc);
|
||||
|
||||
void renderButtons(wxDC &dc, wxStringList const &texts, wxRect const &rect, size_t hit);
|
||||
|
||||
void renderText(wxDC &dc, wxString const & text, wxRect const & rect, int state);
|
||||
|
||||
// some useful events
|
||||
void mouseMoved(wxMouseEvent& event);
|
||||
void mouseWheelMoved(wxMouseEvent& event);
|
||||
void mouseEnterWindow(wxMouseEvent& event);
|
||||
void mouseLeaveWindow(wxMouseEvent& event);
|
||||
void mouseDown(wxMouseEvent& event);
|
||||
void mouseReleased(wxMouseEvent& event);
|
||||
void resize(wxSizeEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
boost::shared_ptr<PrinterFileSystem> m_file_sys;
|
||||
wxBitmap m_status_icon;
|
||||
wxString m_status_msg;
|
||||
|
||||
std::string m_save_path;
|
||||
|
||||
ScalableBitmap m_checked_icon;
|
||||
ScalableBitmap m_unchecked_icon;
|
||||
StateColor m_buttonBackgroundColor;
|
||||
StateColor m_buttonTextColor;
|
||||
|
||||
bool m_hovered = false;
|
||||
bool m_pressed = false;
|
||||
|
||||
wxTimer m_timer;
|
||||
wxBitmap m_mask;
|
||||
wxBitmap m_buttons_background;
|
||||
// wxBitmap m_button_background;
|
||||
wxBitmap m_progress_background;
|
||||
int m_background_progress = 0;
|
||||
|
||||
bool m_selecting = false;
|
||||
|
||||
enum HitType {
|
||||
HIT_NONE,
|
||||
HIT_ITEM,
|
||||
HIT_ACTION, // implicit HTI_ITEM
|
||||
HIT_MODE,
|
||||
HIT_STATUS
|
||||
};
|
||||
int m_hit_type = HIT_NONE;
|
||||
size_t m_hit_item = size_t(-1);
|
||||
|
||||
int m_row_offset = 0; // 1/4 row height
|
||||
int m_row_count = 0; // 1/4 row height
|
||||
int m_col_count = 1;
|
||||
wxSize m_image_size;
|
||||
wxSize m_cell_size;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif /* ImageGrid_h */
|
Loading…
Add table
Add a link
Reference in a new issue