]> git.sesse.net Git - vlc/blob - modules/gui/wxwidgets/dialogs.cpp
* modules/gui/wxwidgets: small code cleanup.
[vlc] / modules / gui / wxwidgets / dialogs.cpp
1 /*****************************************************************************
2  * dialogs.cpp : wxWidgets plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000-2004 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <stdlib.h>                                      /* malloc(), free() */
28 #include <errno.h>                                                 /* ENOMEM */
29 #include <string.h>                                            /* strerror() */
30 #include <stdio.h>
31
32 #include <vlc/vlc.h>
33 #include <vlc/aout.h>
34 #include <vlc/intf.h>
35
36 #include "charset.h"
37
38 #include "dialogs/vlm/vlm_panel.hpp"
39 #include "dialogs/bookmarks.hpp"
40 #include "dialogs/wizard.hpp"
41 #include "dialogs/playlist.hpp"
42 #include "dialogs/open.hpp"
43 #include "dialogs/updatevlc.hpp"
44 #include "dialogs/fileinfo.hpp"
45 #include "dialogs/iteminfo.hpp"
46 #include "dialogs/preferences.hpp"
47 #include "dialogs/messages.hpp"
48 #include "dialogs/interaction.hpp"
49 #include "interface.hpp"
50
51 /* include the icon graphic */
52 #include "../../../share/vlc32x32.xpm"
53
54
55 /* Dialogs Provider */
56 namespace wxvlc
57 {
58 class DialogsProvider: public wxFrame
59 {
60 public:
61     /* Constructor */
62     DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
63     virtual ~DialogsProvider();
64
65 private:
66     void Open( int i_access_method, int i_arg );
67
68     /* Event handlers (these functions should _not_ be virtual) */
69     void OnUpdateVLC( wxCommandEvent& event );
70     void OnVLM( wxCommandEvent& event );
71     void OnInteraction( wxCommandEvent& event );
72     void OnExit( wxCommandEvent& event );
73     void OnPlaylist( wxCommandEvent& event );
74     void OnMessages( wxCommandEvent& event );
75     void OnFileInfo( wxCommandEvent& event );
76     void OnPreferences( wxCommandEvent& event );
77     void OnWizardDialog( wxCommandEvent& event );
78     void OnBookmarks( wxCommandEvent& event );
79
80     void OnOpenFileGeneric( wxCommandEvent& event );
81     void OnOpenFileSimple( wxCommandEvent& event );
82     void OnOpenDirectory( wxCommandEvent& event );
83     void OnOpenFile( wxCommandEvent& event );
84     void OnOpenDisc( wxCommandEvent& event );
85     void OnOpenNet( wxCommandEvent& event );
86     void OnOpenCapture( wxCommandEvent& event );
87     void OnOpenSat( wxCommandEvent& event );
88
89     void OnPopupMenu( wxCommandEvent& event );
90     void OnAudioPopupMenu( wxCommandEvent& event );
91     void OnVideoPopupMenu( wxCommandEvent& event );
92     void OnMiscPopupMenu( wxCommandEvent& event );
93
94     void OnIdle( wxIdleEvent& event );
95
96     void OnExitThread( wxCommandEvent& event );
97
98     DECLARE_EVENT_TABLE();
99
100     intf_thread_t *p_intf;
101
102 public:
103     /* Secondary windows */
104     OpenDialog          *p_open_dialog;
105     wxFileDialog        *p_file_dialog;
106     wxDirDialog         *p_dir_dialog;
107     Playlist            *p_playlist_dialog;
108     Messages            *p_messages_dialog;
109     FileInfo            *p_fileinfo_dialog;
110     WizardDialog        *p_wizard_dialog;
111     wxFrame             *p_prefs_dialog;
112     wxFrame             *p_bookmarks_dialog;
113     wxFileDialog        *p_file_generic_dialog;
114     UpdateVLC           *p_updatevlc_dialog;
115     VLMFrame            *p_vlm_dialog;
116 };
117 }
118
119 DEFINE_LOCAL_EVENT_TYPE( wxEVT_DIALOG );
120
121 BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
122     /* Idle loop used to update some of the dialogs */
123     EVT_IDLE(DialogsProvider::OnIdle)
124
125     /* Custom wxDialog events */
126     EVT_COMMAND(INTF_DIALOG_FILE, wxEVT_DIALOG, DialogsProvider::OnOpenFile)
127     EVT_COMMAND(INTF_DIALOG_DISC, wxEVT_DIALOG, DialogsProvider::OnOpenDisc)
128     EVT_COMMAND(INTF_DIALOG_NET, wxEVT_DIALOG, DialogsProvider::OnOpenNet)
129     EVT_COMMAND(INTF_DIALOG_CAPTURE, wxEVT_DIALOG,
130                 DialogsProvider::OnOpenCapture)
131     EVT_COMMAND(INTF_DIALOG_FILE_SIMPLE, wxEVT_DIALOG,
132                 DialogsProvider::OnOpenFileSimple)
133     EVT_COMMAND(INTF_DIALOG_FILE_GENERIC, wxEVT_DIALOG,
134                 DialogsProvider::OnOpenFileGeneric)
135     EVT_COMMAND(INTF_DIALOG_DIRECTORY, wxEVT_DIALOG,
136                 DialogsProvider::OnOpenDirectory)
137
138     EVT_COMMAND(INTF_DIALOG_PLAYLIST, wxEVT_DIALOG,
139                 DialogsProvider::OnPlaylist)
140     EVT_COMMAND(INTF_DIALOG_MESSAGES, wxEVT_DIALOG,
141                 DialogsProvider::OnMessages)
142     EVT_COMMAND(INTF_DIALOG_PREFS, wxEVT_DIALOG,
143                 DialogsProvider::OnPreferences)
144     EVT_COMMAND(INTF_DIALOG_WIZARD, wxEVT_DIALOG,
145                 DialogsProvider::OnWizardDialog)
146     EVT_COMMAND(INTF_DIALOG_FILEINFO, wxEVT_DIALOG,
147                 DialogsProvider::OnFileInfo)
148     EVT_COMMAND(INTF_DIALOG_BOOKMARKS, wxEVT_DIALOG,
149                 DialogsProvider::OnBookmarks)
150
151     EVT_COMMAND(INTF_DIALOG_POPUPMENU, wxEVT_DIALOG,
152                 DialogsProvider::OnPopupMenu)
153     EVT_COMMAND(INTF_DIALOG_AUDIOPOPUPMENU, wxEVT_DIALOG,
154                 DialogsProvider::OnAudioPopupMenu)
155     EVT_COMMAND(INTF_DIALOG_VIDEOPOPUPMENU, wxEVT_DIALOG,
156                 DialogsProvider::OnVideoPopupMenu)
157     EVT_COMMAND(INTF_DIALOG_MISCPOPUPMENU, wxEVT_DIALOG,
158                 DialogsProvider::OnMiscPopupMenu)
159
160     EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG,
161                 DialogsProvider::OnExitThread)
162     EVT_COMMAND(INTF_DIALOG_UPDATEVLC, wxEVT_DIALOG,
163                 DialogsProvider::OnUpdateVLC)
164     EVT_COMMAND(INTF_DIALOG_VLM, wxEVT_DIALOG,
165                 DialogsProvider::OnVLM)
166     EVT_COMMAND( INTF_DIALOG_INTERACTION, wxEVT_DIALOG,
167                 DialogsProvider::OnInteraction )
168 END_EVENT_TABLE()
169
170 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent )
171 {
172     return new DialogsProvider( p_intf, p_parent );
173 }
174
175 /*****************************************************************************
176  * Constructor.
177  *****************************************************************************/
178 DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
179   :  wxFrame( p_parent, -1, wxT("") )
180 {
181     /* Initializations */
182     p_intf = _p_intf;
183     p_open_dialog = NULL;
184     p_file_dialog = NULL;
185     p_playlist_dialog = NULL;
186     p_messages_dialog = NULL;
187     p_fileinfo_dialog = NULL;
188     p_prefs_dialog = NULL;
189     p_file_generic_dialog = NULL;
190     p_wizard_dialog = NULL;
191     p_bookmarks_dialog = NULL;
192     p_dir_dialog = NULL;
193     p_updatevlc_dialog = NULL;
194     p_vlm_dialog = NULL;
195
196     /* Give our interface a nice little icon */
197     p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
198
199     /* Create the messages dialog so it can begin storing logs */
200     p_messages_dialog = new Messages( p_intf, p_parent ? p_parent : this );
201
202     /* Check if user wants to show the bookmarks dialog by default */
203     wxCommandEvent dummy_event;
204     if( config_GetInt( p_intf, "wx-bookmarks" ) )
205         OnBookmarks( dummy_event );
206
207     /* Intercept all menu events in our custom event handler */
208     PushEventHandler( new MenuEvtHandler( p_intf, NULL ) );
209
210
211     WindowSettings *ws = p_intf->p_sys->p_window_settings;
212     wxPoint p;
213     wxSize  s;
214     bool    b_shown;
215
216 #define INIT( id, w, N, S ) \
217     if( ws->GetSettings( WindowSettings::id, b_shown, p, s ) && b_shown ) \
218     {                           \
219         if( !w )                \
220             w = N;              \
221         w->SetSize( s );        \
222         w->Move( p );           \
223         w->S( true );           \
224     }
225
226     INIT( ID_PLAYLIST, p_playlist_dialog, new Playlist(p_intf,this), ShowPlaylist );
227     INIT( ID_MESSAGES, p_messages_dialog, new Messages(p_intf,this), Show );
228     INIT( ID_FILE_INFO, p_fileinfo_dialog, new FileInfo(p_intf,this), Show );
229     INIT( ID_BOOKMARKS, p_bookmarks_dialog, new BookmarksDialog(p_intf,this), Show);
230 #undef INIT
231 }
232
233 DialogsProvider::~DialogsProvider()
234 {
235     WindowSettings *ws = p_intf->p_sys->p_window_settings;
236
237 #define UPDATE(id,w)                                        \
238   {                                                         \
239     if( w && w->IsShown() && !w->IsIconized() )             \
240         ws->SetSettings(  WindowSettings::id, true,         \
241                           w->GetPosition(), w->GetSize() ); \
242     else                                                    \
243         ws->SetSettings(  WindowSettings::id, false );      \
244   }
245
246     UPDATE( ID_PLAYLIST,  p_playlist_dialog );
247     UPDATE( ID_MESSAGES,  p_messages_dialog );
248     UPDATE( ID_FILE_INFO, p_fileinfo_dialog );
249     UPDATE( ID_BOOKMARKS, p_bookmarks_dialog );
250
251 #undef UPDATE
252
253     PopEventHandler(true);
254
255     /* Clean up */
256     if( p_open_dialog )     delete p_open_dialog;
257     if( p_prefs_dialog )    p_prefs_dialog->Destroy();
258     if( p_file_dialog )     delete p_file_dialog;
259     if( p_playlist_dialog ) delete p_playlist_dialog;
260     if( p_messages_dialog ) delete p_messages_dialog;
261     if( p_fileinfo_dialog ) delete p_fileinfo_dialog;
262     if( p_file_generic_dialog ) delete p_file_generic_dialog;
263     if( p_wizard_dialog ) delete p_wizard_dialog;
264     if( p_bookmarks_dialog ) delete p_bookmarks_dialog;
265     if( p_updatevlc_dialog ) delete p_updatevlc_dialog;
266     if( p_vlm_dialog ) delete p_vlm_dialog;
267
268
269     if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon;
270
271     /* We must set this here because on win32 this destructor will be
272      * automatically called so we must not call it again on wxApp->OnExit().
273      * There shouldn't be any race conditions as all this should be done
274      * from the same thread. */
275     p_intf->p_sys->p_wxwindow = NULL;
276 }
277
278 void DialogsProvider::OnIdle( wxIdleEvent& WXUNUSED(event) )
279 {
280     /* Update the log window */
281     if( p_messages_dialog )
282         p_messages_dialog->UpdateLog();
283
284     /* Update the playlist */
285     if( p_playlist_dialog )
286         p_playlist_dialog->UpdatePlaylist();
287
288     /* Update the fileinfo windows */
289     if( p_fileinfo_dialog )
290         p_fileinfo_dialog->Update();
291 }
292
293 void DialogsProvider::OnPlaylist( wxCommandEvent& WXUNUSED(event) )
294 {
295     /* Show/hide the playlist window */
296     if( !p_playlist_dialog )
297         p_playlist_dialog = new Playlist( p_intf, this );
298
299     if( p_playlist_dialog )
300     {
301         p_playlist_dialog->ShowPlaylist( !p_playlist_dialog->IsShown() );
302     }
303 }
304
305 void DialogsProvider::OnMessages( wxCommandEvent& WXUNUSED(event) )
306 {
307     /* Show/hide the log window */
308     if( !p_messages_dialog )
309         p_messages_dialog = new Messages( p_intf, this );
310
311     if( p_messages_dialog )
312     {
313         p_messages_dialog->Show( !p_messages_dialog->IsShown() );
314     }
315 }
316
317 void DialogsProvider::OnFileInfo( wxCommandEvent& WXUNUSED(event) )
318 {
319     /* Show/hide the file info window */
320     if( !p_fileinfo_dialog )
321         p_fileinfo_dialog = new FileInfo( p_intf, this );
322
323     if( p_fileinfo_dialog )
324     {
325         p_fileinfo_dialog->Show( !p_fileinfo_dialog->IsShown() );
326     }
327 }
328
329 void DialogsProvider::OnPreferences( wxCommandEvent& WXUNUSED(event) )
330 {
331     /* Show/hide the open dialog */
332     if( !p_prefs_dialog )
333         p_prefs_dialog = new PrefsDialog( p_intf, this );
334
335     if( p_prefs_dialog )
336     {
337         p_prefs_dialog->Show( !p_prefs_dialog->IsShown() );
338     }
339 }
340
341 void DialogsProvider::OnWizardDialog( wxCommandEvent& WXUNUSED(event) )
342 {
343     p_wizard_dialog = new WizardDialog( p_intf, this, NULL, 0, 0 );
344
345     if( p_wizard_dialog )
346     {
347         p_wizard_dialog->Run();
348         delete p_wizard_dialog;
349     }
350
351     p_wizard_dialog = NULL;
352 }
353
354 void DialogsProvider::OnBookmarks( wxCommandEvent& WXUNUSED(event) )
355 {
356     /* Show/hide the open dialog */
357     if( !p_bookmarks_dialog )
358         p_bookmarks_dialog = new BookmarksDialog( p_intf, this );
359
360     if( p_bookmarks_dialog )
361     {
362         p_bookmarks_dialog->Show( !p_bookmarks_dialog->IsShown() );
363     }
364 }
365
366 void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
367 {
368     intf_dialog_args_t *p_arg = (intf_dialog_args_t *)event.GetClientData();
369
370     if( p_arg == NULL )
371     {
372         msg_Dbg( p_intf, "OnOpenFileGeneric() called with NULL arg" );
373         return;
374     }
375
376     if( p_file_generic_dialog == NULL )
377         p_file_generic_dialog = new wxFileDialog( NULL );
378
379     if( p_file_generic_dialog )
380     {
381         p_file_generic_dialog->SetMessage( wxU(p_arg->psz_title) );
382         p_file_generic_dialog->SetWildcard( wxU(p_arg->psz_extensions) );
383         p_file_generic_dialog->SetStyle( (p_arg->b_save ? wxSAVE : wxOPEN) |
384                                          (p_arg->b_multiple ? wxMULTIPLE:0) );
385     }
386
387     if( p_file_generic_dialog &&
388         p_file_generic_dialog->ShowModal() == wxID_OK )
389     {
390         wxArrayString paths;
391
392         p_file_generic_dialog->GetPaths( paths );
393
394         p_arg->i_results = paths.GetCount();
395         p_arg->psz_results = (char **)malloc( p_arg->i_results *
396                                               sizeof(char *) );
397         for( size_t i = 0; i < paths.GetCount(); i++ )
398         {
399             p_arg->psz_results[i] = strdup( paths[i].mb_str() );
400         }
401     }
402
403     /* Callback */
404     if( p_arg->pf_callback )
405     {
406         p_arg->pf_callback( p_arg );
407     }
408
409     if( p_arg->psz_results )
410     {
411         for( int i = 0; i < p_arg->i_results; i++ )
412         {
413             free( p_arg->psz_results[i] );
414         }
415         free( p_arg->psz_results );
416     }
417     if( p_arg->psz_title ) free( p_arg->psz_title );
418     if( p_arg->psz_extensions ) free( p_arg->psz_extensions );
419
420     free( p_arg );
421 }
422
423 void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
424 {
425     playlist_t *p_playlist =
426         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
427                                        FIND_ANYWHERE );
428     if( p_playlist == NULL )
429     {
430         return;
431     }
432
433     if( p_file_dialog == NULL )
434         p_file_dialog = new wxFileDialog( NULL, wxU(_("Open File")),
435             wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );
436
437         p_file_dialog->SetWildcard(wxU(_("All Files (*.*)|*"
438         "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO 
439         "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO 
440         "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST 
441         "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE)));
442
443     if( p_file_dialog && p_file_dialog->ShowModal() == wxID_OK )
444     {
445         wxArrayString paths;
446
447         p_file_dialog->GetPaths( paths );
448
449         for( size_t i = 0; i < paths.GetCount(); i++ )
450         {
451             char *psz_utf8 = wxFromLocale( paths[i] );
452             if( event.GetInt() )
453                 playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
454                               PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
455                               (i ? PLAYLIST_PREPARSE : 0 ),
456                               PLAYLIST_END );
457             else
458                 playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
459                               PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END );
460             wxLocaleFree( psz_utf8 );
461         }
462     }
463
464     vlc_object_release( p_playlist );
465 }
466
467 void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
468 {
469     playlist_t *p_playlist =
470         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
471                                        FIND_ANYWHERE );
472     if( p_playlist == NULL )
473     {
474         return;
475     }
476
477     if( p_dir_dialog == NULL )
478         p_dir_dialog = new wxDirDialog( NULL, wxU(_("Select a directory")) );
479
480     if( p_dir_dialog && p_dir_dialog->ShowModal() == wxID_OK )
481     {
482         wxString path = p_dir_dialog->GetPath();
483         char *psz_utf8 = wxFromLocale( path );
484         playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
485                       PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0),
486                       PLAYLIST_END );
487         wxLocaleFree( psz_utf8 );
488     }
489
490     vlc_object_release( p_playlist );
491 }
492
493 void DialogsProvider::OnOpenFile( wxCommandEvent& event )
494 {
495     Open( FILE_ACCESS, event.GetInt() );
496 }
497
498 void DialogsProvider::OnOpenDisc( wxCommandEvent& event )
499 {
500     Open( DISC_ACCESS, event.GetInt() );
501 }
502
503 void DialogsProvider::OnOpenNet( wxCommandEvent& event )
504 {
505     Open( NET_ACCESS, event.GetInt() );
506 }
507
508 void DialogsProvider::OnOpenCapture( wxCommandEvent& event )
509 {
510     Open( CAPTURE_ACCESS, event.GetInt() );
511 }
512
513 void DialogsProvider::Open( int i_access_method, int i_arg )
514 {
515     /* Show/hide the open dialog */
516     if( !p_open_dialog )
517         p_open_dialog = new OpenDialog( p_intf, this, i_access_method, i_arg,
518                                         OPEN_NORMAL );
519
520     if( p_open_dialog )
521     {
522         p_open_dialog->Show( i_access_method, i_arg );
523     }
524 }
525
526 void DialogsProvider::OnPopupMenu( wxCommandEvent& event )
527 {
528     wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
529     ::PopupMenu( p_intf, this, mousepos );
530 }
531
532 void DialogsProvider::OnAudioPopupMenu( wxCommandEvent& event )
533 {
534     wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
535     ::AudioPopupMenu( p_intf, this, mousepos );
536 }
537 void DialogsProvider::OnVideoPopupMenu( wxCommandEvent& event )
538 {
539     wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
540     ::VideoPopupMenu( p_intf, this, mousepos );
541 }
542 void DialogsProvider::OnMiscPopupMenu( wxCommandEvent& event )
543 {
544     wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
545     ::MiscPopupMenu( p_intf, this, mousepos );
546 }
547
548 void DialogsProvider::OnExitThread( wxCommandEvent& WXUNUSED(event) )
549 {
550     wxTheApp->ExitMainLoop();
551 }
552
553 void DialogsProvider::OnUpdateVLC( wxCommandEvent& WXUNUSED(event) )
554 {
555     /* Show/hide the file info window */
556     if( !p_updatevlc_dialog )
557         p_updatevlc_dialog = new UpdateVLC( p_intf, this );
558
559     if( p_updatevlc_dialog )
560     {
561         p_updatevlc_dialog->Show( !p_updatevlc_dialog->IsShown() );
562     }
563 }
564
565 void DialogsProvider::OnVLM( wxCommandEvent& WXUNUSED(event) )
566 {
567     /* Show/hide the file info window */
568     if( !p_vlm_dialog )
569         p_vlm_dialog = new VLMFrame( p_intf, this );
570
571     if( p_vlm_dialog )
572     {
573         p_vlm_dialog->Show( !p_vlm_dialog->IsShown() );
574     }
575 }
576
577 void DialogsProvider::OnInteraction( wxCommandEvent& event )
578 {
579     intf_dialog_args_t *p_arg = (intf_dialog_args_t *)event.GetClientData();
580     interaction_dialog_t *p_dialog;
581     InteractionDialog *p_wxdialog;
582
583     return;
584
585     if( p_arg == NULL )
586     {
587         msg_Dbg( p_intf, "OnInteraction() called with NULL arg" );
588         return;
589     }
590     p_dialog = p_arg->p_dialog;
591
592     /** \bug We store the interface object for the dialog in the p_private
593      * field of the core dialog object. This is not safe if we change
594      * interface while a dialog is loaded */
595
596     switch( p_dialog->i_action )
597     {
598     case INTERACT_NEW:
599         p_wxdialog = new InteractionDialog( p_intf, this, p_dialog );
600         p_dialog->p_private = (void*)p_wxdialog;
601         p_wxdialog->Show();
602         break;
603     case INTERACT_UPDATE:
604         p_wxdialog = (InteractionDialog*)(p_dialog->p_private);
605         if( p_wxdialog)
606             p_wxdialog->Update();
607         break;
608     case INTERACT_HIDE:
609         p_wxdialog = (InteractionDialog*)(p_dialog->p_private);
610         if( p_wxdialog )
611             p_wxdialog->Hide();
612         p_dialog->i_status = HIDDEN_DIALOG;
613         break;
614     case INTERACT_DESTROY:
615         p_wxdialog = (InteractionDialog*)(p_dialog->p_private);
616         /// \todo
617         p_dialog->i_status = DESTROYED_DIALOG;
618         break;
619     }
620 }