gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
Scrolling.H
Go to the documentation of this file.
1 /* Copyright 2000-2018 Matt Flax <flatmax@flatmax.org>
2  This file is part of GTK+ IOStream class set
3 
4  GTK+ IOStream is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  GTK+ IOStream is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You have received a copy of the GNU General Public License
15  along with GTK+ IOStream
16  */
17 
18 #ifndef SCROLLING_H_
19 #define SCROLLING_H_
20 
21 #include <gtk/gtk.h>
22 #include "Selection.H"
23 #include "Container.H"
24 
27 class Scrolling : public Container {
30  virtual void pack(GtkWidget *obj){
31  gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(widget), obj);
32  }
33 public:
34 
37  Scrolling(void) {
38  widget = gtk_scrolled_window_new(NULL, NULL);
39  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
40  }
41 };
42 
45 class ScrollingSelection : public Scrolling {
46 public:
52  gtk_container_add(GTK_CONTAINER(widget), selection->getWidget());
53  /* Set vertical adjustment for the tree view */
54  GtkAdjustment *vscroll = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(widget));
55  gtk_tree_view_set_vadjustment(GTK_TREE_VIEW (selection->getWidget()), vscroll);
56  /* Set vertical adjustment for the tree view */
57  GtkAdjustment *hscroll = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(widget));
58  gtk_tree_view_set_hadjustment(GTK_TREE_VIEW (selection->getWidget()), hscroll);
59  return *this;
60  }
61 };
62 
63 #endif //SCROLLING_H_
Scrolling container for use with Selection classes.
Definition: Scrolling.H:45
Selection GtkTreeView based widget Inherits from a LinkList of GtkTreeViewColumn* which allows modifi...
Definition: Selection.H:238
GtkWidget * getWidget(void)
Definition: Selection.H:459
virtual void pack(GtkWidget *obj)
Definition: Scrolling.H:30
Scrolling(void)
Definition: Scrolling.H:37
GtkWidget * widget
The container based widget.
Definition: Widget.H:33
ScrollingSelection & operator<<(Selection *selection)
add a selection object to the scrolling window
Definition: Scrolling.H:51
Scrolling container.
Definition: Scrolling.H:27
gtkIOStream: /tmp/gtkiostream/include/Scrolling.H Source File
GTK+ IOStream  Beta