]> git.sesse.net Git - vlc/blob - modules/gui/skins/gtk2/gtk2_event.cpp
* should have repaired win32 skins
[vlc] / modules / gui / skins / gtk2 / gtk2_event.cpp
1 /*****************************************************************************
2  * gtk2_event.cpp: GTK2 implementation of the Event class
3  *****************************************************************************
4  * Copyright (C) 2003 VideoLAN
5  * $Id: gtk2_event.cpp,v 1.4 2003/04/13 19:09:59 asmax Exp $
6  *
7  * Authors: Cyril Deguet     <asmax@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., 59 Temple Place - Suite 330, Boston, MA  02111,
22  * USA.
23  *****************************************************************************/
24
25 #if !defined WIN32
26
27 //--- GTK2 -----------------------------------------------------------------
28 #include <gdk/gdk.h>
29
30 //--- VLC -------------------------------------------------------------------
31 #include <vlc/intf.h>
32
33 //--- SKIN ------------------------------------------------------------------
34 #include "event.h"
35 #include "os_event.h"
36 #include "window.h"
37 #include "os_window.h"
38 #include "theme.h"
39 #include "os_theme.h"
40 #include "skin_common.h"
41
42
43 //---------------------------------------------------------------------------
44 //   VLC Event
45 //---------------------------------------------------------------------------
46 GTK2Event::GTK2Event( intf_thread_t *p_intf, string Desc, string shortcut )
47     : Event( p_intf, Desc, shortcut )
48 {
49     gWnd = NULL;
50 }
51 //---------------------------------------------------------------------------
52 GTK2Event::GTK2Event( intf_thread_t *p_intf, GdkWindow *gwnd, unsigned int msg,
53     unsigned int par1, long par2 ) : Event( p_intf, msg, par1, par2 )
54 {
55     gWnd = gwnd;
56 }
57 //---------------------------------------------------------------------------
58 GTK2Event::GTK2Event( intf_thread_t *p_intf, Window *win, unsigned int msg,
59     unsigned int par1, long par2 ) : Event( p_intf, msg, par1, par2 )
60 {
61     gWnd = ( (GTK2Window *)win )->GetHandle();
62 }
63 //---------------------------------------------------------------------------
64 GTK2Event::~GTK2Event()
65 {
66 }
67 //---------------------------------------------------------------------------
68 bool GTK2Event::SendEvent()
69 {
70 /*    if( Message != VLC_NOTHING )
71     {
72         PostMessage( hWnd, Message, Param1, Param2 );
73         PostSynchroMessage();
74         return true;
75     }
76 */
77     return true;
78
79 }
80 //---------------------------------------------------------------------------
81 bool GTK2Event::IsEqual( Event *evt )
82 {
83 /*    GTK2Event *WinEvt = (GTK2Event *)evt;
84     return( WinEvt->GetWindow() == hWnd   && WinEvt->GetMessage() == Message &&
85             WinEvt->GetParam1() == Param1 && WinEvt->GetParam2()  == Param2 );*/
86 }
87 //---------------------------------------------------------------------------
88 void GTK2Event::CreateOSEvent( string para1, string para2, string para3 )
89 {
90     // Find Parameters
91     switch( Message )
92     {
93         case WINDOW_MOVE:
94             gWnd = GetWindowFromName( para1 );
95             break;
96
97         case WINDOW_CLOSE:
98             gWnd = GetWindowFromName( para1 );
99             break;
100
101         case WINDOW_OPEN:
102             gWnd = GetWindowFromName( para1 );
103             break;
104
105     }
106 }
107 //---------------------------------------------------------------------------
108 GdkWindow *GTK2Event::GetWindowFromName( string name )
109 {
110     GTK2Window *win = (GTK2Window *)
111         p_intf->p_sys->p_theme->GetWindow( name );
112     if( win == NULL ) 
113     {
114         return NULL;
115     }
116     else {
117         return win->GetHandle();
118     }
119 }
120 //---------------------------------------------------------------------------
121
122 #endif