]> git.sesse.net Git - vlc/blob - modules/gui/skins2/macosx/macosx_window.cpp
We even can show a new dialog after reset the preferences.
[vlc] / modules / gui / skins2 / macosx / macosx_window.cpp
1 /*****************************************************************************
2  * macosx_window.cpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifdef MACOSX_SKINS
25
26 #include "macosx_window.hpp"
27 #include "macosx_loop.hpp"
28 #include "../src/os_factory.hpp"
29
30
31 MacOSXWindow::MacOSXWindow( intf_thread_t *pIntf, GenericWindow &rWindow,
32                             bool dragDrop, bool playOnDrop,
33                             MacOSXWindow *pParentWindow ):
34     OSWindow( pIntf ), m_pParent( pParentWindow ), m_dragDrop( dragDrop )
35 {
36     // Create the window
37     Rect rect;
38     SetRect( &rect, 0, 0, 0, 0 );
39     CreateNewWindow( kDocumentWindowClass, kWindowNoShadowAttribute |
40                      kWindowNoTitleBarAttribute, &rect, &m_win );
41
42     // Create the event handler for this window
43     OSFactory *pOSFactory = OSFactory::instance( getIntf() );
44     ((MacOSXLoop*)pOSFactory->getOSLoop())->registerWindow( rWindow, m_win );
45 }
46
47
48 MacOSXWindow::~MacOSXWindow()
49 {
50     DisposeWindow( m_win );
51 }
52
53
54 void MacOSXWindow::show( int left, int top ) const
55 {
56     ShowWindow( m_win );
57 }
58
59
60 void MacOSXWindow::hide() const
61 {
62     HideWindow( m_win );
63 }
64
65
66 void MacOSXWindow::moveResize( int left, int top, int width, int height ) const
67 {
68     MoveWindow( m_win, left, top, false );
69     SizeWindow( m_win, width, height, true );
70 }
71
72
73 void MacOSXWindow::raise() const
74 {
75     SelectWindow( m_win );
76 }
77
78
79 void MacOSXWindow::setOpacity( uint8_t value ) const
80 {
81     SetWindowAlpha( m_win, (float)value / 255.0 );
82 }
83
84
85 void MacOSXWindow::toggleOnTop( bool onTop ) const
86 {
87     // TODO
88 }
89
90 #endif