]> git.sesse.net Git - vlc/blob - modules/gui/skins/gtk2/gtk2_theme.cpp
* added a new set of widgets for CONFIG_ITEM_FILE and DIRECTORY
[vlc] / modules / gui / skins / gtk2 / gtk2_theme.cpp
1 /*****************************************************************************
2  * gtk2_theme.cpp: GTK2 implementation of the Theme class
3  *****************************************************************************
4  * Copyright (C) 2003 VideoLAN
5  * $Id: gtk2_theme.cpp,v 1.25 2003/04/28 12:00:13 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 #ifdef GTK2_SKINS
26
27 //--- GTK2 -----------------------------------------------------------------
28 #include <gdk/gdk.h>
29 #include <gdk-pixbuf/gdk-pixbuf.h>
30 #include <X11/Xlib.h>
31
32 //--- VLC -------------------------------------------------------------------
33 #include <vlc/intf.h>
34
35 //--- SKIN ------------------------------------------------------------------
36 #include "../os_api.h"
37 #include "../src/banks.h"
38 #include "../src/window.h"
39 #include "../os_window.h"
40 #include "../src/event.h"
41 #include "../os_event.h"
42 #include "../src/theme.h"
43 #include "../os_theme.h"
44 #include "../src/vlcproc.h"
45 #include "../src/skin_common.h"
46
47
48 //---------------------------------------------------------------------------
49 void SkinManage( intf_thread_t *p_intf );
50
51
52 //---------------------------------------------------------------------------
53 // THEME
54 //---------------------------------------------------------------------------
55 GTK2Theme::GTK2Theme( intf_thread_t *_p_intf ) : Theme( _p_intf )
56 {
57     //Initialize value
58     ParentWindow = NULL;
59 }
60
61 //---------------------------------------------------------------------------
62 GTK2Theme::~GTK2Theme()
63 {/*
64     // Unregister the window class if needed
65     WNDCLASS wndclass;
66     if( GetClassInfo( hinst, "SkinWindow", &wndclass ) )
67     {
68         UnregisterClass( "SkinWindow", hinst );
69     }
70     if( GetClassInfo( hinst, "ParentWindow", &wndclass ) )
71     {
72         UnregisterClass( "ParentWindow", hinst );
73     }
74
75     // Delete tray icon if exists
76     if( ShowInTray )
77     {
78         Shell_NotifyIcon( NIM_DELETE, &TrayIcon );
79     }
80 */
81     // Destroy parent window
82     if( ParentWindow )
83     {
84         gdk_window_destroy( ParentWindow );
85     }
86 }
87 //---------------------------------------------------------------------------
88 void GTK2Theme::OnLoadTheme()
89 {
90 /*    // The create menu
91     CreateSystemMenu();
92 */
93     // Set the parent window attributes
94     GdkWindowAttr attr;
95     attr.title = "VLC Media Player";
96     attr.event_mask = GDK_ALL_EVENTS_MASK;
97     attr.x = 0;
98     attr.y = 0;
99     attr.width = 0;
100     attr.height = 0;
101     attr.window_type = GDK_WINDOW_TOPLEVEL;
102     attr.wclass = GDK_INPUT_ONLY;
103     attr.override_redirect = FALSE;
104     
105     gint mask = GDK_WA_TITLE|GDK_WA_X|GDK_WA_Y|GDK_WA_NOREDIR;
106     
107     // Create the parent window
108     ParentWindow = gdk_window_new( NULL, &attr, mask);
109     if( !ParentWindow )
110     {
111         msg_Err( p_intf, "gdk_window_new failed" );
112         return;
113     }
114
115     Display *display = XOpenDisplay( NULL );
116     Window root = DefaultRootWindow( display );
117 }
118 //---------------------------------------------------------------------------
119 void GTK2Theme::AddSystemMenu( string name, Event *event )
120 {/*
121     if( name == "SEPARATOR" )
122     {
123         AppendMenu( SysMenu, MF_SEPARATOR, 0, NULL );
124     }
125     else
126     {
127         AppendMenu( SysMenu, MF_STRING, (unsigned int)event,
128                     (char *)name.c_str() );
129     }*/
130 }
131 //---------------------------------------------------------------------------
132 void GTK2Theme::ChangeClientWindowName( string name )
133 {/*
134     SetWindowText( ParentWindow, name.c_str() );*/
135 }
136 //---------------------------------------------------------------------------
137 void GTK2Theme::AddWindow( string name, int x, int y, bool visible,
138     int fadetime, int alpha, int movealpha, bool dragdrop )
139 {
140     GdkWindowAttr attr;
141     attr.title = (gchar *)name.c_str();
142     attr.event_mask = GDK_ALL_EVENTS_MASK;
143     attr.width = 0;
144     attr.height = 0;
145     attr.window_type = GDK_WINDOW_TOPLEVEL;
146     attr.wclass = GDK_INPUT_OUTPUT;
147     attr.override_redirect = FALSE;
148
149     gint mask = GDK_WA_NOREDIR;
150
151     // Create the window
152     GdkWindow *gwnd = gdk_window_new( NULL, &attr, mask );
153     if( !gwnd )
154     {
155         msg_Err( p_intf, "gdk_window_new failed" );
156         return;
157     }
158
159     gdk_window_set_decorations( gwnd, (GdkWMDecoration)0 );
160
161     gdk_window_show( gwnd );
162
163     WindowList.push_back( (SkinWindow *)new OSWindow( p_intf, gwnd, x, y, visible,
164         fadetime, alpha, movealpha, dragdrop, name ) ) ;
165
166 }
167 //---------------------------------------------------------------------------
168 void GTK2Theme::ChangeTray()
169 {/*
170     if( ShowInTray )
171     {
172         Shell_NotifyIcon( NIM_DELETE, &TrayIcon );
173         ShowInTray = false;
174     }
175     else
176     {
177         Shell_NotifyIcon( NIM_ADD, &TrayIcon );
178         ShowInTray = true;
179     }*/
180 }
181 //---------------------------------------------------------------------------
182 void GTK2Theme::ChangeTaskbar()
183 {/*
184     if( ShowInTaskbar )
185     {
186         ShowWindow( ParentWindow, SW_HIDE );
187         SetWindowLongPtr( ParentWindow, GWL_EXSTYLE,
188                           WS_EX_LAYERED|WS_EX_TOOLWINDOW );
189         ShowWindow( ParentWindow, SW_SHOW );
190         ShowInTaskbar = false;
191     }
192     else
193     {
194         ShowWindow( ParentWindow, SW_HIDE );
195         SetWindowLongPtr( ParentWindow, GWL_EXSTYLE,
196                           WS_EX_LAYERED|WS_EX_APPWINDOW );
197         ShowWindow( ParentWindow, SW_SHOW );
198         ShowInTaskbar = true;
199     }*/
200 }
201 //---------------------------------------------------------------------------
202
203 #endif