LUMIERA.clone/src/gui/widgets/timeline/timeline-ibeam-tool.hpp
2008-08-16 12:32:26 +01:00

114 lines
2.9 KiB
C++

/*
timeline-ibeam-tool.hpp - Declaration of the ArrowTool class
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
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 2 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file timeline-ibeam-tool.hpp
** This file contains the definition of ibeam tool class
** tool objects
*/
#ifndef TIMELINE_IBEAM_TOOL_HPP
#define TIMELINE_IBEAM_TOOL_HPP
#include <gtkmm.h>
#include "timeline-tool.hpp"
namespace lumiera {
namespace gui {
namespace widgets {
namespace timeline {
/**
* A helper class to implement the timeline i-beam tool
*/
class IBeamTool : public Tool
{
public:
/**
* Constructor
* @param timeline_body The owner timeline body object
*/
IBeamTool(TimelineBody *timeline_body);
~IBeamTool();
/**
* Gets the type of tool represented by this class
*/
ToolType get_type() const;
protected:
/**
* Gets the cursor to display for this tool at this moment.
*/
Gdk::Cursor get_cursor() const;
protected:
void on_button_press_event(GdkEventButton* event);
void on_button_release_event(GdkEventButton* event);
void on_motion_notify_event(GdkEventMotion *event);
private:
/* ===== Internal Event Handlers ===== */
/**
* An internal event handler, which is called when the scroll slide
* timer calls it.
*/
bool on_scroll_slide_timer();
private:
/* ===== Internal Methods ===== */
/**
* As the user drags, this function is called to update the position
* of the moving end of the selection.
*/
void set_leading_x(const int x);
/**
* Begins, or continues a scroll slide at a given rate
* @param scroll_slide_rate The distance to slide every timer event
* in units of 1/256th of the view width.
*/
void begin_scroll_slide(int scroll_slide_rate);
/**
* Ends a scroll slide, and disconnects the slide timer
*/
void end_scroll_slide();
private:
/* ==== Internals ===== */
gavl_time_t dragStartTime;
sigc::connection scrollSlideEvent;
int scrollSlideRate;
/* ===== Constants ===== */
static const int ScrollSlideRateDivisor;
static const int ScrollSlideEventInterval;
};
} // namespace timeline
} // namespace widgets
} // namespace gui
} // namespace lumiera
#endif // TIMELINE_IBEAM_TOOL_HPP