1 /*****************************************************************************
2 * gtk2_api.cpp: Various gtk2-specific functions
3 *****************************************************************************
4 * Copyright (C) 2003 VideoLAN
5 * $Id: gtk2_api.cpp,v 1.4 2003/04/13 19:09:59 asmax Exp $
7 * Authors: Cyril Deguet <asmax@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., 59 Temple Place - Suite 330, Boston, MA 02111,
23 *****************************************************************************/
27 //--- GTK2 ------------------------------------------------------------------
30 //--- SKIN ------------------------------------------------------------------
32 #include "os_window.h"
34 #include "event.h" // for MAX_PARAM_SIZE
37 //---------------------------------------------------------------------------
39 //---------------------------------------------------------------------------
40 void OSAPI_SendMessage( Window *win, unsigned int message, unsigned int param1,
44 SendMessage( NULL, message, param1, param2 );
46 SendMessage( ( (Win32Window *)win )->GetHandle(), message, param1,
49 //---------------------------------------------------------------------------
50 void OSAPI_PostMessage( Window *win, unsigned int message, unsigned int param1,
54 PostMessage( NULL, message, param1, param2 );
56 PostMessage( ( (Win32Window *)win )->GetHandle(), message, param1,
59 //---------------------------------------------------------------------------
64 //---------------------------------------------------------------------------
66 //---------------------------------------------------------------------------
67 int OSAPI_GetNonTransparentColor( int c )
69 /* // Get desktop device context
70 HDC DeskDC = GetWindowDC( GetDesktopWindow() );
72 // If color is black or color is same as black wether pixel color depth
73 if( c == 0 || SetPixel( DeskDC, 0, 0, c ) == 0 )
75 if( GetDeviceCaps( DeskDC, BITSPIXEL ) < 24 )
80 ReleaseDC( GetDesktopWindow(), DeskDC );
83 //---------------------------------------------------------------------------
88 //---------------------------------------------------------------------------
90 //---------------------------------------------------------------------------
93 /* return GetTickCount();*/
95 //---------------------------------------------------------------------------
96 void OSAPI_GetScreenSize( int &w, int &h )
98 /* w = GetSystemMetrics(SM_CXSCREEN);
99 h = GetSystemMetrics(SM_CYSCREEN);*/
101 //---------------------------------------------------------------------------
102 void OSAPI_GetMousePos( int &x, int &y )
104 /* LPPOINT MousePos = new POINT;
105 GetCursorPos( MousePos );
110 //---------------------------------------------------------------------------
111 string OSAPI_GetWindowTitle( Window *win )
113 // char *buffer = new char[MAX_PARAM_SIZE];
114 // GetWindowText( ((GTK2Window *)win)->GetHandle(), buffer, MAX_PARAM_SIZE );
115 // string Title = buffer;
122 //---------------------------------------------------------------------------
123 bool OSAPI_RmDir( string path )
125 /* WIN32_FIND_DATA find;
127 string FindFiles = path + "\\*.*";
128 HANDLE handle = FindFirstFile( (char *)FindFiles.c_str(), &find );
130 while( handle != INVALID_HANDLE_VALUE )
132 // If file is neither "." nor ".."
133 if( strcmp( find.cFileName, "." ) && strcmp( find.cFileName, ".." ) )
136 File = path + "\\" + (string)find.cFileName;
138 // If file is a directory, delete it recursively
139 if( find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
143 // Else, it is a file so simply delete it
146 DeleteFile( (char *)File.c_str() );
150 // If no more file in directory, exit while
151 if( !FindNextFile( handle, &find ) )
155 // Now directory is empty so can be removed
157 RemoveDirectory( (char *)path.c_str() );
161 //---------------------------------------------------------------------------