ardour
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ArdourButton Class Reference

#include <ardour_button.h>

Inheritance diagram for ArdourButton:
CairoWidget Gtkmm2ext::Activatable ArdourDisplay ArdourDropdown

Public Types

enum  Element {
  Edge = 0x1, Body = 0x2, Text = 0x4, Indicator = 0x8,
  unused = 0x10, Menu = 0x20, Inactive = 0x40, VectorIcon = 0x80
}
 
enum  Icon {
  NoIcon, RecButton, RecTapeMode, CloseCross,
  StripWidth, DinMidi, TransportStop, TransportPlay,
  TransportLoop, TransportRange, TransportStart, TransportEnd,
  TransportPanic, TransportMetronom
}
 
enum  Tweaks { Square = 0x1, TrackHeader = 0x2, unused3 = 0x4 }
 

Public Member Functions

 ArdourButton (Element e=default_elements)
 
 ArdourButton (const std::string &, Element e=default_elements)
 
virtual ~ArdourButton ()
 
Tweaks tweaks () const
 
void set_tweaks (Tweaks)
 
void set_active_state (Gtkmm2ext::ActiveState)
 
void set_visual_state (Gtkmm2ext::VisualState)
 
void set_custom_led_color (const uint32_t c, const bool useit=true)
 
void set_act_on_release (bool onRelease)
 
Element elements () const
 
void set_elements (Element)
 
void add_elements (Element)
 
Icon icon () const
 
void set_icon (Icon)
 
void set_corner_radius (float)
 
void set_text (const std::string &)
 
const std::string & get_text ()
 
void set_angle (const double)
 
void set_alignment (const float, const float)
 
void get_alignment (float &xa, float &ya)
 
void set_led_left (bool yn)
 
void set_distinct_led_click (bool yn)
 
void set_layout_ellipsize_width (int w)
 
void set_layout_font (const Pango::FontDescription &)
 
void set_text_ellipsize (Pango::EllipsizeMode)
 
boost::shared_ptr
< PBD::Controllable
get_controllable ()
 
void set_controllable (boost::shared_ptr< PBD::Controllable > c)
 
void watch ()
 
void set_related_action (Glib::RefPtr< Gtk::Action >)
 
bool on_button_press_event (GdkEventButton *)
 
bool on_button_release_event (GdkEventButton *)
 
void set_image (const Glib::RefPtr< Gdk::Pixbuf > &)
 
void set_fixed_colors (const uint32_t active_color, const uint32_t inactive_color)
 
void set_fallthrough_to_parent (bool fall)
 
unsigned int char_pixel_width ()
 
unsigned int char_pixel_height ()
 
float char_avg_pixel_width ()
 
- Public Member Functions inherited from CairoWidget
 CairoWidget ()
 
virtual ~CairoWidget ()
 
void set_dirty ()
 
Gtkmm2ext::ActiveState active_state () const
 
Gtkmm2ext::VisualState visual_state () const
 
void unset_active_state ()
 
void unset_visual_state ()
 
void set_active (bool)
 
bool get_active ()
 
void set_draw_background (bool yn)
 
- Public Member Functions inherited from Gtkmm2ext::Activatable
virtual ~Activatable ()
 
Glib::RefPtr< Gtk::Action > get_related_action ()
 

Public Attributes

sigc::signal< void > signal_led_clicked
 
sigc::signal< void > signal_clicked
 
- Public Attributes inherited from CairoWidget
sigc::signal< void > StateChanged
 

Static Public Attributes

static Element default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text)
 
static Element led_default_elements = ArdourButton::Element (ArdourButton::default_elements|ArdourButton::Indicator)
 
static Element just_led_default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Indicator)
 

Protected Member Functions

void render (cairo_t *, cairo_rectangle_t *)
 
void on_size_request (Gtk::Requisition *req)
 
void on_size_allocate (Gtk::Allocation &)
 
void on_style_changed (const Glib::RefPtr< Gtk::Style > &)
 
void on_name_changed ()
 
void on_realize ()
 
bool on_enter_notify_event (GdkEventCrossing *)
 
bool on_leave_notify_event (GdkEventCrossing *)
 
bool on_focus_in_event (GdkEventFocus *)
 
bool on_focus_out_event (GdkEventFocus *)
 
bool on_key_release_event (GdkEventKey *)
 
void controllable_changed ()
 
void recalc_char_pixel_geometry ()
 
void setup_led_rect ()
 
void set_colors ()
 
void color_handler ()
 
void build_patterns ()
 
void ensure_layout ()
 
void action_toggled ()
 
void action_sensitivity_changed ()
 
void action_visibility_changed ()
 
void action_tooltip_changed ()
 
- Protected Member Functions inherited from CairoWidget
virtual bool on_expose_event (GdkEventExpose *)
 
void on_size_allocate (Gtk::Allocation &)
 
void on_state_changed (Gtk::StateType)
 
void on_style_changed (const Glib::RefPtr< Gtk::Style > &)
 
bool on_button_press_event (GdkEventButton *)
 
Gdk::Color get_parent_bg ()
 

Protected Attributes

PBD::ScopedConnection watch_connection
 
Glib::RefPtr< Pango::Layout > _layout
 
Glib::RefPtr< Gdk::Pixbuf > _pixbuf
 
std::string _text
 
Element _elements
 
Icon _icon
 
Tweaks _tweaks
 
BindingProxy binding_proxy
 
unsigned int _char_pixel_width
 
unsigned int _char_pixel_height
 
float _char_avg_pixel_width
 
int _text_width
 
int _text_height
 
float _diameter
 
float _corner_radius
 
int _corner_mask
 
double _angle
 
float _xalign
 
float _yalign
 
uint32_t fill_inactive_color
 
uint32_t fill_active_color
 
uint32_t text_active_color
 
uint32_t text_inactive_color
 
uint32_t led_active_color
 
uint32_t led_inactive_color
 
uint32_t led_custom_color
 
bool use_custom_led_color
 
cairo_pattern_t * convex_pattern
 
cairo_pattern_t * concave_pattern
 
cairo_pattern_t * led_inset_pattern
 
cairo_rectangle_t * _led_rect
 
bool _act_on_release
 
bool _led_left
 
bool _distinct_led_click
 
bool _hovering
 
bool _focused
 
bool _fixed_colors_set
 
bool _fallthrough_to_parent
 
int _layout_ellipsize_width
 
Pango::EllipsizeMode _ellipsis
 
bool _update_colors
 
int _pattern_height
 
- Protected Attributes inherited from CairoWidget
Gtkmm2ext::ActiveState _active_state
 
Gtkmm2ext::VisualState _visual_state
 
bool _need_bg
 
bool _grabbed
 
- Protected Attributes inherited from Gtkmm2ext::Activatable
Glib::RefPtr< Gtk::Action > _action
 

Additional Inherited Members

- Static Public Member Functions inherited from CairoWidget
static void provide_background_for_cairo_widget (Gtk::Widget &w, const Gdk::Color &bg)
 
static void set_flat_buttons (bool yn)
 
static bool flat_buttons ()
 
static void set_widget_prelight (bool yn)
 
static bool widget_prelight ()
 
static void set_source_rgb_a (cairo_t *cr, Gdk::Color, float a=1.0)
 
static void set_focus_handler (sigc::slot< void >)
 
- Static Protected Attributes inherited from CairoWidget
static bool _flat_buttons = false
 
static bool _widget_prelight = true
 
static sigc::slot< void > focus_handler
 

Detailed Description

Definition at line 32 of file ardour_button.h.

Member Enumeration Documentation

Enumerator
Edge 
Body 
Text 
Indicator 
unused 
Menu 
Inactive 
VectorIcon 

Definition at line 35 of file ardour_button.h.

Enumerator
NoIcon 
RecButton 
RecTapeMode 
CloseCross 
StripWidth 
DinMidi 
TransportStop 
TransportPlay 
TransportLoop 
TransportRange 
TransportStart 
TransportEnd 
TransportPanic 
TransportMetronom 

Definition at line 46 of file ardour_button.h.

Enumerator
Square 
TrackHeader 
unused3 

Definition at line 71 of file ardour_button.h.

Constructor & Destructor Documentation

ArdourButton::ArdourButton ( Element  e = default_elements)

Definition at line 60 of file ardour_button.cc.

ArdourButton::ArdourButton ( const std::string &  str,
Element  e = default_elements 
)

Definition at line 102 of file ardour_button.cc.

ArdourButton::~ArdourButton ( )
virtual

Definition at line 142 of file ardour_button.cc.

Member Function Documentation

void ArdourButton::action_sensitivity_changed ( )
protected

Definition at line 1317 of file ardour_button.cc.

void ArdourButton::action_toggled ( )
protected

Definition at line 1159 of file ardour_button.cc.

void ArdourButton::action_tooltip_changed ( )
protected

Definition at line 1409 of file ardour_button.cc.

void ArdourButton::action_visibility_changed ( )
protected

Definition at line 1399 of file ardour_button.cc.

void ArdourButton::add_elements ( Element  e)

Definition at line 1423 of file ardour_button.cc.

void ArdourButton::build_patterns ( )
protected

Definition at line 982 of file ardour_button.cc.

float ArdourButton::char_avg_pixel_width ( )
inline

Definition at line 129 of file ardour_button.h.

unsigned int ArdourButton::char_pixel_height ( )
inline

Definition at line 128 of file ardour_button.h.

unsigned int ArdourButton::char_pixel_width ( )
inline

Definition at line 127 of file ardour_button.h.

void ArdourButton::color_handler ( )
protected

Definition at line 1092 of file ardour_button.cc.

void ArdourButton::controllable_changed ( )
protected

Definition at line 1125 of file ardour_button.cc.

Element ArdourButton::elements ( ) const
inline

Definition at line 87 of file ardour_button.h.

void ArdourButton::ensure_layout ( )
protected

Definition at line 1364 of file ardour_button.cc.

void ArdourButton::get_alignment ( float &  xa,
float &  ya 
)
inline

Definition at line 100 of file ardour_button.h.

boost::shared_ptr<PBD::Controllable> ArdourButton::get_controllable ( )
inline

Definition at line 112 of file ardour_button.h.

const std::string& ArdourButton::get_text ( )
inline

Definition at line 97 of file ardour_button.h.

Icon ArdourButton::icon ( ) const
inline

Definition at line 91 of file ardour_button.h.

bool ArdourButton::on_button_press_event ( GdkEventButton *  ev)

Definition at line 1023 of file ardour_button.cc.

bool ArdourButton::on_button_release_event ( GdkEventButton *  ev)

Definition at line 1055 of file ardour_button.cc.

bool ArdourButton::on_enter_notify_event ( GdkEventCrossing *  ev)
protected

Definition at line 1282 of file ardour_button.cc.

bool ArdourButton::on_focus_in_event ( GdkEventFocus *  ev)
protected

Definition at line 1252 of file ardour_button.cc.

bool ArdourButton::on_focus_out_event ( GdkEventFocus *  ev)
protected

Definition at line 1260 of file ardour_button.cc.

bool ArdourButton::on_key_release_event ( GdkEventKey *  ev)
protected

Definition at line 1268 of file ardour_button.cc.

bool ArdourButton::on_leave_notify_event ( GdkEventCrossing *  ev)
protected

Definition at line 1294 of file ardour_button.cc.

void ArdourButton::on_name_changed ( )
protectedvirtual

Reimplemented from CairoWidget.

Definition at line 1180 of file ardour_button.cc.

void ArdourButton::on_realize ( )
protected

Definition at line 812 of file ardour_button.cc.

void ArdourButton::on_size_allocate ( Gtk::Allocation &  )
protected

Definition at line 1099 of file ardour_button.cc.

void ArdourButton::on_size_request ( Gtk::Requisition *  req)
protected

Definition at line 823 of file ardour_button.cc.

void ArdourButton::on_style_changed ( const Glib::RefPtr< Gtk::Style > &  )
protected

Definition at line 1173 of file ardour_button.cc.

void ArdourButton::recalc_char_pixel_geometry ( )
protected

Definition at line 1377 of file ardour_button.cc.

void ArdourButton::render ( cairo_t *  cr,
cairo_rectangle_t *   
)
protectedvirtual

Implements CairoWidget.

Definition at line 197 of file ardour_button.cc.

void ArdourButton::set_act_on_release ( bool  onRelease)
inline

Definition at line 85 of file ardour_button.h.

void ArdourButton::set_active_state ( Gtkmm2ext::ActiveState  s)
virtual

Reimplemented from CairoWidget.

Definition at line 1230 of file ardour_button.cc.

void ArdourButton::set_alignment ( const float  xa,
const float  ya 
)

Definition at line 190 of file ardour_button.cc.

void ArdourButton::set_angle ( const double  angle)

Definition at line 184 of file ardour_button.cc.

void ArdourButton::set_colors ( )
protected

This sets the colors used for rendering based on the name of the button, and thus uses information from the GUI config data.

Definition at line 899 of file ardour_button.cc.

void ArdourButton::set_controllable ( boost::shared_ptr< PBD::Controllable c)

Definition at line 1106 of file ardour_button.cc.

void ArdourButton::set_corner_radius ( float  r)

Definition at line 805 of file ardour_button.cc.

void ArdourButton::set_custom_led_color ( const uint32_t  c,
const bool  useit = true 
)

Definition at line 1437 of file ardour_button.cc.

void ArdourButton::set_distinct_led_click ( bool  yn)

Definition at line 1085 of file ardour_button.cc.

void ArdourButton::set_elements ( Element  e)

Definition at line 1416 of file ardour_button.cc.

void ArdourButton::set_fallthrough_to_parent ( bool  fall)
inline

Definition at line 125 of file ardour_button.h.

void ArdourButton::set_fixed_colors ( const uint32_t  color_active,
const uint32_t  color_inactive 
)

This sets the colors used for rendering based on two fixed values, rather than basing them on the button name, and thus information in the GUI config data.

Definition at line 940 of file ardour_button.cc.

void ArdourButton::set_icon ( Icon  i)

Definition at line 1430 of file ardour_button.cc.

void ArdourButton::set_image ( const Glib::RefPtr< Gdk::Pixbuf > &  )

Definition at line 1221 of file ardour_button.cc.

void ArdourButton::set_layout_ellipsize_width ( int  w)

Definition at line 1327 of file ardour_button.cc.

void ArdourButton::set_layout_font ( const Pango::FontDescription &  fd)

Definition at line 160 of file ardour_button.cc.

void ArdourButton::set_led_left ( bool  yn)

Definition at line 1017 of file ardour_button.cc.

void ArdourButton::set_related_action ( Glib::RefPtr< Gtk::Action >  )
virtual

Reimplemented from Gtkmm2ext::Activatable.

Definition at line 1138 of file ardour_button.cc.

void ArdourButton::set_text ( const std::string &  str)

Definition at line 170 of file ardour_button.cc.

void ArdourButton::set_text_ellipsize ( Pango::EllipsizeMode  e)

Definition at line 1345 of file ardour_button.cc.

void ArdourButton::set_tweaks ( Tweaks  t)

Definition at line 1306 of file ardour_button.cc.

void ArdourButton::set_visual_state ( Gtkmm2ext::VisualState  s)
virtual

Reimplemented from CairoWidget.

Definition at line 1241 of file ardour_button.cc.

void ArdourButton::setup_led_rect ( )
protected

Definition at line 1192 of file ardour_button.cc.

Tweaks ArdourButton::tweaks ( ) const
inline

Definition at line 77 of file ardour_button.h.

void ArdourButton::watch ( )

Definition at line 1113 of file ardour_button.cc.

Member Data Documentation

bool ArdourButton::_act_on_release
protected

Definition at line 186 of file ardour_button.h.

double ArdourButton::_angle
protected

Definition at line 167 of file ardour_button.h.

float ArdourButton::_char_avg_pixel_width
protected

Definition at line 159 of file ardour_button.h.

unsigned int ArdourButton::_char_pixel_height
protected

Definition at line 158 of file ardour_button.h.

unsigned int ArdourButton::_char_pixel_width
protected

Definition at line 157 of file ardour_button.h.

int ArdourButton::_corner_mask
protected

Definition at line 165 of file ardour_button.h.

float ArdourButton::_corner_radius
protected

Definition at line 164 of file ardour_button.h.

float ArdourButton::_diameter
protected

Definition at line 163 of file ardour_button.h.

bool ArdourButton::_distinct_led_click
protected

Definition at line 188 of file ardour_button.h.

Element ArdourButton::_elements
protected

Definition at line 151 of file ardour_button.h.

Pango::EllipsizeMode ArdourButton::_ellipsis
protected

Definition at line 194 of file ardour_button.h.

bool ArdourButton::_fallthrough_to_parent
protected

Definition at line 192 of file ardour_button.h.

bool ArdourButton::_fixed_colors_set
protected

Definition at line 191 of file ardour_button.h.

bool ArdourButton::_focused
protected

Definition at line 190 of file ardour_button.h.

bool ArdourButton::_hovering
protected

Definition at line 189 of file ardour_button.h.

Icon ArdourButton::_icon
protected

Definition at line 152 of file ardour_button.h.

Glib::RefPtr<Pango::Layout> ArdourButton::_layout
protected

Definition at line 148 of file ardour_button.h.

int ArdourButton::_layout_ellipsize_width
protected

Definition at line 193 of file ardour_button.h.

bool ArdourButton::_led_left
protected

Definition at line 187 of file ardour_button.h.

cairo_rectangle_t* ArdourButton::_led_rect
protected

Definition at line 184 of file ardour_button.h.

int ArdourButton::_pattern_height
protected

Definition at line 196 of file ardour_button.h.

Glib::RefPtr<Gdk::Pixbuf> ArdourButton::_pixbuf
protected

Definition at line 149 of file ardour_button.h.

std::string ArdourButton::_text
protected

Definition at line 150 of file ardour_button.h.

int ArdourButton::_text_height
protected

Definition at line 162 of file ardour_button.h.

int ArdourButton::_text_width
protected

Definition at line 161 of file ardour_button.h.

Tweaks ArdourButton::_tweaks
protected

Definition at line 153 of file ardour_button.h.

bool ArdourButton::_update_colors
protected

Definition at line 195 of file ardour_button.h.

float ArdourButton::_xalign
protected

Definition at line 168 of file ardour_button.h.

float ArdourButton::_yalign
protected

Definition at line 168 of file ardour_button.h.

BindingProxy ArdourButton::binding_proxy
protected

Definition at line 154 of file ardour_button.h.

cairo_pattern_t* ArdourButton::concave_pattern
protected

Definition at line 182 of file ardour_button.h.

cairo_pattern_t* ArdourButton::convex_pattern
protected

Definition at line 181 of file ardour_button.h.

Definition at line 63 of file ardour_button.h.

uint32_t ArdourButton::fill_active_color
protected

Definition at line 171 of file ardour_button.h.

uint32_t ArdourButton::fill_inactive_color
protected

Definition at line 170 of file ardour_button.h.

Definition at line 65 of file ardour_button.h.

uint32_t ArdourButton::led_active_color
protected

Definition at line 176 of file ardour_button.h.

uint32_t ArdourButton::led_custom_color
protected

Definition at line 178 of file ardour_button.h.

Definition at line 64 of file ardour_button.h.

uint32_t ArdourButton::led_inactive_color
protected

Definition at line 177 of file ardour_button.h.

cairo_pattern_t* ArdourButton::led_inset_pattern
protected

Definition at line 183 of file ardour_button.h.

sigc::signal<void> ArdourButton::signal_clicked

Definition at line 110 of file ardour_button.h.

sigc::signal<void> ArdourButton::signal_led_clicked

Definition at line 109 of file ardour_button.h.

uint32_t ArdourButton::text_active_color
protected

Definition at line 173 of file ardour_button.h.

uint32_t ArdourButton::text_inactive_color
protected

Definition at line 174 of file ardour_button.h.

bool ArdourButton::use_custom_led_color
protected

Definition at line 179 of file ardour_button.h.

PBD::ScopedConnection ArdourButton::watch_connection
protected

Definition at line 145 of file ardour_button.h.


The documentation for this class was generated from the following files: