]> git.sesse.net Git - vlc/blob - modules/gui/skins/src/window.h
* modules/gui/skins/*: Added a "playondrop" attribute to the "Window"
[vlc] / modules / gui / skins / src / window.h
1 /*****************************************************************************
2  * window.h: Window class
3  *****************************************************************************
4  * Copyright (C) 2003 VideoLAN
5  * $Id: window.h,v 1.7 2003/10/22 19:12:56 ipkiss Exp $
6  *
7  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
8  *          Emmanuel Puig    <karibu@via.ecp.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111,
23  * USA.
24  *****************************************************************************/
25
26
27 #ifndef VLC_SKIN_WIN
28 #define VLC_SKIN_WIN
29
30 //--- GENERAL ---------------------------------------------------------------
31 #include <list>
32 #include <string>
33 #include <vector>
34 using namespace std;
35
36 //---------------------------------------------------------------------------
37 struct intf_thread_t;
38 class Graphics;
39 class GenericControl;
40 class Anchor;
41 class Event;
42
43 //---------------------------------------------------------------------------
44 // Constants for scrolling
45 #define MOUSE_SCROLL_UP 0
46 #define MOUSE_SCROLL_DOWN 1
47
48 //---------------------------------------------------------------------------
49 class SkinWindow
50 {
51     protected:
52         // Interface thread
53         intf_thread_t *p_intf;
54
55         // Position parmaters
56         int  Left;
57         int  Top;
58         int  Width;
59         int  Height;
60
61         // General parameters
62         Graphics *Image;
63         int  Transition;
64         int  MoveAlpha;
65         int  NormalAlpha;
66         int  Alpha;
67         bool WindowMoving;
68         bool Hidden;
69         bool Changing;
70
71         // Fading transition;
72         int StartAlpha;
73         int EndAlpha;
74         int StartTime;
75         int EndTime;
76         int Lock;
77
78         // Tooltip
79         string ToolTipText;
80
81         // Drag & drop
82         bool DragDrop;
83
84     public:
85         // Controls
86         vector<GenericControl *> ControlList;
87
88         // Constructors
89         SkinWindow( intf_thread_t *_p_intf, int x, int y, bool visible,
90             int transition, int normalalpha, int movealpha, bool dragdrop );
91
92         // Destructors
93         virtual ~SkinWindow();
94
95         // Event processing
96         bool ProcessEvent( Event *evt );
97         virtual bool ProcessOSEvent( Event *evt ) = 0;
98
99         // Mouse events
100         void MouseUp(       int x, int y, int nutton );
101         void MouseDown(     int x, int y, int button );
102         void MouseMove(     int x, int y, int button );
103         void MouseDblClick( int x, int y, int button );
104         void SkinWindow::MouseScroll( int x, int y, int direction );
105
106         // Window graphic aspect
107         bool OnStartThemeVisible;
108         void Show();
109         void Hide();
110         void Open();
111         void Close();
112         virtual void ToggleOnTop() {}
113
114         void RefreshAll();
115         void Refresh( int x, int y, int w, int h );
116         void RefreshImage( int x, int y, int w, int h );
117         virtual void RefreshFromImage( int x, int y, int w, int h ) = 0;
118
119         void Fade( int To, int Time = 1000, unsigned int evt = 0 );
120         bool IsHidden() { return Hidden; };
121
122         virtual void OSShow( bool show ) = 0;
123         virtual void SetTransparency( int Value = -1 ) = 0;
124         virtual void WindowManualMove() = 0;
125         virtual void WindowManualMoveInit() = 0;
126
127         // Window methods
128         void Init();
129         void ReSize();
130         void GetSize( int &w, int &h );
131         void GetPos(  int &x, int &y );
132         virtual void Move( int left, int top ) = 0;
133         virtual void Size( int width, int height ) = 0;
134
135         // Fading transition
136         bool ChangeAlpha( int time );
137         void Init( int start, int end, int time );
138
139         // Texts
140         virtual void ChangeToolTipText( string text ) = 0;
141
142         // Magnetic Anchors
143         list<Anchor *> AnchorList;
144         bool Moved;
145
146         // Get the interface thread
147         intf_thread_t *GetIntf()    { return p_intf; }
148 };
149 //---------------------------------------------------------------------------
150
151 #endif