Commit decfb5b5 authored by Claes Sjofors's avatar Claes Sjofors

Window to display text added to wow

parent 94263582
...@@ -176,6 +176,37 @@ void CoWowGtk::DisplayError( const char *title, const char *text) ...@@ -176,6 +176,37 @@ void CoWowGtk::DisplayError( const char *title, const char *text)
gtk_widget_show_all( dialog); gtk_widget_show_all( dialog);
} }
/************************************************************************
*
* Description: Create a text window.
*
*************************************************************************/
static void displaytext_ok_cb( GtkWidget *w, gint arg1, gpointer data)
{
gtk_widget_destroy( w);
}
void CoWowGtk::DisplayText( const char *title, const char *text)
{
GtkWidget *parent = m_parent;
if ( parent) {
while( !GTK_IS_WINDOW(parent))
parent = gtk_widget_get_parent( parent);
}
char *textutf8 = g_convert( text, -1, "UTF-8", "ISO8859-1", NULL, NULL, NULL);
GtkWidget *dialog = gtk_message_dialog_new( GTK_WINDOW(parent),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_OTHER,
GTK_BUTTONS_CLOSE, textutf8);
g_free( textutf8);
g_signal_connect( dialog, "response",
G_CALLBACK(displaytext_ok_cb), NULL);
gtk_window_set_title( GTK_WINDOW(dialog), title);
gtk_widget_show_all( dialog);
}
/************************************************************************ /************************************************************************
* *
* Description: Create a window with a scrolled list and Ok and Cancel * Description: Create a window with a scrolled list and Ok and Cancel
......
...@@ -95,6 +95,7 @@ class CoWowGtk : public CoWow { ...@@ -95,6 +95,7 @@ class CoWowGtk : public CoWow {
void (* questionbox_cancel) ( void *, void *), void (* questionbox_cancel) ( void *, void *),
void *data); void *data);
void DisplayError( const char *title, const char *text); void DisplayError( const char *title, const char *text);
void DisplayText( const char *title, const char *text);
void *CreateList( const char *title, const char *texts, void *CreateList( const char *title, const char *texts,
void (action_cb)( void *, char *), void (action_cb)( void *, char *),
void (cancel_cb)( void *), void (cancel_cb)( void *),
......
...@@ -91,6 +91,7 @@ class CoWowMotif : public CoWow { ...@@ -91,6 +91,7 @@ class CoWowMotif : public CoWow {
void (* questionbox_cancel) ( void *, void *), void (* questionbox_cancel) ( void *, void *),
void *data); void *data);
void DisplayError( const char *title, const char *text); void DisplayError( const char *title, const char *text);
void DisplayText( const char *title, const char *text) {}
void *CreateList( const char *title, const char *texts, void *CreateList( const char *title, const char *texts,
void (action_cb)( void *, char *), void (action_cb)( void *, char *),
void (cancel_cb)( void *), void (cancel_cb)( void *),
......
...@@ -78,6 +78,7 @@ class CoWow { ...@@ -78,6 +78,7 @@ class CoWow {
void (* questionbox_cancel) ( void *, void *), void (* questionbox_cancel) ( void *, void *),
void *data) {} void *data) {}
virtual void DisplayError( const char *title, const char *text) {} virtual void DisplayError( const char *title, const char *text) {}
virtual void DisplayText( const char *title, const char *text) {}
virtual void *CreateList( const char *title, const char *texts, virtual void *CreateList( const char *title, const char *texts,
void (action_cb)( void *, char *), void (action_cb)( void *, char *),
void (cancel_cb)( void *), void (cancel_cb)( void *),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment