20 |
#ifndef GIGEDIT_DIMENSIONMANAGER_H |
#ifndef GIGEDIT_DIMENSIONMANAGER_H |
21 |
#define GIGEDIT_DIMENSIONMANAGER_H |
#define GIGEDIT_DIMENSIONMANAGER_H |
22 |
|
|
23 |
|
#include <glibmm/property.h> |
24 |
|
#include <gtkmm/box.h> |
25 |
#include <gtkmm/window.h> |
#include <gtkmm/window.h> |
26 |
#include <gtkmm/layout.h> |
#include <gtkmm/layout.h> |
27 |
#include <gtkmm/button.h> |
#include <gtkmm/button.h> |
29 |
#include <gtkmm/treeview.h> |
#include <gtkmm/treeview.h> |
30 |
#include <gtkmm/liststore.h> |
#include <gtkmm/liststore.h> |
31 |
#include <gtkmm/scrolledwindow.h> |
#include <gtkmm/scrolledwindow.h> |
32 |
|
#include <gtkmm/checkbutton.h> |
33 |
|
|
34 |
#include <gig.h> |
#include <gig.h> |
35 |
|
#include <set> |
36 |
|
|
37 |
|
class DimTypeCellRenderer : public Gtk::CellRendererText { |
38 |
|
public: |
39 |
|
Glib::PropertyProxy<gig::dimension_t> propertyDimType() { |
40 |
|
return m_propertyDimType.get_proxy(); |
41 |
|
} |
42 |
|
|
43 |
|
Glib::PropertyProxy<int> propertyUsageCount() { |
44 |
|
return m_propertyUsageCount.get_proxy(); |
45 |
|
} |
46 |
|
|
47 |
|
Glib::PropertyProxy<int> propertyTotalRegions() { |
48 |
|
return m_propertyTotalRegions.get_proxy(); |
49 |
|
} |
50 |
|
|
51 |
|
DimTypeCellRenderer(); |
52 |
|
protected: |
53 |
|
void typeChanged(); |
54 |
|
void statsChanged(); |
55 |
|
private: |
56 |
|
Glib::Property<gig::dimension_t> m_propertyDimType; |
57 |
|
Glib::Property<int> m_propertyUsageCount; |
58 |
|
Glib::Property<int> m_propertyTotalRegions; |
59 |
|
}; |
60 |
|
|
61 |
|
class IntSetCellRenderer : public Gtk::CellRendererText { |
62 |
|
public: |
63 |
|
Glib::PropertyProxy<std::set<int> > propertyValue() { |
64 |
|
return m_propertyValue.get_proxy(); |
65 |
|
} |
66 |
|
|
67 |
|
IntSetCellRenderer(); |
68 |
|
protected: |
69 |
|
void valueChanged(); |
70 |
|
private: |
71 |
|
Glib::Property<std::set<int> > m_propertyValue; |
72 |
|
}; |
73 |
|
|
74 |
class DimensionManager : public Gtk::Window { |
class DimensionManager : public Gtk::Window { |
75 |
public: |
public: |
78 |
|
|
79 |
DimensionManager(); |
DimensionManager(); |
80 |
void show(gig::Region* region); |
void show(gig::Region* region); |
81 |
|
void set_region(gig::Region* region); |
82 |
protected: |
protected: |
83 |
gig::Region* region; |
gig::Region* region; |
84 |
Gtk::VBox vbox; |
Gtk::VBox vbox; |
87 |
Gtk::TreeView treeView; |
Gtk::TreeView treeView; |
88 |
Gtk::Button addButton; |
Gtk::Button addButton; |
89 |
Gtk::Button removeButton; |
Gtk::Button removeButton; |
90 |
|
Gtk::CheckButton allRegionsCheckBox; |
91 |
|
|
92 |
|
DimTypeCellRenderer m_cellRendererDimType; |
93 |
|
IntSetCellRenderer m_cellRendererIntSet; |
94 |
|
|
95 |
class ModelColumns : public Gtk::TreeModel::ColumnRecord { |
class ModelColumns : public Gtk::TreeModel::ColumnRecord { |
96 |
public: |
public: |
97 |
ModelColumns() { |
ModelColumns() { |
98 |
add(m_dim_type); |
add(m_type); |
99 |
add(m_bits); |
add(m_bits); |
100 |
add(m_zones); |
add(m_zones); |
101 |
add(m_description); |
add(m_description); |
102 |
add(m_definition); |
add(m_usageCount); |
103 |
|
add(m_totalRegions); |
104 |
} |
} |
105 |
|
|
106 |
Gtk::TreeModelColumn<Glib::ustring> m_dim_type; |
Gtk::TreeModelColumn<gig::dimension_t> m_type; |
107 |
Gtk::TreeModelColumn<int> m_bits; |
Gtk::TreeModelColumn<std::set<int> > m_bits; |
108 |
Gtk::TreeModelColumn<int> m_zones; |
Gtk::TreeModelColumn<std::set<int> > m_zones; |
109 |
Gtk::TreeModelColumn<Glib::ustring> m_description; |
Gtk::TreeModelColumn<Glib::ustring> m_description; |
110 |
Gtk::TreeModelColumn<gig::dimension_def_t*> m_definition; |
Gtk::TreeModelColumn<int> m_usageCount; |
111 |
|
Gtk::TreeModelColumn<int> m_totalRegions; |
112 |
} tableModel; |
} tableModel; |
113 |
|
|
114 |
class ComboModelColumns : public Gtk::TreeModel::ColumnRecord { |
class ComboModelColumns : public Gtk::TreeModel::ColumnRecord { |
123 |
} comboModel; |
} comboModel; |
124 |
|
|
125 |
Glib::RefPtr<Gtk::ListStore> refTableModel; |
Glib::RefPtr<Gtk::ListStore> refTableModel; |
126 |
|
bool ignoreColumnClicked; //HACK: Prevents that onColumnClicked() gets called multiple times or at times where it is not desired |
127 |
|
|
128 |
|
void onAllRegionsCheckBoxToggled(); |
129 |
|
void onColumnClicked(); |
130 |
void refreshManager(); |
void refreshManager(); |
131 |
void addDimension(); |
void addDimension(); |
132 |
void removeDimension(); |
void removeDimension(); |
133 |
|
bool allRegions() const; |
134 |
}; |
}; |
135 |
|
|
136 |
#endif // GIGEDIT_DIMENSIONMANAGER_H |
#endif // GIGEDIT_DIMENSIONMANAGER_H |