diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-30 04:21:32 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-30 04:21:32 +0000 |
commit | e002eea388f9850cc5d416c70a87ffae1929b1f7 (patch) | |
tree | 22896b5e69b24f6a9d7d4f24935a09c9c717948a /libs/gtkmm2ext | |
parent | f987091756dc2229636ba49e344d1e8ba534169c (diff) |
frame for fader belt; better focus behaviour for gain display text entry (generalized)
git-svn-id: svn://localhost/ardour2/trunk@1171 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/SConscript | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/focus_entry.cc | 31 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/focus_entry.h | 22 | ||||
-rw-r--r-- | libs/gtkmm2ext/pixfader.cc | 18 |
4 files changed, 66 insertions, 6 deletions
diff --git a/libs/gtkmm2ext/SConscript b/libs/gtkmm2ext/SConscript index 1a7ab75264..fa69755d93 100644 --- a/libs/gtkmm2ext/SConscript +++ b/libs/gtkmm2ext/SConscript @@ -39,6 +39,7 @@ choice.cc click_box.cc dndtreeview.cc fastmeter.cc +focus_entry.cc gtk_ui.cc hexentry.cc idle_adjustment.cc diff --git a/libs/gtkmm2ext/focus_entry.cc b/libs/gtkmm2ext/focus_entry.cc new file mode 100644 index 0000000000..dbe833d06b --- /dev/null +++ b/libs/gtkmm2ext/focus_entry.cc @@ -0,0 +1,31 @@ +#include <gtkmm2ext/focus_entry.h> + +using namespace Gtkmm2ext; + +FocusEntry::FocusEntry () +{ + next_release_selects = false; +} + +bool +FocusEntry::on_button_press_event (GdkEventButton* ev) +{ + if (!has_focus()) { + next_release_selects = true; + } + return Entry::on_button_press_event (ev); +} + +bool +FocusEntry::on_button_release_event (GdkEventButton* ev) +{ + if (next_release_selects) { + bool ret = Entry::on_button_release_event (ev); + select_region (0, -1); + next_release_selects = false; + return ret; + } + + return Entry::on_button_release_event (ev); +} + diff --git a/libs/gtkmm2ext/gtkmm2ext/focus_entry.h b/libs/gtkmm2ext/gtkmm2ext/focus_entry.h new file mode 100644 index 0000000000..5d9d7fdac7 --- /dev/null +++ b/libs/gtkmm2ext/gtkmm2ext/focus_entry.h @@ -0,0 +1,22 @@ +#ifndef __gtkmm2ext_focus_entry_h__ +#define __gtkmm2ext_focus_entry_h__ + +#include <gtkmm/entry.h> + +namespace Gtkmm2ext { + +class FocusEntry : public Gtk::Entry +{ + public: + FocusEntry (); + + protected: + bool on_button_press_event (GdkEventButton*); + bool on_button_release_event (GdkEventButton*); + private: + bool next_release_selects; +}; + +} + +#endif /* __gtkmm2ext_focus_entry_h__ */ diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc index 53bc893e09..f3a40ffc69 100644 --- a/libs/gtkmm2ext/pixfader.cc +++ b/libs/gtkmm2ext/pixfader.cc @@ -59,18 +59,24 @@ PixFader::on_expose_event (GdkEventExpose* ev) GdkRectangle intersection; int dh = display_height (); int offset_into_pixbuf = (int) floor (view.height / ((float) view.height / dh)); + Glib::RefPtr<Gdk::GC> fg_gc (get_style()->get_fg_gc(get_state())); if (gdk_rectangle_intersect (&view, &ev->area, &intersection)) { - get_window()->draw_pixbuf(get_style()->get_fg_gc(get_state()), pixbuf, - intersection.x, offset_into_pixbuf + intersection.y, - intersection.x, intersection.y, - intersection.width, intersection.height, - Gdk::RGB_DITHER_NONE, 0, 0); + get_window()->draw_pixbuf (fg_gc, pixbuf, + intersection.x, offset_into_pixbuf + intersection.y, + intersection.x, intersection.y, + intersection.width, intersection.height, + Gdk::RGB_DITHER_NONE, 0, 0); + + get_window()->draw_line (get_style()->get_bg_gc(STATE_ACTIVE), 0, 0, view.width - 1, 0); /* top */ + get_window()->draw_line (get_style()->get_bg_gc(STATE_ACTIVE), 0, 0, 0, view.height - 1); /* left */ + get_window()->draw_line (get_style()->get_bg_gc(STATE_NORMAL), view.width - 1, 0, view.width - 1, view.height - 1); /* right */ + get_window()->draw_line (get_style()->get_bg_gc(STATE_NORMAL), 0, view.height - 1, view.width - 1, view.height - 1); /* bottom */ } /* always draw the line */ - get_window()->draw_line (get_style()->get_fg_gc(get_state()), 0, unity_y, view.width - 2, unity_y); + get_window()->draw_line (fg_gc, 1, unity_y, view.width - 2, unity_y); last_drawn = dh; return true; |