summaryrefslogtreecommitdiff
path: root/libs/canvas/canvas/canvas.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/canvas/canvas/canvas.h')
-rw-r--r--libs/canvas/canvas/canvas.h47
1 files changed, 34 insertions, 13 deletions
diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h
index e65abf6b27..616336409d 100644
--- a/libs/canvas/canvas/canvas.h
+++ b/libs/canvas/canvas/canvas.h
@@ -24,12 +24,18 @@
#ifndef __CANVAS_CANVAS_H__
#define __CANVAS_CANVAS_H__
+#include <set>
+
#include <gdkmm/window.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/alignment.h>
#include <cairomm/surface.h>
#include <cairomm/context.h>
+
#include "pbd/signals.h"
+
+#include "canvas/visibility.h"
+
#include "canvas/root_group.h"
namespace ArdourCanvas
@@ -48,7 +54,7 @@ class Group;
* rightwards and y increases downwards.
*/
-class Canvas
+class LIBCANVAS_API Canvas
{
public:
Canvas ();
@@ -63,6 +69,11 @@ public:
/** called to ask the canvas' host to `ungrab' any grabbed item */
virtual void ungrab () = 0;
+ /** called to ask the canvas' host to keyboard focus on an item */
+ virtual void focus (Item *) = 0;
+ /** called to ask the canvas' host to drop keyboard focus on an item */
+ virtual void unfocus (Item*) = 0;
+
void render (Rect const &, Cairo::RefPtr<Cairo::Context> const &) const;
/** @return root group */
@@ -99,6 +110,8 @@ public:
void scroll_to (Coord x, Coord y);
virtual Rect visible_area () const = 0;
+ void zoomed();
+
std::string indent() const;
std::string render_indent() const;
void dump (std::ostream&) const;
@@ -112,12 +125,12 @@ protected:
Coord _scroll_offset_x;
Coord _scroll_offset_y;
- virtual void enter_leave_items (int state) = 0;
- virtual void enter_leave_items (Duple const &, int state) = 0;
+ virtual void pick_current_item (int state) = 0;
+ virtual void pick_current_item (Duple const &, int state) = 0;
};
/** A canvas which renders onto a GTK EventBox */
-class GtkCanvas : public Canvas, public Gtk::EventBox
+class LIBCANVAS_API GtkCanvas : public Canvas, public Gtk::EventBox
{
public:
GtkCanvas ();
@@ -126,6 +139,8 @@ public:
void request_size (Duple);
void grab (Item *);
void ungrab ();
+ void focus (Item *);
+ void unfocus (Item*);
Cairo::RefPtr<Cairo::Context> context ();
@@ -136,23 +151,29 @@ protected:
bool on_button_press_event (GdkEventButton *);
bool on_button_release_event (GdkEventButton* event);
bool on_motion_notify_event (GdkEventMotion *);
+ bool on_enter_notify_event (GdkEventCrossing*);
+ bool on_leave_notify_event (GdkEventCrossing*);
bool button_handler (GdkEventButton *);
bool motion_notify_handler (GdkEventMotion *);
- bool deliver_event (Duple, GdkEvent *);
-
- void enter_leave_items (int state);
- void enter_leave_items (Duple const &, int state);
+ bool deliver_event (GdkEvent *);
+ void deliver_enter_leave (Duple const & point, int state);
+
+ void pick_current_item (int state);
+ void pick_current_item (Duple const &, int state);
private:
void item_going_away (Item *, boost::optional<Rect>);
bool send_leave_event (Item const *, double, double) const;
-
- /** the item that the mouse is currently over, or 0 */
- Item const * _current_item;
+ /** Item currently chosen for event delivery based on pointer position */
+ Item * _current_item;
+ /** Item pending as _current_item */
+ Item * _new_current_item;
/** the item that is currently grabbed, or 0 */
- Item const * _grabbed_item;
+ Item * _grabbed_item;
+ /** the item that currently has key focus or 0 */
+ Item * _focused_item;
};
/** A GTK::Alignment with a GtkCanvas inside it plus some Gtk::Adjustments for
@@ -161,7 +182,7 @@ private:
* This provides a GtkCanvas that can be scrolled. It does NOT implement the
* Gtk::Scrollable interface.
*/
-class GtkCanvasViewport : public Gtk::Alignment
+class LIBCANVAS_API GtkCanvasViewport : public Gtk::Alignment
{
public:
GtkCanvasViewport (Gtk::Adjustment &, Gtk::Adjustment &);