libyui-gtk-pkg  2.43.2
 All Classes
ygtkpkglistview.h
1 /********************************************************************
2  * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
3  ********************************************************************/
4 
5 /* A view for Ypp's query results.
6 */
7 
8 #ifndef YGTK_PKG_LIST_VIEW_H
9 #define YGTK_PKG_LIST_VIEW_H
10 
11 #include "yzyppwrapper.h"
12 #include <gtk/gtk.h>
13 
14 enum Property {
15  INSTALLED_CHECK_PROP, NAME_PROP, ACTION_NAME_PROP, NAME_SUMMARY_PROP,
16  VERSION_PROP, SINGLE_VERSION_PROP, REPOSITORY_PROP, SUPPORT_PROP,
17  SIZE_PROP, STATUS_ICON_PROP, ACTION_BUTTON_PROP, UNDO_BUTTON_PROP, TOTAL_PROPS
18 };
19 
21  YGtkPkgListView (bool descriptiveTooltip, int default_sort /* -1 to disable */,
22  bool indentAuto, bool colorModified, bool variableHeight = false);
23  ~YGtkPkgListView();
24 
25  GtkWidget *getWidget();
26  GtkWidget *getView();
27 
28  void setQuery (Ypp::Query &query);
29  void setList (Ypp::List list);
30 
31  void setHighlight (const std::list <std::string> &keywords);
32 
33  void addTextColumn (const char *header, int property, bool visible, int size);
34  void addCheckColumn (int checkProperty);
35  void addImageColumn (const char *header, int property, bool onlyManualModified = false);
36  void addButtonColumn (const char *header, int property);
37 
38  Ypp::List getList();
39 
40  struct Listener {
41  virtual void selectionChanged() = 0;
42  };
43  void setListener (Listener *listener);
44 
45  Ypp::List getSelected();
46  void selectAll();
47 
48  struct Impl;
49  Impl *impl;
50 };
51 
52 // some utilities:
53 
54 const char *getStatusAction (Ypp::Selectable *sel);
55 std::string getStatusSummary (Ypp::Selectable &sel);
56 const char *getStatusStockIcon (Ypp::Selectable &sel);
57 
58 std::string getRepositoryLabel (Ypp::Repository &repo);
59 const char *getRepositoryStockIcon (Ypp::Repository &repo);
60 const char *getRepositoryStockIcon (const std::string &url);
61 
62 void highlightMarkup (std::string &text, const std::list <std::string> &keywords,
63  const char *openTag, const char *closeTag, int openTagLen, int closeTagLen);
64 
65 void highlightMarkupSpan (std::string &text, const std::list <std::string> &keywords);
66 
67 #endif
68