summaryrefslogtreecommitdiff
path: root/src/gui/cellRendererIcon.vala
diff options
context:
space:
mode:
authorAlessandro Ghedini <al3xbio@gmail.com>2012-01-21 19:07:09 +0100
committerAlessandro Ghedini <al3xbio@gmail.com>2012-01-21 19:07:09 +0100
commit60560a030fda3c539ff9dc1563b9926414a193da (patch)
tree77590b395685a8d48d3615e45629a1610d08c071 /src/gui/cellRendererIcon.vala
parentd6b2677825cbb423e2099563c16321c3e23d7899 (diff)
Imported Upstream version 0.4.0upstream/0.4.0
Diffstat (limited to 'src/gui/cellRendererIcon.vala')
-rw-r--r--src/gui/cellRendererIcon.vala132
1 files changed, 0 insertions, 132 deletions
diff --git a/src/gui/cellRendererIcon.vala b/src/gui/cellRendererIcon.vala
deleted file mode 100644
index 959a0b7..0000000
--- a/src/gui/cellRendererIcon.vala
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-Copyright (c) 2011 by Simon Schneegans
-
-This program is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the Free
-Software Foundation, either version 3 of the License, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-more details.
-
-You should have received a copy of the GNU General Public License along with
-this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-namespace GnomePie {
-
-/////////////////////////////////////////////////////////////////////////
-/// A cellrenderer which displays an Icon. When clicked onto, a window
-/// opens for selecting another icon. This needs to be a subclass of
-/// Gtk.CellRendererText because Gtk.CellRendererPixbuf can't receive
-/// click events. Internally it stores a Gtk.CellRendererPixbuf
-/// which renders and stuff.
-/////////////////////////////////////////////////////////////////////////
-
-public class CellRendererIcon : Gtk.CellRendererText {
-
- /////////////////////////////////////////////////////////////////////
- /// This signal is emitted when the user selects another icon.
- /////////////////////////////////////////////////////////////////////
-
- public signal void on_select(string path, string icon);
-
- /////////////////////////////////////////////////////////////////////
- /// The IconSelectWindow which is shown on click.
- /////////////////////////////////////////////////////////////////////
-
- private IconSelectWindow select_window = null;
-
- /////////////////////////////////////////////////////////////////////
- /// The internal Renderer used for drawing.
- /////////////////////////////////////////////////////////////////////
-
- private Gtk.CellRendererPixbuf renderer = null;
-
- /////////////////////////////////////////////////////////////////////
- /// A helper variable, needed to emit the current path.
- /////////////////////////////////////////////////////////////////////
-
- private string current_path = "";
-
- public string icon_name { get; set; }
-
- /////////////////////////////////////////////////////////////////////
- /// Forward some parts of the CellRendererPixbuf's interface.
- /////////////////////////////////////////////////////////////////////
-
- public bool follow_state {
- get { return renderer.follow_state; }
- set { renderer.follow_state = value; }
- }
-
- public bool icon_sensitive {
- get { return renderer.sensitive; }
- set { renderer.sensitive = value; }
- }
-
- public Gdk.Pixbuf pixbuf {
- owned get { return renderer.pixbuf; }
- set { renderer.pixbuf = value; }
- }
-
- /////////////////////////////////////////////////////////////////////
- /// C'tor, creates a new CellRendererIcon.
- /////////////////////////////////////////////////////////////////////
-
- public CellRendererIcon() {
- this.select_window = new IconSelectWindow();
- this.renderer = new Gtk.CellRendererPixbuf();
-
- this.select_window.on_select.connect((icon) => {
- this.on_select(current_path, icon);
- });
- }
-
- /////////////////////////////////////////////////////////////////////
- /// Forward some parts of the CellRendererPixbuf's interface.
- /////////////////////////////////////////////////////////////////////
-
- public override void get_size (Gtk.Widget widget, Gdk.Rectangle? cell_area,
- out int x_offset, out int y_offset,
- out int width, out int height) {
-
- this.renderer.get_size(widget, cell_area, out x_offset, out y_offset, out width, out height);
- }
-
- /////////////////////////////////////////////////////////////////////
- /// Forward some parts of the CellRendererPixbuf's interface.
- /////////////////////////////////////////////////////////////////////
-
- public override void render (Gdk.Window window, Gtk.Widget widget,
- Gdk.Rectangle bg_area,
- Gdk.Rectangle cell_area,
- Gdk.Rectangle expose_area,
- Gtk.CellRendererState flags) {
-
- this.renderer.render(window, widget, bg_area, cell_area, expose_area, flags);
- }
-
- /////////////////////////////////////////////////////////////////////
- /// Open the IconSelectWindow on click.
- /////////////////////////////////////////////////////////////////////
-
- public override unowned Gtk.CellEditable start_editing(
- Gdk.Event event, Gtk.Widget widget, string path, Gdk.Rectangle bg_area,
- Gdk.Rectangle cell_area, Gtk.CellRendererState flags) {
-
- this.select_window.set_transient_for((Gtk.Window)widget.get_toplevel());
- this.select_window.set_modal(true);
-
- this.current_path = path;
- this.select_window.show();
- this.select_window.active_icon = this.icon_name;
-
- return this.renderer.start_editing(event, widget, path, bg_area, cell_area, flags);
- }
-}
-
-}
-