libyui-gtk-pkg  2.43.2
 All Classes
ygtkpkgfilterview.h
1 /********************************************************************
2  * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
3  ********************************************************************/
4 
5 /* Several user interfaces for zypp query attributes.
6 
7  Create a List-model and pass it to FilterView in order to
8  use it. Example:
9  QueryWidget *query_widget = new YGtkPkgFilterView (new YGtkPkgStatusModel());
10  GtkWidget *gtk_widget = query_widget->getWidget();
11 
12  One can very easily re-implement YGtkPkgFilterView to use the GtkComboBox.
13 */
14 
15 #ifndef YGTK_PKG_FILTER_VIEW_H
16 #define YGTK_PKG_FILTER_VIEW_H
17 
18 #include "ygtkpkgquerywidget.h"
19 #include <gtk/gtk.h>
20 
21 struct YGtkPkgFilterModel // abstract
22 {
23  enum Column { ICON_COLUMN, TEXT_COLUMN, COUNT_NUMBER_COLUMN,
24  VISIBLE_COLUMN, ENABLED_COLUMN, WEIGHT_COLUMN, DATA_COLUMN, TOTAL_COLUMNS };
25 
27  virtual ~YGtkPkgFilterModel();
28  GtkTreeModel *getModel();
29 
30  virtual void updateList (Ypp::List list);
31  virtual bool writeQuery (Ypp::PoolQuery &query, GtkTreeIter *iter);
32  virtual GtkWidget *createToolbox (GtkTreeIter *iter);
33 
34  virtual bool hasIconCol() = 0;
35  virtual bool firstRowIsAll() = 0;
36 
37  virtual bool begsUpdate() = 0;
38  virtual void updateRow (Ypp::List list, int row, gpointer data) = 0;
39  virtual bool writeRowQuery (Ypp::PoolQuery &query, int row, gpointer data) = 0;
40 
41  virtual GtkWidget *createToolboxRow (int selectedRow) { return NULL; }
42  virtual GtkWidget *createInternalToolbox() { return NULL; }
43  virtual GtkWidget *createInternalPopup() { return NULL; }
44 
45  void addRow (const char *icon, const char *text, bool enabled, gpointer data, bool defaultVisible = true);
46  void addSeparator();
47  void setRowCount (int row, int count);
48 
49  struct Impl;
50  Impl *impl;
51 };
52 
53 // implementations
54 
56 {
58  virtual ~YGtkPkgStatusModel();
59  virtual bool hasIconCol() { return false; }
60  virtual bool firstRowIsAll();
61  virtual bool begsUpdate() { return true; }
62  virtual void updateRow (Ypp::List list, int row, gpointer data);
63  virtual bool writeRowQuery (Ypp::PoolQuery &query, int row, gpointer data);
64  virtual GtkWidget *createToolboxRow (int selectedRow);
65 
66  struct Impl;
67  Impl *impl;
68 };
69 
71 {
73  virtual bool hasIconCol() { return true; }
74  virtual bool firstRowIsAll() { return true; }
75  virtual bool begsUpdate() { return true; }
76  virtual void updateRow (Ypp::List list, int row, gpointer data);
77  virtual bool writeRowQuery (Ypp::PoolQuery &query, int row, gpointer data);
78 };
79 
81 {
83  virtual ~YGtkPkgRepositoryModel();
84  virtual bool hasIconCol() { return true; }
85  virtual bool firstRowIsAll() { return true; }
86  virtual bool begsUpdate() { return true; }
87  virtual void updateRow (Ypp::List list, int row, gpointer data);
88  virtual bool writeRowQuery (Ypp::PoolQuery &query, int row, gpointer data);
89  virtual GtkWidget *createToolboxRow (int selectedRow);
90  virtual GtkWidget *createInternalToolbox();
91  virtual GtkWidget *createInternalPopup();
92 
93  struct Impl;
94  Impl *impl;
95 };
96 
98 {
100  virtual bool hasIconCol() { return false; }
101  virtual bool firstRowIsAll() { return true; }
102  virtual bool begsUpdate() { return true; }
103  virtual void updateRow (Ypp::List list, int row, gpointer data);
104  virtual bool writeRowQuery (Ypp::PoolQuery &query, int row, gpointer data);
105 };
106 
108 {
110  virtual bool hasIconCol() { return false; }
111  virtual bool firstRowIsAll() { return true; }
112  virtual bool begsUpdate() { return true; }
113  virtual void updateRow (Ypp::List list, int row, gpointer data);
114  virtual bool writeRowQuery (Ypp::PoolQuery &query, int row, gpointer data);
115 };
116 
117 // widget
118 
120 {
122  virtual ~YGtkPkgFilterView();
123  virtual GtkWidget *getWidget();
124 
125  virtual bool begsUpdate();
126  virtual void updateList (Ypp::List list);
127 
128  virtual void clearSelection();
129  virtual bool writeQuery (Ypp::PoolQuery &query);
130 
131  virtual GtkWidget *createToolbox();
132 
133  void select (int row);
134 
135  struct Impl;
136  Impl *impl;
137 };
138 
139 #endif
140