1 /*****************************************************************************
2 * generic.h: Generic control, parent of the others
3 *****************************************************************************
4 * Copyright (C) 2003 VideoLAN
5 * $Id: generic.h,v 1.4 2003/04/28 12:25:34 asmax Exp $
7 * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
8 * Emmanuel Puig <karibu@via.ecp.fr>
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.
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.
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,
24 *****************************************************************************/
27 #ifndef VLC_SKIN_CONTROL_GENERIC
28 #define VLC_SKIN_CONTROL_GENERIC
30 //--- GENERAL ---------------------------------------------------------------
34 //---------------------------------------------------------------------------
42 //---------------------------------------------------------------------------
43 // Generic control class
44 //---------------------------------------------------------------------------
45 class GenericControl // This is the generic control class
48 SkinWindow * ParentWindow;
52 intf_thread_t *p_intf;
57 GenericControl( string id, bool visible, string help, SkinWindow *Parent );
60 virtual ~GenericControl();
64 bool GenericProcessEvent( Event *evt );
65 virtual bool ProcessEvent( Event *evt );
67 // Draw the control into the destination DC
68 virtual void Draw( int x, int y, int w, int h, Graphics *dest ) = 0;
70 // Simulate a mouse action on control at coordinates x/y
71 virtual bool MouseUp( int x, int y, int button );
72 virtual bool MouseDown( int x, int y, int button );
73 virtual bool MouseMove( int x, int y, int button );
74 virtual bool MouseOver( int x, int y );
75 virtual bool MouseDblClick( int x, int y, int button );
76 virtual bool MouseScroll( int x, int y, int direction );
77 virtual bool ToolTipTest( int x, int y );
78 virtual bool SendNewHelpText();
81 void Move( int left, int top );
82 virtual void MoveRelative( int xOff, int yOff );
84 // Get two rectangle regions and return intersection
85 bool GetIntersectRgn( int x1, int y1, int w1, int h1, int x2,
86 int y2, int w2, int h2, int &x, int &y, int &w, int &h );
88 // Create a region from a bitmap with transcolor as empty region
89 SkinRegion *CreateRegionFromBmp( Bitmap *bmp, int MoveX, int MoveY );
90 int Left; // Left offset of the control
91 int Top; // Top offset of the control
92 int Width; // Width of the control
93 int Height; // Height of the control
94 int State; // Used to special state of the control
95 // (for button, sets whether down or up)
96 Bitmap **Img; // Array of bitmap used to draw control
99 virtual void Enable( Event *event, bool enabled );
101 // Found if ID matches
102 bool IsID( string id );
104 //---------------------------------------------------------------------------