mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-05 21:25:46 +01:00
Move more Gtkmm2ext widgets into libwidget
This commit is contained in:
parent
b5e9451bc7
commit
f9e5e4360e
78 changed files with 428 additions and 443 deletions
|
|
@ -25,11 +25,11 @@
|
|||
#include <gtkmm/action.h>
|
||||
|
||||
#include "pbd/signals.h"
|
||||
#include "gtkmm2ext/ardour_icon.h"
|
||||
#include "gtkmm2ext/binding_proxy.h"
|
||||
#include "gtkmm2ext/activatable.h"
|
||||
#include "gtkmm2ext/cairo_widget.h"
|
||||
|
||||
#include "widgets/ardour_icon.h"
|
||||
#include "widgets/binding_proxy.h"
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
|
@ -80,8 +80,8 @@ class LIBWIDGETS_API ArdourButton : public CairoWidget , public Gtkmm2ext::Activ
|
|||
void set_elements (Element);
|
||||
void add_elements (Element);
|
||||
|
||||
Gtkmm2ext::ArdourIcon::Icon icon() const { return _icon; }
|
||||
void set_icon (Gtkmm2ext::ArdourIcon::Icon);
|
||||
ArdourIcon::Icon icon() const { return _icon; }
|
||||
void set_icon (ArdourIcon::Icon);
|
||||
void set_icon (rendercallback_t, void*);
|
||||
|
||||
void set_corner_radius (float);
|
||||
|
|
@ -155,7 +155,7 @@ class LIBWIDGETS_API ArdourButton : public CairoWidget , public Gtkmm2ext::Activ
|
|||
std::string _sizing_text;
|
||||
bool _markup;
|
||||
Element _elements;
|
||||
Gtkmm2ext::ArdourIcon::Icon _icon;
|
||||
ArdourIcon::Icon _icon;
|
||||
rendercallback_t _icon_render_cb;
|
||||
void* _icon_render_cb_data;
|
||||
Tweaks _tweaks;
|
||||
|
|
|
|||
50
libs/widgets/widgets/ardour_icon.h
Normal file
50
libs/widgets/widgets/ardour_icon.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#ifndef _WIDGETS_ARDOUR_ICON_H_
|
||||
#define _WIDGETS_ARDOUR_ICON_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cairo.h>
|
||||
|
||||
#include "gtkmm2ext/widget_state.h"
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace ArdourWidgets { namespace ArdourIcon {
|
||||
enum Icon {
|
||||
NoIcon,
|
||||
RecButton,
|
||||
RecTapeMode,
|
||||
CloseCross,
|
||||
StripWidth,
|
||||
DinMidi,
|
||||
TransportStop,
|
||||
TransportPlay,
|
||||
TransportLoop,
|
||||
TransportRange,
|
||||
TransportStart,
|
||||
TransportEnd,
|
||||
TransportPanic,
|
||||
TransportMetronom,
|
||||
NudgeLeft,
|
||||
NudgeRight,
|
||||
ZoomIn,
|
||||
ZoomOut,
|
||||
ZoomFull,
|
||||
ZoomExpand,
|
||||
TimeAxisShrink,
|
||||
TimeAxisExpand,
|
||||
ToolGrab,
|
||||
ToolRange,
|
||||
ToolCut,
|
||||
ToolStretch,
|
||||
ToolAudition,
|
||||
ToolDraw,
|
||||
ToolContent,
|
||||
};
|
||||
|
||||
LIBWIDGETS_API bool render (cairo_t *cr,
|
||||
const enum Icon icon,
|
||||
const int width, const int height,
|
||||
const Gtkmm2ext::ActiveState state,
|
||||
const uint32_t fg_color);
|
||||
}; } /* end namespace */
|
||||
|
||||
#endif
|
||||
|
|
@ -26,11 +26,11 @@
|
|||
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "gtkmm2ext/binding_proxy.h"
|
||||
#include "gtkmm2ext/activatable.h"
|
||||
#include "gtkmm2ext/cairo_widget.h"
|
||||
#include "gtkmm2ext/persistent_tooltip.h"
|
||||
|
||||
#include "widgets/binding_proxy.h"
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <gtkmm/alignment.h>
|
||||
#include <cairo.h>
|
||||
|
||||
#include "gtkmm2ext/binding_proxy.h"
|
||||
#include "widgets/binding_proxy.h"
|
||||
#include "widgets/slider_controller.h"
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
|
|
|
|||
68
libs/widgets/widgets/binding_proxy.h
Normal file
68
libs/widgets/widgets/binding_proxy.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
Copyright (C) 2006 Paul Davis
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef _WIDGETS_BINDING_PROXY_
|
||||
#define _WIDGETS_BINDING_PROXY_
|
||||
|
||||
#include <string>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace PBD {
|
||||
class Controllable;
|
||||
}
|
||||
|
||||
namespace ArdourWidgets {
|
||||
class PopUp;
|
||||
}
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API BindingProxy : public sigc::trackable
|
||||
{
|
||||
public:
|
||||
BindingProxy (boost::shared_ptr<PBD::Controllable>);
|
||||
BindingProxy ();
|
||||
virtual ~BindingProxy();
|
||||
|
||||
void set_bind_button_state (guint button, guint statemask);
|
||||
|
||||
static bool is_bind_action (GdkEventButton *);
|
||||
bool button_press_handler (GdkEventButton *);
|
||||
|
||||
boost::shared_ptr<PBD::Controllable> get_controllable() const { return controllable; }
|
||||
void set_controllable (boost::shared_ptr<PBD::Controllable>);
|
||||
|
||||
protected:
|
||||
ArdourWidgets::PopUp* prompter;
|
||||
boost::shared_ptr<PBD::Controllable> controllable;
|
||||
|
||||
static guint bind_button;
|
||||
static guint bind_statemask;
|
||||
|
||||
PBD::ScopedConnection learning_connection;
|
||||
void learning_finished ();
|
||||
bool prompter_hiding (GdkEventAny *);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
47
libs/widgets/widgets/choice.h
Normal file
47
libs/widgets/widgets/choice.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
Copyright (C) 2000-2007 Paul Davis
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _WIDGETS_CHOICE_H_
|
||||
#define _WIDGETS_CHOICE_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <gtkmm/dialog.h>
|
||||
#include <gtkmm/image.h>
|
||||
#include <gtkmm/stock.h>
|
||||
#include <gtkmm/box.h>
|
||||
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API Choice : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
Choice (std::string title, std::string prompt, std::vector<std::string> choices, bool center = true);
|
||||
virtual ~Choice ();
|
||||
|
||||
protected:
|
||||
void on_realize ();
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
||||
#endif
|
||||
|
|
@ -27,9 +27,8 @@
|
|||
#include <string>
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include "gtkmm2ext/binding_proxy.h"
|
||||
|
||||
#include "widgets/auto_spin.h"
|
||||
#include "widgets/binding_proxy.h"
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace PBD {
|
||||
|
|
|
|||
59
libs/widgets/widgets/eventboxext.h
Normal file
59
libs/widgets/widgets/eventboxext.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (C) 2017 Robin Gareus <robin@gareus.org>
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _WIDGETS_EVENTBOX_EXT_H_
|
||||
#define _WIDGETS_EVENTBOX_EXT_H_
|
||||
|
||||
#include <gtkmm/eventbox.h>
|
||||
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API EventBoxExt : public Gtk::EventBox
|
||||
{
|
||||
public:
|
||||
EventBoxExt ();
|
||||
virtual ~EventBoxExt () {}
|
||||
|
||||
protected:
|
||||
/* gtk2's gtk/gtkcontainer.c does not
|
||||
* unmap child widgets if the container has a window.
|
||||
*
|
||||
* (this is for historical reasons and optimization
|
||||
* because back in the day each GdkWindow was backed by
|
||||
* an actual windowing system surface).
|
||||
*
|
||||
* In Ardour's case an EventBox is used in the Editor's top-level
|
||||
* and child-widgets (e.g. Canvas::GtkCanvas never receive an unmap.
|
||||
*
|
||||
* However, when switching Tabbable pages, we do need to hide overlays
|
||||
* such as ArdourCanvasOpenGLView
|
||||
*
|
||||
*/
|
||||
void on_unmap () {
|
||||
Gtk::EventBox::on_unmap();
|
||||
if (get_child ()) {
|
||||
get_child()->unmap();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
||||
#endif
|
||||
133
libs/widgets/widgets/pane.h
Normal file
133
libs/widgets/widgets/pane.h
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
Copyright (C) 2016 Paul Davis
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _WIDGETS_PANE_H_
|
||||
#define _WIDGETS_PANE_H_
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <gdkmm/cursor.h>
|
||||
#include <gtkmm/container.h>
|
||||
#include <gtkmm/eventbox.h>
|
||||
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace Gtk {
|
||||
class Widget;
|
||||
}
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API Pane : public Gtk::Container
|
||||
{
|
||||
private:
|
||||
class Divider;
|
||||
|
||||
public:
|
||||
struct Child
|
||||
{
|
||||
Pane* pane;
|
||||
Gtk::Widget* w;
|
||||
int32_t minsize;
|
||||
sigc::connection show_con;
|
||||
sigc::connection hide_con;
|
||||
|
||||
Child (Pane* p, Gtk::Widget* widget, uint32_t ms) : pane (p), w (widget), minsize (ms) {}
|
||||
};
|
||||
|
||||
typedef std::vector<boost::shared_ptr<Child> > Children;
|
||||
|
||||
Pane (bool horizontal);
|
||||
~Pane();
|
||||
|
||||
void set_divider (std::vector<float>::size_type divider, float fract);
|
||||
float get_divider (std::vector<float>::size_type divider = 0);
|
||||
void set_child_minsize (Gtk::Widget const &, int32_t);
|
||||
|
||||
GType child_type_vfunc() const;
|
||||
void set_drag_cursor (Gdk::Cursor);
|
||||
|
||||
void set_check_divider_position (bool);
|
||||
|
||||
protected:
|
||||
bool horizontal;
|
||||
|
||||
void on_add (Gtk::Widget*);
|
||||
void on_remove (Gtk::Widget*);
|
||||
void on_size_request (GtkRequisition*);
|
||||
void on_size_allocate (Gtk::Allocation&);
|
||||
bool on_expose_event (GdkEventExpose*);
|
||||
|
||||
bool handle_press_event (GdkEventButton*, Divider*);
|
||||
bool handle_release_event (GdkEventButton*, Divider*);
|
||||
bool handle_motion_event (GdkEventMotion*, Divider*);
|
||||
bool handle_enter_event (GdkEventCrossing*, Divider*);
|
||||
bool handle_leave_event (GdkEventCrossing*, Divider*);
|
||||
|
||||
void forall_vfunc (gboolean include_internals, GtkCallback callback, gpointer callback_data);
|
||||
|
||||
private:
|
||||
Gdk::Cursor drag_cursor;
|
||||
bool did_move;
|
||||
|
||||
void reallocate (Gtk::Allocation const &);
|
||||
|
||||
Children children;
|
||||
|
||||
struct Divider : public Gtk::EventBox {
|
||||
Divider ();
|
||||
|
||||
float fract;
|
||||
bool dragging;
|
||||
|
||||
bool on_expose_event (GdkEventExpose* ev);
|
||||
};
|
||||
|
||||
typedef std::list<Divider*> Dividers;
|
||||
Dividers dividers;
|
||||
int divider_width;
|
||||
bool check_fract;
|
||||
|
||||
void add_divider ();
|
||||
void handle_child_visibility ();
|
||||
float constrain_fract (Dividers::size_type, float fract);
|
||||
|
||||
static void* notify_child_destroyed (void*);
|
||||
void* child_destroyed (Gtk::Widget*);
|
||||
};
|
||||
|
||||
class LIBWIDGETS_API HPane : public Pane
|
||||
{
|
||||
public:
|
||||
HPane () : Pane (true) {}
|
||||
};
|
||||
|
||||
class LIBWIDGETS_API VPane : public Pane
|
||||
{
|
||||
public:
|
||||
VPane () : Pane (false) {}
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
||||
#endif
|
||||
57
libs/widgets/widgets/paths_dialog.h
Normal file
57
libs/widgets/widgets/paths_dialog.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
Copyright (C) 2014 Robin Gareus <robin@gareus.org>
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
#ifndef _WIDGETS_PATHS_DIALOG_H_
|
||||
#define _WIDGETS_PATHS_DIALOG_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API PathsDialog : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
PathsDialog (Gtk::Window& parent, std::string, std::string current_paths = "", std::string default_paths = "");
|
||||
~PathsDialog ();
|
||||
|
||||
std::string get_serialized_paths ();
|
||||
|
||||
private:
|
||||
void on_show ();
|
||||
|
||||
Gtk::ListViewText paths_list_view;
|
||||
|
||||
Gtk::Button add_path_button;
|
||||
Gtk::Button remove_path_button;
|
||||
Gtk::Button set_default_button;
|
||||
|
||||
void selection_changed();
|
||||
void add_path();
|
||||
void remove_path();
|
||||
void set_default();
|
||||
|
||||
std::string _default_paths;
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
||||
#endif
|
||||
64
libs/widgets/widgets/popup.h
Normal file
64
libs/widgets/widgets/popup.h
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
Copyright (C) 1998-99 Paul Barton-Davis
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _WIDGETS_POPUP_H_
|
||||
#define _WIDGETS_POPUP_H_
|
||||
|
||||
#ifdef interface
|
||||
#undef interface
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include <pbd/touchable.h>
|
||||
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API PopUp : public Gtk::Window, public Touchable
|
||||
{
|
||||
public:
|
||||
PopUp (Gtk::WindowPosition pos, unsigned int show_for_msecs = 0,
|
||||
bool delete_on_hide = false);
|
||||
virtual ~PopUp ();
|
||||
void touch ();
|
||||
void remove ();
|
||||
void set_text (std::string);
|
||||
void set_name (std::string);
|
||||
gint button_click (GdkEventButton *);
|
||||
|
||||
bool on_delete_event (GdkEventAny* );
|
||||
|
||||
protected:
|
||||
void on_realize ();
|
||||
|
||||
private:
|
||||
Gtk::Label label;
|
||||
std::string my_text;
|
||||
gint timeout;
|
||||
static gint remove_prompt_timeout (void *);
|
||||
bool delete_on_hide;
|
||||
unsigned int popdown_time;
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
||||
#endif
|
||||
77
libs/widgets/widgets/prompter.h
Normal file
77
libs/widgets/widgets/prompter.h
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
Copyright (C) 1999 Paul Barton-Davis
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _WIDGETS_PROMPTER_H_
|
||||
#define _WIDGETS_PROMPTER_H_
|
||||
|
||||
#include <string>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/entry.h>
|
||||
#include <gtkmm/label.h>
|
||||
#include <gtkmm/dialog.h>
|
||||
#include <sigc++/sigc++.h>
|
||||
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace Gtk {
|
||||
class Window;
|
||||
}
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API Prompter : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
Prompter (bool modal = false);
|
||||
Prompter (Gtk::Window& parent, bool modal = false);
|
||||
~Prompter () {};
|
||||
|
||||
void set_prompt (std::string prompt) {
|
||||
entryLabel.set_label (prompt);
|
||||
}
|
||||
|
||||
void set_initial_text (std::string txt) {
|
||||
entry.set_text (txt);
|
||||
entry.select_region (0, entry.get_text_length());
|
||||
}
|
||||
|
||||
void change_labels (std::string ok, std::string cancel);
|
||||
|
||||
void get_result (std::string &str, bool strip=true);
|
||||
|
||||
protected:
|
||||
Gtk::Entry& the_entry() { return entry; }
|
||||
|
||||
void on_entry_changed ();
|
||||
void on_show ();
|
||||
|
||||
private:
|
||||
Gtk::Entry entry;
|
||||
Gtk::HBox entryBox;
|
||||
Gtk::Label entryLabel;
|
||||
bool first_show;
|
||||
bool can_accept_from_entry;
|
||||
|
||||
void init ();
|
||||
void entry_activated ();
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
||||
#endif
|
||||
93
libs/widgets/widgets/scroomer.h
Normal file
93
libs/widgets/widgets/scroomer.h
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
Copyright (C) 2008 Paul Davis
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _WIDGETS_SCROOMER_H_
|
||||
#define _WIDGETS_SCROOMER_H_
|
||||
|
||||
#include <gdkmm.h>
|
||||
#include <gtkmm/drawingarea.h>
|
||||
#include <gtkmm/adjustment.h>
|
||||
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API Scroomer : public Gtk::DrawingArea
|
||||
{
|
||||
public:
|
||||
enum Component {
|
||||
TopBase = 0,
|
||||
Handle1 = 1,
|
||||
Slider = 2,
|
||||
Handle2 = 3,
|
||||
BottomBase = 4,
|
||||
Total = 5,
|
||||
None = 6
|
||||
};
|
||||
|
||||
Scroomer(Gtk::Adjustment& adjustment);
|
||||
~Scroomer();
|
||||
|
||||
bool on_motion_notify_event (GdkEventMotion*);
|
||||
bool on_button_press_event (GdkEventButton*);
|
||||
bool on_button_release_event (GdkEventButton*);
|
||||
bool on_scroll_event (GdkEventScroll*);
|
||||
virtual void on_size_allocate (Gtk::Allocation&);
|
||||
|
||||
void set_comp_rect(GdkRectangle&, Component) const;
|
||||
|
||||
Component point_in(double point) const;
|
||||
|
||||
void set_min_page_size(double page_size);
|
||||
int get_handle_size() { return handle_size; }
|
||||
|
||||
inline int position_of(Component comp) { return position[comp]; }
|
||||
|
||||
sigc::signal0<void> DragStarting;
|
||||
sigc::signal0<void> DragFinishing;
|
||||
|
||||
sigc::signal0<void> DoubleClicked;
|
||||
|
||||
protected:
|
||||
Gtk::Adjustment& adj;
|
||||
|
||||
private:
|
||||
struct UpdateRect {
|
||||
GdkRectangle rect;
|
||||
Component first_comp;
|
||||
};
|
||||
|
||||
void update();
|
||||
void adjustment_changed ();
|
||||
|
||||
int position[6];
|
||||
int old_pos[6];
|
||||
int handle_size;
|
||||
double min_page_size;
|
||||
GdkWindow* grab_window;
|
||||
Component grab_comp;
|
||||
double grab_y;
|
||||
double unzoomed_val;
|
||||
double unzoomed_page;
|
||||
bool pinch;
|
||||
};
|
||||
|
||||
} /* end namespace */
|
||||
|
||||
#endif
|
||||
|
|
@ -26,10 +26,8 @@
|
|||
#include <gtkmm.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "gtkmm2ext/popup.h"
|
||||
#include "gtkmm2ext/binding_proxy.h"
|
||||
|
||||
#include "widgets/ardour_fader.h"
|
||||
#include "widgets/binding_proxy.h"
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace PBD {
|
||||
|
|
|
|||
95
libs/widgets/widgets/stateful_button.h
Normal file
95
libs/widgets/widgets/stateful_button.h
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
Copyright (C) 2005 Paul Davis
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _WIDGETS_STATEFUL_BUTTON_H_
|
||||
#define _WIDGETS_STATEFUL_BUTTON_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <gtkmm/togglebutton.h>
|
||||
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API StateButton
|
||||
{
|
||||
public:
|
||||
StateButton();
|
||||
virtual ~StateButton() {}
|
||||
|
||||
void set_visual_state (int);
|
||||
int get_visual_state () { return visual_state; }
|
||||
void set_self_managed (bool yn) { _self_managed = yn; }
|
||||
virtual void set_widget_name (const std::string& name) = 0;
|
||||
|
||||
protected:
|
||||
int visual_state;
|
||||
bool _self_managed;
|
||||
bool _is_realized;
|
||||
bool style_changing;
|
||||
Gtk::StateType state_before_prelight;
|
||||
bool is_toggle;
|
||||
|
||||
virtual std::string get_widget_name() const = 0;
|
||||
virtual Gtk::Widget* get_child_widget () = 0;
|
||||
|
||||
void avoid_prelight_on_style_changed (const Glib::RefPtr<Gtk::Style>& style, GtkWidget* widget);
|
||||
void avoid_prelight_on_state_changed (Gtk::StateType old_state, GtkWidget* widget);
|
||||
};
|
||||
|
||||
|
||||
class LIBWIDGETS_API StatefulToggleButton : public StateButton, public Gtk::ToggleButton
|
||||
{
|
||||
public:
|
||||
StatefulToggleButton();
|
||||
explicit StatefulToggleButton(const std::string &label);
|
||||
~StatefulToggleButton() {}
|
||||
void set_widget_name (const std::string& name);
|
||||
|
||||
protected:
|
||||
void on_realize ();
|
||||
void on_toggled ();
|
||||
void on_style_changed (const Glib::RefPtr<Gtk::Style>& style);
|
||||
void on_state_changed (Gtk::StateType old_state);
|
||||
|
||||
Gtk::Widget* get_child_widget ();
|
||||
std::string get_widget_name() const { return get_name(); }
|
||||
};
|
||||
|
||||
class LIBWIDGETS_API StatefulButton : public StateButton, public Gtk::Button
|
||||
{
|
||||
public:
|
||||
StatefulButton();
|
||||
explicit StatefulButton(const std::string &label);
|
||||
virtual ~StatefulButton() {}
|
||||
void set_widget_name (const std::string& name);
|
||||
|
||||
protected:
|
||||
void on_realize ();
|
||||
void on_style_changed (const Glib::RefPtr<Gtk::Style>& style);
|
||||
void on_state_changed (Gtk::StateType old_state);
|
||||
|
||||
Gtk::Widget* get_child_widget ();
|
||||
std::string get_widget_name() const { return get_name(); }
|
||||
};
|
||||
|
||||
} /* end namespace */
|
||||
|
||||
#endif
|
||||
102
libs/widgets/widgets/tabbable.h
Normal file
102
libs/widgets/widgets/tabbable.h
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
Copyright (C) 2015 Paul Davis
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _WIDGETS_TABBABLE_H_
|
||||
#define _WIDGETS_TABBABLE_H_
|
||||
|
||||
#include <gtkmm/bin.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/image.h>
|
||||
#include <gtkmm/label.h>
|
||||
#include <gtkmm/notebook.h>
|
||||
|
||||
#include "gtkmm2ext/window_proxy.h"
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
namespace Gtk {
|
||||
class Window;
|
||||
class Notebook;
|
||||
}
|
||||
|
||||
namespace Gtkmm2ext {
|
||||
class VisibilityTracker;
|
||||
}
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API Tabbable : public Gtkmm2ext::WindowProxy
|
||||
{
|
||||
public:
|
||||
Tabbable (Gtk::Widget&, const std::string&, bool tabbed_by_default = true);
|
||||
~Tabbable ();
|
||||
|
||||
void add_to_notebook (Gtk::Notebook& notebook, const std::string& tab_title);
|
||||
void make_visible ();
|
||||
void make_invisible ();
|
||||
void change_visibility ();
|
||||
void attach ();
|
||||
void detach ();
|
||||
|
||||
Gtk::Widget& contents() const { return _contents; }
|
||||
|
||||
Gtk::Window* get (bool create = false);
|
||||
Gtk::Window* own_window () { return get (false); }
|
||||
virtual Gtk::Window* use_own_window (bool and_pack_it);
|
||||
|
||||
void set_default_tabbed (bool yn);
|
||||
|
||||
virtual void show_window ();
|
||||
|
||||
bool window_visible () const;
|
||||
bool tabbed() const;
|
||||
bool tabbed_by_default () const;
|
||||
|
||||
Gtk::Window* current_toplevel () const;
|
||||
|
||||
Gtk::Notebook* tab_root_drop ();
|
||||
|
||||
int set_state (const XMLNode&, int version);
|
||||
XMLNode& get_state ();
|
||||
|
||||
static std::string xml_node_name();
|
||||
|
||||
sigc::signal1<void,Tabbable&> StateChange;
|
||||
|
||||
protected:
|
||||
bool delete_event_handler (GdkEventAny *ev);
|
||||
|
||||
private:
|
||||
Gtk::Widget& _contents;
|
||||
Gtk::Notebook _own_notebook;
|
||||
Gtk::Notebook* _parent_notebook;
|
||||
std::string _tab_title;
|
||||
bool tab_requested_by_state;
|
||||
|
||||
void show_tab ();
|
||||
void hide_tab ();
|
||||
bool tab_close_clicked (GdkEventButton*);
|
||||
void show_own_window (bool and_pack_it);
|
||||
void window_mapped ();
|
||||
void window_unmapped ();
|
||||
};
|
||||
|
||||
} /* end namespace */
|
||||
|
||||
#endif
|
||||
92
libs/widgets/widgets/tearoff.h
Normal file
92
libs/widgets/widgets/tearoff.h
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
Copyright (C) 2003 Paul Barton-Davis
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _WIDGETS_TEAROFF_H_
|
||||
#define _WIDGETS_TEAROFF_H_
|
||||
|
||||
#include <gtkmm/arrow.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/eventbox.h>
|
||||
#include <gtkmm/window.h>
|
||||
|
||||
#include "widgets/visibility.h"
|
||||
|
||||
class XMLNode;
|
||||
|
||||
namespace ArdourWidgets {
|
||||
|
||||
class LIBWIDGETS_API TearOff : public Gtk::HBox
|
||||
{
|
||||
public:
|
||||
TearOff (Gtk::Widget& contents, bool allow_resize = false);
|
||||
virtual ~TearOff ();
|
||||
|
||||
void set_visible (bool yn, bool force = false);
|
||||
void set_can_be_torn_off (bool);
|
||||
bool can_be_torn_off () const { return _can_be_torn_off; }
|
||||
bool visible () const { return _visible; }
|
||||
|
||||
sigc::signal<void> Detach;
|
||||
sigc::signal<void> Attach;
|
||||
sigc::signal<void> Visible;
|
||||
sigc::signal<void> Hidden;
|
||||
|
||||
Gtk::Window& tearoff_window() { return own_window; }
|
||||
bool torn_off() const;
|
||||
void tear_it_off ();
|
||||
void put_it_back ();
|
||||
void hide_visible ();
|
||||
|
||||
void set_state (const XMLNode&);
|
||||
void add_state (XMLNode&) const;
|
||||
|
||||
private:
|
||||
Gtk::Widget& contents;
|
||||
Gtk::Window own_window;
|
||||
Gtk::Arrow tearoff_arrow;
|
||||
Gtk::Arrow close_arrow;
|
||||
Gtk::HBox window_box;
|
||||
Gtk::EventBox tearoff_event_box;
|
||||
Gtk::EventBox close_event_box;
|
||||
double drag_x;
|
||||
double drag_y;
|
||||
bool dragging;
|
||||
bool _visible;
|
||||
bool _torn;
|
||||
bool _can_be_torn_off;
|
||||
int own_window_width;
|
||||
int own_window_height;
|
||||
int own_window_xpos;
|
||||
int own_window_ypos;
|
||||
|
||||
gint tearoff_click (GdkEventButton*);
|
||||
gint close_click (GdkEventButton*);
|
||||
|
||||
gint window_motion (GdkEventMotion*);
|
||||
gint window_button_press (GdkEventButton*);
|
||||
gint window_button_release (GdkEventButton*);
|
||||
gint window_delete_event (GdkEventAny*);
|
||||
|
||||
void own_window_realized ();
|
||||
bool own_window_configured (GdkEventConfigure*);
|
||||
};
|
||||
|
||||
} /* namespace */
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue