Add convenience API to render icons on signal_expose_event
This commit is contained in:
parent
04a40140dc
commit
fb33b4c2f3
@ -21,6 +21,7 @@
|
||||
#include <algorithm> // std:min
|
||||
|
||||
#include "gtkmm2ext/colors.h"
|
||||
#include "gtkmm2ext/rgb_macros.h"
|
||||
#include "widgets/ardour_icon.h"
|
||||
|
||||
using namespace ArdourWidgets::ArdourIcon;
|
||||
@ -1395,3 +1396,21 @@ ArdourWidgets::ArdourIcon::render (cairo_t *cr,
|
||||
cairo_restore (cr);
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourWidgets::ArdourIcon::expose (GdkEventExpose* ev, Gtk::Widget* w, const enum ArdourIcon::Icon icon)
|
||||
{
|
||||
Glib::RefPtr<Gdk::Window> win (w->get_window());
|
||||
cairo_t* cr = gdk_cairo_create (win->gobj());
|
||||
gdk_cairo_rectangle (cr, &ev->area);
|
||||
cairo_clip (cr);
|
||||
|
||||
Glib::RefPtr<Gtk::Style> style = w->get_style();
|
||||
Gdk::Color fg (style->get_fg (Gtk::STATE_NORMAL));
|
||||
|
||||
ArdourIcon::render (cr, icon, win->get_width (), win->get_height (), Gtkmm2ext::ExplicitActive,
|
||||
RGBA_TO_UINT (fg.get_red() / 255., fg.get_green() / 255, fg.get_blue() / 255, 255));
|
||||
cairo_destroy (cr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cairo.h>
|
||||
#include <gtkmm/widget.h>
|
||||
|
||||
#include "gtkmm2ext/widget_state.h"
|
||||
#include "widgets/visibility.h"
|
||||
@ -77,6 +78,11 @@ namespace ArdourWidgets { namespace ArdourIcon {
|
||||
const int width, const int height,
|
||||
const Gtkmm2ext::ActiveState state,
|
||||
const uint32_t fg_color);
|
||||
|
||||
LIBWIDGETS_API bool expose (GdkEventExpose* ev,
|
||||
Gtk::Widget* w,
|
||||
const enum Icon icon);
|
||||
|
||||
}; } /* end namespace */
|
||||
|
||||
#endif
|
||||
|
@ -3,7 +3,7 @@ ICONFLAGS?=-g
|
||||
AD = ../..
|
||||
CXXFLAGS = -Wall
|
||||
CPPFLAGS = -I $(AD)/libs/gtkmm2ext -I $(AD)/libs/widgets -I $(AD)/libs/pbd -I $(AD)/build/libs/pbd
|
||||
CPPFLAGS += `pkg-config --cflags cairo cairomm-1.0 libxml-2.0 glibmm-2.4`
|
||||
CPPFLAGS += `pkg-config --cflags cairo cairomm-1.0 libxml-2.0 glibmm-2.4 gtkmm-2.4`
|
||||
|
||||
LDFLAGS = -L$(AD)/build/libs/pbd -Wl,-rpath=$(AD)/build/libs/pbd
|
||||
LDFLAGS += -L$(AD)/build/libs/gtkmm2ext -Wl,-rpath=$(AD)/build/libs/gtkmm2ext
|
||||
|
Loading…
Reference in New Issue
Block a user