44#ifndef MATERIALPICKER_HH
45#define MATERIALPICKER_HH
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_;
124 QVector<MaterialInfo> materialList_;
125 QStringList materialStrings_;
128 std::map<int,size_t> shortKeyRow_;
130 ptr::shared_ptr<MaterialNode> materialNode_;
139 QString
itemName(
const QString &_name,
int _key);
142 QString
plainName(
const QString &
string,
int index);
146 void initializePlugin();
148 void pluginsInitialized();
150 void slotPickMaterialMode();
152 void slotFillMaterialMode();
154 void slotRemoveCurrentItem();
157 void editMode(QListWidgetItem* _item);
159 void editModeCurrent();
162 void saveNewName ( QWidget * _editor, QAbstractItemDelegate::EndEditHint _hint );
170 void removeItem(QListWidgetItem* _item);
178 void slotMaterialProperties();
180 void slotEnableListWidget(
int _save);
182 void slotMaterialChanged();
185 QString version(){
return QString(
"1.0"); }
Interface class from which all plugins have to be created.
Keyboard Event Interface.
bool fillMaterial_
stores the state of the fill material button
bool pickMaterial_
stores the state of the pick material button
QString materialString(const MaterialInfo &_mat, const QString &_name)
returns a formatted string for saving
QString description()
Return a description of what the plugin is doing.
void saveNewName(QWidget *_editor, QAbstractItemDelegate::EndEditHint _hint)
saves the new material name with hotkey hint
void changeHotKey(const int _key)
change specified HotKey to current item
QString name()
Return a name for the plugin.
void editMode(QListWidgetItem *_item)
items can be renamed by double clicking them
QString itemName(const QString &_name, int _key)
returns the item name with hotkey hint
QString plainName(const QString &string, int index)
returns the plain name of the material without hotkey hint
void createContextMenu(const QPoint &_point)
creates context menu on current item (current is the item at mouse position)
Interface class for receiving mouse events.
Allow access to picking functions.