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