1 /*****************************************************************************
2 * wxwidgets.hpp: Common headers for the wxwidges interface
3 *****************************************************************************
4 * Copyright (C) 1999-2005 the VideoLAN team
7 * Authors: Gildas Bazin <gbazin@videolan.org>
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.
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.
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 *****************************************************************************/
24 #ifndef _WXVLC_WIDGETS_H_
25 #define _WXVLC_WIDGETS_H_
27 #ifdef WIN32 /* mingw32 hack */
33 // turn off 'identifier was truncated to '255' characters in the debug info'
34 # pragma warning( disable:4786 )
37 /* Let vlc take care of the i18n stuff */
38 #define WXINTL_NO_GETTEXT_MACRO
44 #define SLIDER_MAX_POS 10000
47 #include <wx/listctrl.h>
48 #include <wx/textctrl.h>
49 #include <wx/notebook.h>
50 #include <wx/spinctrl.h>
52 #include <wx/treectrl.h>
55 #include <wx/checkbox.h>
56 #include <wx/wizard.h>
57 #include <wx/taskbar.h>
60 #if (!wxCHECK_VERSION(2,5,0))
61 typedef long wxTreeItemIdValue;
64 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
65 DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
67 /***************************************************************************
69 ***************************************************************************/
71 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
72 #if defined( ENABLE_NLS )
74 # define wxU(utf8) wxString(utf8, wxConvUTF8)
76 # define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
80 # define wxU(ansi) wxString(ansi, wxConvLocal)
82 # define wxU(ansi) (ansi)
86 /* wxL2U (locale to unicode) is used to convert ansi strings to unicode
87 * strings (wchar_t) */
88 #define wxL2U(ansi) wxU(ansi)
91 # define wxFromLocale(wxstring) FromUTF32(wxstring.wc_str())
92 # define wxLocaleFree(string) free(string)
94 # define wxFromLocale(wxstring) FromLocale(wxstring.mb_str())
95 # define wxLocaleFree(string) LocaleFree(string)
101 #define OPEN_NORMAL 0
102 #define OPEN_STREAM 1
111 class WindowSettings;
115 using namespace wxvlc;
117 class DialogsProvider;
119 class AutoBuiltPanel;
121 /*****************************************************************************
122 * intf_sys_t: description and status of wxwindows interface
123 *****************************************************************************/
126 /* the wx parent window */
127 wxWindow *p_wxwindow;
130 /* window settings */
131 WindowSettings *p_window_settings;
133 /* special actions */
134 vlc_bool_t b_playing;
135 vlc_bool_t b_intf_show; /* interface to be shown */
137 /* The input thread */
138 input_thread_t * p_input;
140 /* The messages window */
141 msg_subscription_t* p_sub; /* message bank subscription */
143 /* Playlist management */
144 int i_playing; /* playlist selected item */
145 unsigned i_playlist_usage;
147 /* Send an event to show a dialog */
148 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
149 intf_dialog_args_t *p_arg );
152 wxMenu *p_popup_menu;
155 int i_first_hotkey_event;
159 VideoWindow *p_video_window;
160 wxBoxSizer *p_video_sizer;
161 vlc_bool_t b_video_autosize;
164 aout_instance_t *p_aout;
169 wxArrayString SeparateEntries( wxString );
170 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
173 * wxWindows keeps dead locking because the timer tries to lock the playlist
174 * when it's already locked somewhere else in the very wxWindows interface
175 * module. Unless someone implements a "vlc_mutex_trylock", we need that.
177 inline void LockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
179 if( p_sys->i_playlist_usage++ == 0)
180 vlc_mutex_lock( &p_pl->object_lock );
183 inline void UnlockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
185 if( --p_sys->i_playlist_usage == 0)
186 vlc_mutex_unlock( &p_pl->object_lock );