class TextViewer;
+extern BaseUI::RequestType NullMessage;
extern BaseUI::RequestType ErrorMessage;
extern BaseUI::RequestType CallSlot;
extern BaseUI::RequestType TouchDisplay;
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 ();
bool caller_is_ui_thread ();
- static Glib::Thread* thread_id() { return gui_thread; }
-
/* Gtk-UI specific interfaces */
bool running ();
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);
void set_tip (Gtk::Widget &w, const std::string &tip);
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,
private:
static UI *theGtkUI;
- static Glib::Thread* gui_thread;
+
bool _active;
Gtk::Main *theMain;
#ifndef GTK_NEW_TOOLTIP_API
bool color_picked;
void do_request (UIRequest*);
+
};
} /* namespace */