Work around badly chosen argument name in giomm/dbusmessage.h
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / gtk_ui.h
index 1fbfb9d800cb04016dbf3a833bcebe0dd29733a3..a758ad78f4aee8f9a9a8073b28d414edfb61eff2 100644 (file)
 #include <setjmp.h>
 #include <pthread.h>
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <glibmm/thread.h>
 
 #include <gtkmm/widget.h>
@@ -50,6 +54,7 @@ namespace Gtkmm2ext {
 
 class TextViewer;
 
+extern BaseUI::RequestType NullMessage;
 extern BaseUI::RequestType ErrorMessage;
 extern BaseUI::RequestType CallSlot;
 extern BaseUI::RequestType TouchDisplay;
@@ -74,17 +79,34 @@ struct UIRequest : public BaseUI::BaseRequestObject {
     Transmitter::Channel chn;
     void *arg;
     const char *msg2;
+
+    UIRequest () {
+            type = NullMessage;
+    }
     
     ~UIRequest () { 
            if (type == ErrorMessage && msg) {
                    /* msg was strdup()'ed */
-                   free ((char *)msg);
+                   free (const_cast<char *>(msg));
            }
     }
 };
 
-class UI : public Receiver, public AbstractUI<UIRequest>
+class UI : public AbstractUI<UIRequest>
 {
+  private:
+       class MyReceiver : public Receiver {
+         public:
+               MyReceiver (UI& ui) : _ui (ui) {}
+               void receive (Transmitter::Channel chn, const char *msg) {
+                       _ui.receive (chn, msg);
+               }
+         private:
+               UI& _ui;
+       };
+
+       MyReceiver _receiver;
+
   public:
        UI (std::string name, int *argc, char **argv[]);
        virtual ~UI ();
@@ -99,8 +121,6 @@ class UI : public Receiver, public AbstractUI<UIRequest>
 
        bool caller_is_ui_thread ();
 
-       static Glib::Thread* thread_id() { return gui_thread; }
-
        /* Gtk-UI specific interfaces */
 
        bool running ();
@@ -109,11 +129,14 @@ class UI : public Receiver, public AbstractUI<UIRequest>
        void run (Receiver &old_receiver);
 
        void set_state (Gtk::Widget *w, Gtk::StateType state);
-       void popup_error (const char *text);
+       void popup_error (const std::string& text);
        void flush_pending ();
        void toggle_errors ();
+       void show_errors ();
        void touch_display (Touchable *);
-       void set_tip (Gtk::Widget *w, const gchar *tip, const gchar *hlp);
+       void set_tip (Gtk::Widget &w, const gchar *tip);
+       void set_tip (Gtk::Widget &w, const std::string &tip);
+       void set_tip (Gtk::Widget *w, const gchar *tip, const gchar *hlp="");
        void idle_add (int (*func)(void *), void *arg);
 
        Gtk::Main& main() const { return *theMain; }
@@ -140,8 +163,6 @@ class UI : public Receiver, public AbstractUI<UIRequest>
 
        static bool just_hide_it (GdkEventAny *, Gtk::Window *);
 
-       static Glib::Thread* the_gui_thread() { return gui_thread; }
-
   protected:
        virtual void handle_fatal (const char *);
        virtual void display_message (const char *prefix, gint prefix_len,
@@ -150,7 +171,7 @@ class UI : public Receiver, public AbstractUI<UIRequest>
 
   private:
        static UI *theGtkUI;
-       static Glib::Thread* gui_thread;
+
        bool _active;
        Gtk::Main *theMain;
 #ifndef GTK_NEW_TOOLTIP_API
@@ -175,6 +196,7 @@ class UI : public Receiver, public AbstractUI<UIRequest>
        bool color_picked;
 
        void do_request (UIRequest*);
+
 };
 
 } /* namespace */