/[svn]/gigedit/trunk/src/gigedit/dimensionmanager.h
ViewVC logotype

Annotation of /gigedit/trunk/src/gigedit/dimensionmanager.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2579 - (hide annotations) (download) (as text)
Sat May 24 06:44:39 2014 UTC (9 years, 10 months ago) by persson
File MIME type: text/x-c++hdr
File size: 3947 byte(s)
* fixed compile errors with GTK3
1 schoenebeck 1225 /* -*- c++ -*-
2     * Copyright (C) 2006, 2007 Andreas Persson
3     *
4     * This program is free software; you can redistribute it and/or
5     * modify it under the terms of the GNU General Public License as
6     * published by the Free Software Foundation; either version 2, or (at
7     * your option) any later version.
8     *
9     * This program is distributed in the hope that it will be useful, but
10     * WITHOUT ANY WARRANTY; without even the implied warranty of
11     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12     * General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * along with program; see the file COPYING. If not, write to the Free
16     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17     * 02110-1301 USA.
18     */
19    
20     #ifndef GIGEDIT_DIMENSIONMANAGER_H
21     #define GIGEDIT_DIMENSIONMANAGER_H
22    
23 persson 2579 #include <glibmm/property.h>
24 schoenebeck 1225 #include <gtkmm/window.h>
25     #include <gtkmm/layout.h>
26     #include <gtkmm/button.h>
27     #include <gtkmm/buttonbox.h>
28     #include <gtkmm/treeview.h>
29     #include <gtkmm/liststore.h>
30     #include <gtkmm/scrolledwindow.h>
31 schoenebeck 2562 #include <gtkmm/checkbutton.h>
32 schoenebeck 1225
33     #include <gig.h>
34 schoenebeck 2562 #include <set>
35 schoenebeck 1225
36 schoenebeck 2562 class DimTypeCellRenderer : public Gtk::CellRendererText {
37     public:
38     Glib::PropertyProxy<gig::dimension_t> propertyDimType() {
39     return m_propertyDimType.get_proxy();
40     }
41    
42     Glib::PropertyProxy<int> propertyUsageCount() {
43     return m_propertyUsageCount.get_proxy();
44     }
45    
46     Glib::PropertyProxy<int> propertyTotalRegions() {
47     return m_propertyTotalRegions.get_proxy();
48     }
49    
50     DimTypeCellRenderer();
51     protected:
52     void typeChanged();
53     void statsChanged();
54     private:
55     Glib::Property<gig::dimension_t> m_propertyDimType;
56     Glib::Property<int> m_propertyUsageCount;
57     Glib::Property<int> m_propertyTotalRegions;
58     };
59    
60     class IntSetCellRenderer : public Gtk::CellRendererText {
61     public:
62     Glib::PropertyProxy<std::set<int> > propertyValue() {
63     return m_propertyValue.get_proxy();
64     }
65    
66     IntSetCellRenderer();
67     protected:
68     void valueChanged();
69     private:
70     Glib::Property<std::set<int> > m_propertyValue;
71     };
72    
73 schoenebeck 1225 class DimensionManager : public Gtk::Window {
74     public:
75 schoenebeck 1322 sigc::signal<void, gig::Region*> region_to_be_changed_signal;
76     sigc::signal<void, gig::Region*> region_changed_signal;
77 schoenebeck 1225
78     DimensionManager();
79     void show(gig::Region* region);
80 persson 1677 void set_region(gig::Region* region);
81 schoenebeck 1225 protected:
82     gig::Region* region;
83     Gtk::VBox vbox;
84     Gtk::HButtonBox buttonBox;
85     Gtk::ScrolledWindow scrolledWindow;
86     Gtk::TreeView treeView;
87     Gtk::Button addButton;
88     Gtk::Button removeButton;
89 schoenebeck 2562 Gtk::CheckButton allRegionsCheckBox;
90 schoenebeck 1225
91 schoenebeck 2562 DimTypeCellRenderer m_cellRendererDimType;
92     IntSetCellRenderer m_cellRendererIntSet;
93    
94 schoenebeck 1225 class ModelColumns : public Gtk::TreeModel::ColumnRecord {
95     public:
96     ModelColumns() {
97 schoenebeck 2562 add(m_type);
98 schoenebeck 1225 add(m_bits);
99     add(m_zones);
100     add(m_description);
101 schoenebeck 2562 add(m_usageCount);
102     add(m_totalRegions);
103 schoenebeck 1225 }
104    
105 schoenebeck 2562 Gtk::TreeModelColumn<gig::dimension_t> m_type;
106     Gtk::TreeModelColumn<std::set<int> > m_bits;
107     Gtk::TreeModelColumn<std::set<int> > m_zones;
108 schoenebeck 1225 Gtk::TreeModelColumn<Glib::ustring> m_description;
109 schoenebeck 2562 Gtk::TreeModelColumn<int> m_usageCount;
110     Gtk::TreeModelColumn<int> m_totalRegions;
111 schoenebeck 1225 } tableModel;
112    
113     class ComboModelColumns : public Gtk::TreeModel::ColumnRecord {
114     public:
115     ComboModelColumns() {
116     add(m_type_id);
117     add(m_type_name);
118     }
119    
120     Gtk::TreeModelColumn<int> m_type_id;
121     Gtk::TreeModelColumn<Glib::ustring> m_type_name;
122     } comboModel;
123    
124     Glib::RefPtr<Gtk::ListStore> refTableModel;
125    
126 schoenebeck 2562 void onAllRegionsCheckBoxToggled();
127 schoenebeck 1225 void refreshManager();
128     void addDimension();
129     void removeDimension();
130 schoenebeck 2562 bool allRegions() const;
131 schoenebeck 1225 };
132    
133     #endif // GIGEDIT_DIMENSIONMANAGER_H

  ViewVC Help
Powered by ViewVC