add API to query Gtk::ComboBoxText entries
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / fastmeter.h
index 602bea1b383fbf76f1adf3836908d8f69fc65e0b..dbb3296c4653fe30c0d0844d7f3bc980d3edc134 100644 (file)
 #include <boost/tuple/tuple.hpp>
 #include <boost/tuple/tuple_comparison.hpp>
 #include <cairomm/pattern.h>
-#include <gtkmm/drawingarea.h>
-#include <gdkmm/pixbuf.h>
+#include "gtkmm2ext/cairo_widget.h"
+
+#include "gtkmm2ext/visibility.h"
 
 namespace Gtkmm2ext {
 
-class FastMeter : public Gtk::DrawingArea {
+class LIBGTKMM2EXT_API FastMeter : public CairoWidget {
   public:
        enum Orientation {
                Horizontal,
@@ -51,6 +52,7 @@ class FastMeter : public Gtk::DrawingArea {
                        int styleflags = 3
                        );
        virtual ~FastMeter ();
+       static void flush_pattern_cache();
 
        void set (float level, float peak = -1);
        void clear ();
@@ -65,7 +67,7 @@ class FastMeter : public Gtk::DrawingArea {
        bool get_highlight () { return highlight; }
 
 protected:
-       bool on_expose_event (GdkEventExpose*);
+       void render (cairo_t *, cairo_rectangle_t*);
        void on_size_request (GtkRequisition*);
        void on_size_allocate (Gtk::Allocation&);
 private:
@@ -94,12 +96,12 @@ private:
        float current_user_level;
        bool highlight;
 
-       bool vertical_expose (GdkEventExpose*);
+       void vertical_expose (cairo_t*, cairo_rectangle_t*);
        void vertical_size_request (GtkRequisition*);
        void vertical_size_allocate (Gtk::Allocation&);
        void queue_vertical_redraw (const Glib::RefPtr<Gdk::Window>&, float);
 
-       bool horizontal_expose (GdkEventExpose*);
+       void horizontal_expose (cairo_t*, cairo_rectangle_t*);
        void horizontal_size_request (GtkRequisition*);
        void horizontal_size_allocate (Gtk::Allocation&);
        void queue_horizontal_redraw (const Glib::RefPtr<Gdk::Window>&, float);
@@ -147,15 +149,17 @@ private:
        typedef std::map<Pattern10MapKey, Cairo::RefPtr<Cairo::Pattern> > Pattern10Map;
 
        struct PatternBgMapKey {
-               PatternBgMapKey (int w, int h, int c0, int c1)
+               PatternBgMapKey (int w, int h, int c0, int c1, bool shade)
                        : dim(w, h)
                        , cols(c0, c1)
+                       , sh(shade)
                {}
                inline bool operator<(const PatternBgMapKey& rhs) const {
-                       return (dim < rhs.dim) || (dim == rhs.dim && cols < rhs.cols);
+                       return (dim < rhs.dim) || (dim == rhs.dim && cols < rhs.cols) || (dim == rhs.dim && cols == rhs.cols && (sh && !rhs.sh));
                }
                boost::tuple<int, int> dim;
                boost::tuple<int, int> cols;
+               bool sh;
        };
        typedef std::map<PatternBgMapKey, Cairo::RefPtr<Cairo::Pattern> > PatternBgMap;