2008-06-05 21:27:53 +02:00
|
|
|
/*
|
|
|
|
|
header-container.hpp - Declaration of the header container widget
|
|
|
|
|
|
|
|
|
|
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 header-container.hpp
|
|
|
|
|
** This file contains the definition of the header container
|
|
|
|
|
** widget
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef HEADER_CONTAINER_HPP
|
|
|
|
|
#define HEADER_CONTAINER_HPP
|
|
|
|
|
|
|
|
|
|
#include <gtkmm.h>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace lumiera {
|
|
|
|
|
namespace gui {
|
|
|
|
|
namespace widgets {
|
|
|
|
|
|
|
|
|
|
class TimelineWidget;
|
|
|
|
|
|
|
|
|
|
namespace timeline {
|
|
|
|
|
|
2008-06-07 13:09:22 +02:00
|
|
|
class Track;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A helper class for the TimelineWidget. HeaderContainer is
|
|
|
|
|
* container widget for all the left-hand-side header widgets
|
|
|
|
|
* associated with timeline tracks.
|
|
|
|
|
*/
|
2008-06-05 21:27:53 +02:00
|
|
|
class HeaderContainer : public Gtk::Container
|
2008-08-04 17:39:36 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* Constructor
|
|
|
|
|
*
|
|
|
|
|
* @param[in] timeline_widget A pointer to the owner timeline widget
|
|
|
|
|
*/
|
|
|
|
|
HeaderContainer(lumiera::gui::widgets::TimelineWidget *timeline_widget);
|
2008-06-05 21:27:53 +02:00
|
|
|
|
2008-08-04 17:39:36 +02:00
|
|
|
/**
|
|
|
|
|
* Attaches the header all the header widgets of root
|
|
|
|
|
* tracks to this control.
|
|
|
|
|
*
|
|
|
|
|
* @note This must be called when the track list changes
|
|
|
|
|
* to synchronise the headers with the timeline body and
|
|
|
|
|
* the backend.
|
|
|
|
|
*/
|
|
|
|
|
void update_headers();
|
|
|
|
|
|
|
|
|
|
/* ===== Overrides ===== */
|
|
|
|
|
private:
|
|
|
|
|
void on_realize();
|
|
|
|
|
void on_unrealize();
|
|
|
|
|
|
|
|
|
|
void on_size_allocate (Gtk::Allocation& allocation);
|
|
|
|
|
void on_size_request (Gtk::Requisition* requisition);
|
2008-06-05 21:27:53 +02:00
|
|
|
|
2008-08-04 17:39:36 +02:00
|
|
|
void forall_vfunc(gboolean include_internals, GtkCallback callback,
|
|
|
|
|
gpointer callback_data);
|
2008-06-07 13:09:22 +02:00
|
|
|
|
2008-08-04 17:39:36 +02:00
|
|
|
/* ===== Events ===== */
|
|
|
|
|
private:
|
|
|
|
|
void on_scroll();
|
2008-06-05 21:27:53 +02:00
|
|
|
|
2008-08-04 17:39:36 +02:00
|
|
|
/* ===== Internals ===== */
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Moves all the header widgets to the correct position
|
|
|
|
|
* given scroll, stacking etc.
|
|
|
|
|
*/
|
|
|
|
|
void layout_headers();
|
2008-06-07 13:09:22 +02:00
|
|
|
|
2008-08-04 17:39:36 +02:00
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The owner TimelineWidget of which this class is a helper
|
|
|
|
|
*/
|
|
|
|
|
lumiera::gui::widgets::TimelineWidget *timelineWidget;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A structure to represent a header widget and it's
|
|
|
|
|
* associated track
|
|
|
|
|
*/
|
|
|
|
|
struct RootHeader
|
|
|
|
|
{
|
|
|
|
|
Glib::RefPtr<Gtk::Widget> widget;
|
|
|
|
|
Track *track;
|
2008-06-05 21:27:53 +02:00
|
|
|
};
|
2008-08-04 17:39:36 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Contains a list of the root currently present on
|
|
|
|
|
* the timeline view
|
|
|
|
|
*/
|
|
|
|
|
std::vector< RootHeader > rootHeaders;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The widget's window object.
|
|
|
|
|
*
|
|
|
|
|
* @note This is needed for the sake of clipping when
|
|
|
|
|
* widgets are scrolled.
|
|
|
|
|
*/
|
|
|
|
|
Glib::RefPtr<Gdk::Window> gdkWindow;
|
|
|
|
|
};
|
2008-06-05 21:27:53 +02:00
|
|
|
|
|
|
|
|
} // namespace timeline
|
|
|
|
|
} // namespace widgets
|
|
|
|
|
} // namespace gui
|
|
|
|
|
} // namespace lumiera
|
|
|
|
|
|
|
|
|
|
#endif // HEADER_CONTAINER_HPP
|
|
|
|
|
|