1 /*****************************************************************************
2 * gtk2_event.cpp: GTK2 implementation of the Event class
3 *****************************************************************************
4 * Copyright (C) 2003 VideoLAN
5 * $Id: gtk2_event.cpp,v 1.7 2003/04/15 20:54:58 karibu 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 //--- VLC -------------------------------------------------------------------
33 //--- SKIN ------------------------------------------------------------------
38 #include "os_window.h"
41 #include "skin_common.h"
44 //---------------------------------------------------------------------------
46 //---------------------------------------------------------------------------
47 GTK2Event::GTK2Event( intf_thread_t *p_intf, string Desc, string shortcut )
48 : Event( p_intf, Desc, shortcut )
52 //---------------------------------------------------------------------------
53 GTK2Event::GTK2Event( intf_thread_t *p_intf, GdkWindow *gwnd, unsigned int msg,
54 unsigned int par1, long par2 ) : Event( p_intf, msg, par1, par2 )
58 //---------------------------------------------------------------------------
59 GTK2Event::GTK2Event( intf_thread_t *p_intf, Window *win, unsigned int msg,
60 unsigned int par1, long par2 ) : Event( p_intf, msg, par1, par2 )
62 gWnd = ( (GTK2Window *)win )->GetHandle();
64 //---------------------------------------------------------------------------
65 GTK2Event::~GTK2Event()
68 //---------------------------------------------------------------------------
69 bool GTK2Event::SendEvent()
71 if( Message != VLC_NOTHING )
73 // Find window matching with gwnd
74 list<Window *>::const_iterator win;
75 for( win = p_intf->p_sys->p_theme->WindowList.begin();
76 win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
78 // If it is the correct window
79 if( gWnd == ( (GTK2Window *)(*win) )->GetHandle() )
81 OSAPI_PostMessage( *win, Message, Param1, Param2 );
86 OSAPI_PostMessage( NULL, Message, Param1, Param2 );
92 //---------------------------------------------------------------------------
93 bool GTK2Event::IsEqual( Event *evt )
95 /* GTK2Event *WinEvt = (GTK2Event *)evt;
96 return( WinEvt->GetWindow() == hWnd && WinEvt->GetMessage() == Message &&
97 WinEvt->GetParam1() == Param1 && WinEvt->GetParam2() == Param2 );*/
99 //---------------------------------------------------------------------------
100 void GTK2Event::CreateOSEvent( string para1, string para2, string para3 )
106 gWnd = GetWindowFromName( para1 );
110 gWnd = GetWindowFromName( para1 );
114 gWnd = GetWindowFromName( para1 );
119 //---------------------------------------------------------------------------
120 GdkWindow *GTK2Event::GetWindowFromName( string name )
122 GTK2Window *win = (GTK2Window *)
123 p_intf->p_sys->p_theme->GetWindow( name );
131 return win->GetHandle();
134 //---------------------------------------------------------------------------