Commit 64680351 authored by claes's avatar claes

wow:CreateList, cancel backcall added

parent 2b81f4d3
/**
* Proview $Id: co_wow_gtk.cpp,v 1.12 2008-02-27 06:23:43 claes Exp $
* Proview $Id: co_wow_gtk.cpp,v 1.13 2008-09-18 15:07:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -189,6 +189,7 @@ class WowListCtx {
GtkWidget *list;
char *texts;
void (* action_cb) ( void *, char *);
void (* cancel_cb) ( void *);
void *parent_ctx;
};
......@@ -240,6 +241,9 @@ void CoWowGtk::list_cancel_cb (
{
WowListCtx *ctx = (WowListCtx *) data;
if ( ctx->cancel_cb)
(ctx->cancel_cb)( ctx->parent_ctx);
gtk_widget_destroy( ctx->toplevel);
free( ctx->texts);
delete ctx;
......@@ -251,10 +255,17 @@ static gboolean list_action_inputfocus( GtkWidget *w, GdkEvent *event, gpointer
return FALSE;
}
static gboolean list_delete_event( GtkWidget *w, GdkEvent *event, gpointer data)
{
CoWowGtk::list_cancel_cb( w, data);
return TRUE;
}
void *CoWowGtk::CreateList (
char *title,
char *texts,
void (action_cb)( void *, char *),
void (cancel_cb)( void *),
void *parent_ctx
)
{
......@@ -268,6 +279,7 @@ void *CoWowGtk::CreateList (
ctx = new WowListCtx();
ctx->action_cb = action_cb;
ctx->cancel_cb = cancel_cb;
ctx->parent_ctx = parent_ctx;
......@@ -279,7 +291,7 @@ void *CoWowGtk::CreateList (
NULL);
g_signal_connect( ctx->toplevel, "focus-in-event", G_CALLBACK(list_action_inputfocus), ctx);
g_signal_connect( ctx->toplevel, "delete_event", G_CALLBACK(list_delete_event), ctx);
store = gtk_list_store_new( 1, G_TYPE_STRING);
name_p = texts;
......
/**
* Proview $Id: co_wow_gtk.h,v 1.5 2008-06-25 07:47:17 claes Exp $
* Proview $Id: co_wow_gtk.h,v 1.6 2008-09-18 15:07:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -97,6 +97,7 @@ class CoWowGtk : public CoWow {
void DisplayError( char *title, char *text);
void *CreateList( char *title, char *texts,
void (action_cb)( void *, char *),
void (cancel_cb)( void *),
void *ctx);
void CreateFileSelDia( char *title, void *parent_ctx,
void (*file_selected_cb)(void *, char *, wow_eFileSelType),
......
/**
* Proview $Id: co_wow_motif.cpp,v 1.1 2007-01-04 07:51:41 claes Exp $
* Proview $Id: co_wow_motif.cpp,v 1.2 2008-09-18 15:07:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -263,6 +263,9 @@ void CoWowMotif::list_cancel_cb( Widget w, XtPointer data,
{
wow_tListCtx ctx = (wow_tListCtx) data;
if ( ctx->cancel_cb)
(ctx->cancel_cb)( ctx->parent_ctx);
XtDestroyWidget( ctx->toplevel);
free( ctx->texts);
free( ctx);
......@@ -294,6 +297,7 @@ void CoWowMotif::list_action_cb( Widget w, XtPointer data,
void *CoWowMotif::CreateList( char *title, char *texts,
void (action_cb)( void *, char *),
void (cancel_cb)( void *),
void *parent_ctx)
{
Arg args[15];
......@@ -311,6 +315,7 @@ void *CoWowMotif::CreateList( char *title, char *texts,
ctx = (wow_tListCtx) calloc( 1, sizeof(*ctx));
ctx->action_cb = action_cb;
ctx->cancel_cb = cancel_cb;
ctx->parent_ctx = parent_ctx;
i=0;
......
/**
* Proview $Id: co_wow_motif.h,v 1.1 2007-01-04 07:51:41 claes Exp $
* Proview $Id: co_wow_motif.h,v 1.2 2008-09-18 15:07:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -92,6 +92,7 @@ class CoWowMotif : public CoWow {
void DisplayError( char *title, char *text);
void *CreateList( char *title, char *texts,
void (action_cb)( void *, char *),
void (cancel_cb)( void *),
void *ctx);
void CreateFileSelDia( char *title, void *parent_ctx,
void (*file_selected_cb)(void *, char *, wow_eFileSelType),
......
/**
* Proview $Id: co_wow.h,v 1.13 2007-01-17 10:27:06 claes Exp $
* Proview $Id: co_wow.h,v 1.14 2008-09-18 15:07:38 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -80,6 +80,7 @@ class CoWow {
virtual void DisplayError( char *title, char *text) {}
virtual void *CreateList( char *title, char *texts,
void (action_cb)( void *, char *),
void (cancel_cb)( void *),
void *ctx) { return NULL;}
virtual void CreateFileSelDia( char *title, void *parent_ctx,
void (*file_selected_cb)(void *, char *, wow_eFileSelType),
......
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