50 #ifndef MATERIALPICKER_HH 51 #define MATERIALPICKER_HH 63 #include <ACG/Utils/SmartPointer.hh> 75 #if QT_VERSION >= 0x050000 76 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-MaterialPicker")
80 void addPickMode(
const std::string &_mode);
84 void addToolbox( QString _name , QWidget* _widget, QIcon* _icon);
86 void registerKey(
int _key, Qt::KeyboardModifiers _modifiers, QString _description,
bool _multiUse =
false);
90 void slotMouseEvent(QMouseEvent* _event);
92 void slotPickModeChanged(
const std::string& _mode);
94 void slotKeyEvent (QKeyEvent* _event);
101 QString
name(){
return QString(
"MaterialPicker");}
102 QString
description(){
return QString(
"Pick to store and set materials.");}
118 const std::string pickModeName_;
119 const QString propName_;
120 static const unsigned supportedKeys_ = 3;
122 QPushButton* pickMaterialButton_;
123 QPushButton* fillMaterialButton_;
126 QListWidget* materialListWidget_;
127 QVector<MaterialInfo> materialList_;
128 QStringList materialStrings_;
131 std::map<int,size_t> shortKeyRow_;
133 ptr::shared_ptr<MaterialNode> materialNode_;
142 QString
itemName(
const QString &_name,
int _key);
145 QString
plainName(
const QString &
string,
int index);
149 void initializePlugin();
151 void pluginsInitialized();
153 void slotPickMaterialMode();
155 void slotFillMaterialMode();
157 void slotRemoveCurrentItem();
160 void editMode(QListWidgetItem* _item);
162 void editModeCurrent();
165 void saveNewName ( QWidget * _editor, QAbstractItemDelegate::EndEditHint _hint );
173 void removeItem(QListWidgetItem* _item);
181 void slotMaterialProperties();
183 void slotEnableListWidget(
int _save);
185 void slotMaterialChanged();
188 QString version(){
return QString(
"1.0"); }
192 #endif //MATERIALPICKER_HH Interface class for receiving mouse events.
QString name()
Return a name for the plugin.
Keyboard Event Interface.
QString plainName(const QString &string, int index)
returns the plain name of the material without hotkey hint
Interface class from which all plugins have to be created.
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
void changeHotKey(const int _key)
change specified HotKey to current item
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
QString description()
Return a description of what the plugin is doing.
QString materialString(const MaterialInfo &_mat, const QString &_name)
returns a formatted string for saving
void saveNewName(QWidget *_editor, QAbstractItemDelegate::EndEditHint _hint)
saves the new material name with hotkey hint
QString itemName(const QString &_name, int _key)
returns the item name with hotkey hint
bool pickMaterial_
stores the state of the pick material button
void editMode(QListWidgetItem *_item)
items can be renamed by double clicking them
Allow access to picking functions.