44 #ifndef MATERIALPICKER_HH 45 #define MATERIALPICKER_HH 49 #include <QPushButton> 50 #include <QListWidget> 59 #include <ACG/Utils/SmartPointer.hh> 71 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-MaterialPicker")
74 void addPickMode(
const std::string &_mode);
78 void addToolbox( QString _name , QWidget* _widget, QIcon* _icon);
80 void registerKey(
int _key, Qt::KeyboardModifiers _modifiers, QString _description,
bool _multiUse =
false);
84 void slotMouseEvent(QMouseEvent* _event);
86 void slotPickModeChanged(
const std::string& _mode);
88 void slotKeyEvent (QKeyEvent* _event);
95 QString
name(){
return QString(
"MaterialPicker");}
96 QString
description(){
return QString(
"Pick to store and set materials.");}
112 const std::string pickModeName_;
113 const QString propName_;
114 static const unsigned supportedKeys_ = 3;
116 QPushButton* pickMaterialButton_;
117 QPushButton* fillMaterialButton_;
120 QListWidget* materialListWidget_;
121 QVector<MaterialInfo> materialList_;
122 QStringList materialStrings_;
125 std::map<int,size_t> shortKeyRow_;
127 ptr::shared_ptr<MaterialNode> materialNode_;
136 QString
itemName(
const QString &_name,
int _key);
139 QString
plainName(
const QString &
string,
int index);
143 void initializePlugin();
145 void pluginsInitialized();
147 void slotPickMaterialMode();
149 void slotFillMaterialMode();
151 void slotRemoveCurrentItem();
154 void editMode(QListWidgetItem* _item);
156 void editModeCurrent();
159 void saveNewName ( QWidget * _editor, QAbstractItemDelegate::EndEditHint _hint );
167 void removeItem(QListWidgetItem* _item);
175 void slotMaterialProperties();
177 void slotEnableListWidget(
int _save);
179 void slotMaterialChanged();
182 QString version(){
return QString(
"1.0"); }
186 #endif //MATERIALPICKER_HH void createContextMenu(const QPoint &_point)
creates context menu on current item (current is the item at mouse position)
bool fillMaterial_
stores the state of the fill material button
void changeHotKey(const int _key)
change specified HotKey to current item
QString itemName(const QString &_name, int _key)
returns the item name with hotkey hint
Interface class for receiving mouse events.
Allow access to picking functions.
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
QString materialString(const MaterialInfo &_mat, const QString &_name)
returns a formatted string for saving
Interface class from which all plugins have to be created.
QString description()
Return a description of what the plugin is doing.
bool pickMaterial_
stores the state of the pick material button
QString name()
Return a name for the plugin.
Keyboard Event Interface.
void editMode(QListWidgetItem *_item)
items can be renamed by double clicking them
QString plainName(const QString &string, int index)
returns the plain name of the material without hotkey hint
void saveNewName(QWidget *_editor, QAbstractItemDelegate::EndEditHint _hint)
saves the new material name with hotkey hint