Back to index

easystroke  0.5.5.1
prefs.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008-2009, Thomas Jaeger <ThJaeger@gmail.com>
00003  *
00004  * Permission to use, copy, modify, and/or distribute this software for any
00005  * purpose with or without fee is hereby granted, provided that the above
00006  * copyright notice and this permission notice appear in all copies.
00007  *
00008  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00009  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00010  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00011  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00012  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
00013  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00014  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00015  */
00016 #ifndef __PREFS_H__
00017 #define __PREFS_H__
00018 #include "prefdb.h"
00019 
00020 #include <gtkmm.h>
00021 
00022 class Prefs {
00023 public:
00024        Prefs();
00025        virtual ~Prefs() {}
00026        void update_device_list();
00027        void update_extra_buttons();
00028 private:
00029        void set_button_label();
00030 
00031        void on_add();
00032        void on_remove();
00033        void on_add_extra();
00034        void on_edit_extra();
00035        void on_remove_extra();
00036        void on_select_button();
00037        void on_button_editing_started(Gtk::CellEditable* editable, const Glib::ustring& path);
00038        void on_device_toggled(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter);
00039        void on_device_timeout_changed(const Glib::ustring& path, const Glib::ustring& new_text);
00040        bool select_row(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, std::string name);
00041 
00042        class ExceptionColumns : public Gtk::TreeModel::ColumnRecord {
00043        public:
00044               ExceptionColumns() { add(app); add(user_app); add(button); }
00045               Gtk::TreeModelColumn<std::string> app;
00046               Gtk::TreeModelColumn<Glib::ustring> user_app, button;
00047        };
00048        ExceptionColumns cols;
00049        Glib::RefPtr<Gtk::ListStore> tm;
00050        Gtk::TreeView* tv;
00051 
00052        class Single : public Gtk::TreeModel::ColumnRecord {
00053        public:
00054               Single() { add(name); }
00055               Gtk::TreeModelColumn<Glib::ustring> name;
00056        };
00057        Single timeout_columns;
00058 
00059        class DeviceColumns : public Gtk::TreeModel::ColumnRecord {
00060        public:
00061               DeviceColumns() { add(enabled); add(name); add(timeout); }
00062               Gtk::TreeModelColumn<bool> enabled;
00063               Gtk::TreeModelColumn<Glib::ustring> name;
00064               Gtk::TreeModelColumn<Glib::ustring> timeout;
00065        };
00066        DeviceColumns dcs;
00067        Gtk::TreeView* dtv;
00068        Glib::RefPtr<Gtk::ListStore> dtm;
00069 
00070        class ExtraColumns : public Gtk::TreeModel::ColumnRecord {
00071        public:
00072               ExtraColumns() { add(str); add(i); }
00073               Gtk::TreeModelColumn<Glib::ustring> str;
00074               Gtk::TreeModelColumn<std::vector<ButtonInfo>::iterator> i;
00075        };
00076        ExtraColumns ecs;
00077        Gtk::TreeView *etv;
00078        Glib::RefPtr<Gtk::ListStore> etm;
00079 
00080        Gtk::SpinButton *spin_radius;
00081        Gtk::Label* blabel;
00082        bool ignore_device_toggled;
00083 };
00084 
00085 #endif