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