00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include <stdio.h>
00031 #include <vlc/vlc.h>
00032 #include <vlc/intf.h>
00033
00034 #include "wince.h"
00035
00036 #include <winuser.h>
00037 #include <windows.h>
00038 #include <windowsx.h>
00039 #include <commctrl.h>
00040 #include <commdlg.h>
00041
00042
00043
00044
00045 FileInfo::FileInfo( intf_thread_t *p_intf, CBaseWindow *p_parent,
00046 HINSTANCE h_inst )
00047 : CBaseWindow( p_intf, p_parent, h_inst )
00048 {
00049
00050 hwnd_fileinfo = hwndTV = NULL;
00051 }
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 BOOL FileInfo::CreateTreeView(HWND hwnd)
00063 {
00064 DWORD dwStyle;
00065 RECT rect;
00066
00067 INITCOMMONCONTROLSEX iccex;
00068 iccex.dwSize = sizeof( INITCOMMONCONTROLSEX );
00069 iccex.dwICC = ICC_TREEVIEW_CLASSES;
00070
00071
00072 InitCommonControlsEx( &iccex );
00073
00074
00075 GetClientRect( hwnd, &rect );
00076
00077
00078 dwStyle = WS_VISIBLE | WS_CHILD | TVS_HASLINES | TVS_LINESATROOT |
00079 TVS_HASBUTTONS;
00080
00081
00082 hwndTV = CreateWindowEx( 0, WC_TREEVIEW, NULL, dwStyle, 0, MENU_HEIGHT,
00083 rect.right-rect.left,
00084 rect.bottom-rect.top-MENU_HEIGHT,
00085 hwnd, NULL, hInst, NULL );
00086
00087
00088 if( !hwndTV ) return FALSE;
00089
00090 UpdateFileInfo();
00091
00092 return TRUE;
00093 }
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 void FileInfo::UpdateFileInfo()
00105 {
00106 TVITEM tvi = {0};
00107 TVINSERTSTRUCT tvins = {0};
00108 HTREEITEM hPrev = (HTREEITEM)TVI_FIRST;
00109 HTREEITEM hPrevRootItem = NULL;
00110 HTREEITEM hPrevLev2Item = NULL;
00111
00112 p_intf->p_sys->p_input = (input_thread_t *)
00113 vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
00114
00115 input_thread_t *p_input = p_intf->p_sys->p_input;
00116
00117 if( !p_input ) return;
00118
00119 tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
00120
00121
00122 tvi.pszText = _FROMMB( p_input->input.p_item->psz_name );
00123 tvi.cchTextMax = _tcslen( tvi.pszText );
00124
00125
00126 tvi.lParam = (LPARAM)1;
00127 tvins.item = tvi;
00128
00129 tvins.hInsertAfter = hPrev;
00130 tvins.hParent = TVI_ROOT;
00131
00132
00133 hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins );
00134
00135 hPrevRootItem = hPrev;
00136
00137 vlc_mutex_lock( &p_input->input.p_item->lock );
00138 for( int i = 0; i < p_input->input.p_item->i_categories; i++ )
00139 {
00140 info_category_t *p_cat = p_input->input.p_item->pp_categories[i];
00141
00142
00143 tvi.pszText = _FROMMB( p_input->input.p_item->psz_name );
00144 tvi.cchTextMax = _tcslen( tvi.pszText );
00145
00146
00147 tvi.lParam = (LPARAM)2;
00148 tvins.item = tvi;
00149 tvins.hInsertAfter = hPrev;
00150 tvins.hParent = hPrevRootItem;
00151
00152
00153 hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins );
00154
00155 hPrevLev2Item = hPrev;
00156
00157 for( int j = 0; j < p_cat->i_infos; j++ )
00158 {
00159 info_t *p_info = p_cat->pp_infos[j];
00160
00161
00162 string szAnsi = (string)p_info->psz_name;
00163 szAnsi += ": ";
00164 szAnsi += p_info->psz_value;
00165 tvi.pszText = (TCHAR *)_FROMMB( szAnsi.c_str() );
00166 tvi.cchTextMax = _tcslen( tvi.pszText );
00167 tvi.lParam = (LPARAM)3;
00168 tvins.item = tvi;
00169 tvins.hInsertAfter = hPrev;
00170 tvins.hParent = hPrevLev2Item;
00171
00172
00173 hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins );
00174 }
00175
00176 TreeView_Expand( hwndTV, hPrevLev2Item, TVE_EXPANDPARTIAL|TVE_EXPAND );
00177 }
00178 vlc_mutex_unlock( &p_input->input.p_item->lock );
00179
00180 TreeView_Expand( hwndTV, hPrevRootItem, TVE_EXPANDPARTIAL|TVE_EXPAND );
00181
00182 return;
00183 }
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 LRESULT FileInfo::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
00195 {
00196 SHINITDLGINFO shidi;
00197
00198 switch( msg )
00199 {
00200 case WM_INITDIALOG:
00201 shidi.dwMask = SHIDIM_FLAGS;
00202 shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN |
00203 SHIDIF_FULLSCREENNOMENUBAR;
00204 shidi.hDlg = hwnd;
00205 SHInitDialog( &shidi );
00206 CreateTreeView( hwnd );
00207 UpdateWindow( hwnd );
00208 SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
00209 break;
00210
00211 case WM_CLOSE:
00212 EndDialog( hwnd, LOWORD( wp ) );
00213 break;
00214
00215 case WM_SETFOCUS:
00216 SHSipPreference( hwnd, SIP_DOWN );
00217 SHFullScreen( hwnd, SHFS_HIDESIPBUTTON );
00218 break;
00219
00220 case WM_COMMAND:
00221 if ( LOWORD(wp) == IDOK )
00222 {
00223 EndDialog( hwnd, LOWORD( wp ) );
00224 }
00225 break;
00226
00227 default:
00228 break;
00229 }
00230
00231 return FALSE;
00232 }