Back to index

easystroke  0.5.5.1
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
Win Class Reference

#include <win.h>

Inheritance diagram for Win:
Inheritance graph
[legend]
Collaboration diagram for Win:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Win ()
Gtk::Window & get_window ()
void show_hide ()
void set_icon (RStroke stroke, bool invert)

Public Attributes

boost::shared_ptr< Actionsactions
boost::shared_ptr< Prefsprefs_tab
boost::shared_ptr< Statsstats

Private Member Functions

bool on_icon_size_changed (int)
virtual void timeout ()
void on_help_toggled ()
void show_popup (guint, guint32)
void show_hide_icon ()
void on_about ()
bool remove_timeout ()
void set_timeout (int ms)

Private Attributes

Gtk::Window * win
Gtk::Menu menu
Glib::RefPtr< Gtk::StatusIcon > icon
Glib::RefPtr< Gdk::Pixbuf > icon_pb [2]

Detailed Description

Definition at line 52 of file win.h.


Constructor & Destructor Documentation

Win::Win ( )

Definition at line 156 of file win.cc.

         : actions(new Actions), prefs_tab(new Prefs), stats(new Stats) {
       show_hide_icon();
       prefs.tray_icon.connect(new Notifier(sigc::mem_fun(*this, &Win::show_hide_icon)));
       disabled.connect(new Notifier(sigc::mem_fun(*this, &Win::timeout)));

       WIDGET(Gtk::CheckMenuItem, menu_disabled, _("D_isabled"), true);
       menu.append(menu_disabled);
       new MenuCheck(disabled, &menu_disabled);

       WIDGET(Gtk::ImageMenuItem, menu_about, Gtk::Stock::ABOUT);
       menu.append(menu_about);
       menu_about.signal_activate().connect(sigc::mem_fun(*this, &Win::on_about));

       WIDGET(Gtk::SeparatorMenuItem, menu_sep);
       menu.append(menu_sep);

       WIDGET(Gtk::ImageMenuItem, menu_quit, Gtk::Stock::QUIT);
       menu.append(menu_quit);
       menu_quit.signal_activate().connect(sigc::ptr_fun(&quit));

       menu.show_all();

       widgets->get_widget("main", win);
       RStroke trefoil = Stroke::trefoil();
       std::vector<Glib::RefPtr<Gdk::Pixbuf> > icons;
       icons.push_back(trefoil->draw(24));
       icons.push_back(trefoil->draw(64));
       win->set_icon_list(icons);

       Gtk::Button* button_hide[4];
       widgets->get_widget("button_hide1", button_hide[0]);
       widgets->get_widget("button_hide2", button_hide[1]);
       widgets->get_widget("button_hide3", button_hide[2]);
       widgets->get_widget("button_hide4", button_hide[3]);
       for (int i = 0; i < 4; i++)
              button_hide[i]->signal_clicked().connect(sigc::mem_fun(win, &Gtk::Window::hide));
}

Here is the call graph for this function:


Member Function Documentation

Gtk::Window& Win::get_window ( ) [inline]

Definition at line 56 of file win.h.

{ return *win; }

Here is the caller graph for this function:

void Win::on_about ( ) [private]

Definition at line 226 of file win.cc.

                   {
       Gtk::AboutDialog *about;
       widgets->get_widget("aboutdialog", about);
       about->set_logo(Stroke::trefoil()->draw(96, 4.0));
       about->set_version(version_string);
       about->set_program_name("easystroke\n");
       about->show();
       about->run();
       about->hide();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Win::on_help_toggled ( ) [private]
bool Win::on_icon_size_changed ( int  size) [private]

Definition at line 244 of file win.cc.

                                       {
       icon_pb[0] = Stroke::trefoil()->draw(size);
       icon_pb[1] = Stroke::trefoil()->draw(size);
       icon_pb[1]->saturate_and_pixelate(icon_pb[1], 0.0, true);
       if (icon)
              icon->set(icon_pb[disabled.get() ? 1 : 0]);
       return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Timeout::remove_timeout ( ) [inline, inherited]

Definition at line 32 of file util.h.

                             {
              if (c) {
                     c->disconnect();
                     c = 0;
                     return true;
              }
              return false;
       }

Here is the caller graph for this function:

void Win::set_icon ( RStroke  stroke,
bool  invert 
)

Definition at line 258 of file win.cc.

                                              {
       if (!icon)
              return;
       icon->set(stroke->draw(icon->get_size(), 2.0, invert));
       set_timeout(10000);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Timeout::set_timeout ( int  ms) [inline, inherited]

Definition at line 40 of file util.h.

                                {
              remove_timeout();
              connection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Timeout::to), ms);
              c = &connection;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void Win::show_hide ( )

Definition at line 237 of file win.cc.

                    {
       if (win->is_mapped())
              win->hide();
       else
              win->show();
}

Here is the caller graph for this function:

void Win::show_hide_icon ( ) [private]

Definition at line 202 of file win.cc.

                         {
       bool show = prefs.tray_icon.get();
       if (show) {
              if (icon)
                     return;
              icon = Gtk::StatusIcon::create("");
              icon->signal_size_changed().connect(sigc::mem_fun(*this, &Win::on_icon_size_changed));
              icon->signal_activate().connect(sigc::mem_fun(*this, &Win::show_hide));
              icon->signal_popup_menu().connect(sigc::mem_fun(*this, &Win::show_popup));
              if (gtk_major_version >= 2 && gtk_minor_version >= 15)
                     g_signal_connect(icon->gobj(), "button-release-event", G_CALLBACK(icon_clicked), NULL);
       } else {
              if (icon)
                     icon.reset();
              icon_warning();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Win::show_popup ( guint  button,
guint32  activate_time 
) [private]

Definition at line 220 of file win.cc.

                                                        {
       if (icon)
              icon->popup_menu_at_position(menu, button, activate_time);
}

Here is the caller graph for this function:

void Win::timeout ( ) [private, virtual]

Implements Timeout.

Definition at line 253 of file win.cc.

                  {
       if (icon)
              icon->set(icon_pb[disabled.get() ? 1 : 0]);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

boost::shared_ptr<Actions> Win::actions

Definition at line 57 of file win.h.

Glib::RefPtr<Gtk::StatusIcon> Win::icon [private]

Definition at line 74 of file win.h.

Glib::RefPtr<Gdk::Pixbuf> Win::icon_pb[2] [private]

Definition at line 75 of file win.h.

Gtk::Menu Win::menu [private]

Definition at line 72 of file win.h.

boost::shared_ptr<Prefs> Win::prefs_tab

Definition at line 58 of file win.h.

boost::shared_ptr<Stats> Win::stats

Definition at line 59 of file win.h.

Gtk::Window* Win::win [private]

Definition at line 70 of file win.h.


The documentation for this class was generated from the following files: