Commit 12ce13df authored by VideoLAN's avatar VideoLAN

* Adding onmouseover and onmouseout events to button control
* Fixing window position at launch time
* Adding notification when mouse leaves a window
parent 86b811f6
......@@ -2,7 +2,7 @@
* button.cpp: Button control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: button.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: button.cpp,v 1.2 2003/03/19 02:09:56 videolan Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -42,20 +42,32 @@
//---------------------------------------------------------------------------
// Control Button
//---------------------------------------------------------------------------
ControlButton::ControlButton( string id, bool visible, int x, int y, string Up,
string Down, string Disabled, string click, string tooltiptext, string help,
ControlButton::ControlButton(
string id,
bool visible,
int x, int y,
string Up, string Down, string Disabled,
string onclick, string onmouseover, string onmouseout,
string tooltiptext, string help,
Window *Parent ) : GenericControl( id, visible, help, Parent )
{
// General
Left = x;
Top = y;
State = 1; // 1 = up - 0 = down
Selected = false;
Enabled = true;
ClickActionName = click;
CursorIn = false;
this->Up = Up;
this->Down = Down;
this->Disabled = Disabled;
// Actions
ClickActionName = onclick;
MouseOverActionName = onmouseover;
MouseOutActionName = onmouseout;
// Texts
ToolTipText = tooltiptext;
}
//---------------------------------------------------------------------------
......@@ -79,6 +91,8 @@ void ControlButton::Init()
// Create script
ClickAction = new Action( p_intf, ClickActionName );
MouseOverAction = new Action( p_intf, MouseOverActionName );
MouseOutAction = new Action( p_intf, MouseOutActionName );
}
//---------------------------------------------------------------------------
bool ControlButton::ProcessEvent( Event *evt )
......@@ -157,26 +171,41 @@ bool ControlButton::MouseDown( int x, int y, int button )
//---------------------------------------------------------------------------
bool ControlButton::MouseMove( int x, int y, int button )
{
if( !Enabled || !Selected || !button )
if( !Enabled )
return false;
if( MouseOver( x, y ) )
if( MouseOver( x, y ) && !CursorIn )
{
if( State == 1 )
if( button == 1 && Selected )
{
State = 0;
ParentWindow->Refresh( Left, Top, Width, Height );
}
if( MouseOverActionName != "none" )
MouseOverAction->SendEvent();
CursorIn = true;
return true;
}
else
else if( !MouseOver( x, y ) & CursorIn )
{
if( State == 0 )
if( button == 1 && Selected )
{
State = 1;
ParentWindow->Refresh( Left, Top, Width, Height );
}
}
if( MouseOutActionName != "none" )
MouseOutAction->SendEvent();
CursorIn = false;
return true;
}
return false;
}
//---------------------------------------------------------------------------
bool ControlButton::MouseOver( int x, int y )
......
......@@ -2,7 +2,7 @@
* button.h: Button control
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: button.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: button.h,v 1.2 2003/03/19 02:09:56 videolan Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -48,19 +48,28 @@ class ControlButton : public GenericControl
// Control behaviour
bool Selected;
bool Enabled;
bool CursorIn;
// List of actions to execute when clicking
// List of actions to execute
Action *ClickAction;
string ClickActionName;
Action *MouseOverAction;
string MouseOverActionName;
Action *MouseOutAction;
string MouseOutActionName;
// ToolTip text
string ToolTipText;
public:
// Constructor
ControlButton( string id, bool visible, int x, int y, string Up,
string Down, string Disabled, string click,
string tooltiptext, string help, Window *Parent );
ControlButton( string id,
bool visible,
int x, int y,
string Up, string Down, string Disabled,
string onclick, string onmousevoer, string onmouseout,
string tooltiptext, string help,
Window *Parent );
// Destructor
virtual ~ControlButton();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,7 +4,7 @@
* skin.act: FleXML actions file
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin.act,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: skin.act,v 1.2 2003/03/19 02:09:56 videolan Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -93,8 +93,12 @@
</start>
<start tag="ButtonControl">
<![CDATA[
AddButton( {id}, {visible}, {x}, {y}, {up}, {down}, {disabled},
{onclick}, {tooltiptext}, {help} );
AddButton( {id},
{visible},
{x}, {y},
{up}, {down}, {disabled},
{onclick}, {onmouseover}, {onmouseout},
{tooltiptext}, {help} );
]]>
</start>
<start tag="CheckBoxControl">
......
/* XML application for skin.dtd (Id: skin.dtd,v 1.8 2003/03/17 22:14:47 karibu Exp).
* Includes actions from skin.act.
* Generated 2003/03/18 03:18:31.
* Generated 2003/03/19 02:59:06.
*
* This program was generated with the FleXML XML processor generator,
* (Id: flexml.pl,v 1.24 1999/12/13 16:18:30 krisrose Exp).
......@@ -149,15 +149,19 @@ void STag_ButtonControl(void)
#line 94 "skin.act"
AddButton( A_ButtonControl_id, A_ButtonControl_visible, A_ButtonControl_x, A_ButtonControl_y, A_ButtonControl_up, A_ButtonControl_down, A_ButtonControl_disabled,
A_ButtonControl_onclick, A_ButtonControl_tooltiptext, A_ButtonControl_help );
AddButton( A_ButtonControl_id,
A_ButtonControl_visible,
A_ButtonControl_x, A_ButtonControl_y,
A_ButtonControl_up, A_ButtonControl_down, A_ButtonControl_disabled,
A_ButtonControl_onclick, A_ButtonControl_onmouseover, A_ButtonControl_onmouseout,
A_ButtonControl_tooltiptext, A_ButtonControl_help );
} /* STag_ButtonControl */
void STag_CheckBoxControl(void)
{
#line 100 "skin.act"
#line 104 "skin.act"
AddCheckBox( A_CheckBoxControl_id, A_CheckBoxControl_visible, A_CheckBoxControl_x, A_CheckBoxControl_y, A_CheckBoxControl_img1, A_CheckBoxControl_img2, A_CheckBoxControl_clickimg1,
......@@ -169,7 +173,7 @@ void STag_CheckBoxControl(void)
void STag_SliderControl(void)
{
#line 107 "skin.act"
#line 111 "skin.act"
AddSlider( A_SliderControl_id, A_SliderControl_visible, A_SliderControl_x, A_SliderControl_y, A_SliderControl_type, A_SliderControl_up, A_SliderControl_down, A_SliderControl_abs,
......@@ -180,7 +184,7 @@ void STag_SliderControl(void)
void STag_TextControl(void)
{
#line 113 "skin.act"
#line 117 "skin.act"
AddText( A_TextControl_id, A_TextControl_visible, A_TextControl_x, A_TextControl_y, A_TextControl_text, A_TextControl_font, A_TextControl_align,
......@@ -192,7 +196,7 @@ void STag_TextControl(void)
void STag_PlayListControl(void)
{
#line 120 "skin.act"
#line 124 "skin.act"
AddPlayList( A_PlayListControl_id, A_PlayListControl_visible, A_PlayListControl_x, A_PlayListControl_y, A_PlayListControl_width, A_PlayListControl_infowidth,
......@@ -204,7 +208,7 @@ void STag_PlayListControl(void)
void ETag_PlayListControl(void)
{
#line 127 "skin.act"
#line 131 "skin.act"
AddPlayListEnd();
......@@ -214,7 +218,7 @@ void ETag_PlayListControl(void)
void STag_Theme(void)
{
#line 132 "skin.act"
#line 136 "skin.act"
StartTheme( A_Theme_log, A_Theme_magnet );
......@@ -224,7 +228,7 @@ void STag_Theme(void)
void ETag_Theme(void)
{
#line 137 "skin.act"
#line 141 "skin.act"
EndTheme();
......
......@@ -3,7 +3,7 @@
* skin.dtd: DTD for the VLC skins
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: skin.dtd,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: skin.dtd,v 1.2 2003/03/19 02:09:56 videolan Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -124,6 +124,8 @@
down CDATA #REQUIRED
disabled CDATA "none"
onclick CDATA "none"
onmouseover CDATA "none"
onmouseout CDATA "none"
tooltiptext CDATA "none"
help CDATA "\0"
>
......
/* XML processor/application API for skin.dtd (Id: skin.dtd,v 1.8 2003/03/17 22:14:47 karibu Exp).
* Generated 2003/03/18 03:18:31.
* Generated 2003/03/19 02:59:06.
*
* This program was generated with the FleXML XML processor generator,
* (Id: flexml.pl,v 1.24 1999/12/13 16:18:30 krisrose Exp).
......@@ -80,6 +80,8 @@ typedef char* AT_CheckBoxControl_disabled2;
#define AU_CheckBoxControl_disabled2 NULL
typedef char* AT_Font_underline;
#define AU_Font_underline NULL
typedef char* AT_ButtonControl_onmouseover;
#define AU_ButtonControl_onmouseover NULL
typedef char* AT_ButtonControl_visible;
#define AU_ButtonControl_visible NULL
typedef char* AT_TextControl_scroll;
......@@ -228,6 +230,8 @@ typedef char* AT_RectangleControl_h;
#define AU_RectangleControl_h NULL
typedef char* AT_ThemeInfo_webpage;
#define AU_ThemeInfo_webpage NULL
typedef char* AT_ButtonControl_onmouseout;
#define AU_ButtonControl_onmouseout NULL
typedef char* AT_CheckBoxControl_tooltiptext1;
#define AU_CheckBoxControl_tooltiptext1 NULL
typedef char* AT_CheckBoxControl_tooltiptext2;
......@@ -291,6 +295,7 @@ extern AT_ButtonControl_down A_ButtonControl_down;
extern AT_CheckBoxControl_disabled1 A_CheckBoxControl_disabled1;
extern AT_CheckBoxControl_disabled2 A_CheckBoxControl_disabled2;
extern AT_Font_underline A_Font_underline;
extern AT_ButtonControl_onmouseover A_ButtonControl_onmouseover;
extern AT_ButtonControl_visible A_ButtonControl_visible;
extern AT_TextControl_scroll A_TextControl_scroll;
extern AT_SliderControl_id A_SliderControl_id;
......@@ -365,6 +370,7 @@ extern AT_ButtonControl_tooltiptext A_ButtonControl_tooltiptext;
extern AT_Event_event A_Event_event;
extern AT_RectangleControl_h A_RectangleControl_h;
extern AT_ThemeInfo_webpage A_ThemeInfo_webpage;
extern AT_ButtonControl_onmouseout A_ButtonControl_onmouseout;
extern AT_CheckBoxControl_tooltiptext1 A_CheckBoxControl_tooltiptext1;
extern AT_CheckBoxControl_tooltiptext2 A_CheckBoxControl_tooltiptext2;
extern AT_ImageControl_id A_ImageControl_id;
......
......@@ -2,7 +2,7 @@
* wrappers.cpp: Wrappers around C++ objects
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: wrappers.cpp,v 1.2 2003/03/18 04:08:45 ipkiss Exp $
* $Id: wrappers.cpp,v 1.3 2003/03/19 02:09:56 videolan Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -157,17 +157,27 @@ void AddRectangle( char *id, char *visible, char *x, char *y, char *w, char *h,
atoi( w ), atoi( h ), ConvertColor( color ), event, help, vlcWin ) );
}
//---------------------------------------------------------------------------
void AddButton( char *id, char *visible, char *x, char *y, char *up, char *down,
char *disabled, char *click, char *tooltiptext, char *help )
void AddButton(
char *id,
char *visible,
char *x, char *y,
char *up, char *down, char *disabled,
char *onclick, char *onmouseover, char *onmouseout,
char *tooltiptext, char *help )
{
int XOff, YOff;
Window *vlcWin = g_pIntf->p_sys->p_theme->WindowList.back();
g_pIntf->p_sys->p_theme->OffBank->GetOffSet( XOff, YOff );
vlcWin->ControlList.push_back( new ControlButton( id,
ConvertBoolean( visible ), atoi( x ) + XOff, atoi( y ) + YOff,
up, down, disabled, click, tooltiptext, help, vlcWin ) );
vlcWin->ControlList.push_back( new ControlButton(
id,
ConvertBoolean( visible ),
atoi( x ) + XOff, atoi( y ) + YOff,
up, down, disabled,
onclick, onmouseover, onmouseout,
tooltiptext, help,
vlcWin ) );
}
//---------------------------------------------------------------------------
void AddCheckBox( char *id, char *visible, char *x, char *y, char *img1,
......
......@@ -2,7 +2,7 @@
* wrappers.h: Wrappers around C++ objects
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: wrappers.h,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: wrappers.h,v 1.2 2003/03/19 02:09:56 videolan Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -66,13 +66,19 @@ extern "C" {
void AddRectangle( char *id, char *visible, char *x, char *y, char *w,
char *h, char *color, char *event, char *help );
void AddButton( char *id, char *visible, char *x, char *y, char *up,
char *down, char *disabled, char *click,
void AddButton( char *id,
char *visible,
char *x, char *y,
char *up, char *down, char *disabled,
char *onclick, char *onmouseover, char *onmouseout,
char *tooltiptext, char *help );
void AddCheckBox( char *id, char *visible, char *x, char *y, char *img1,
char *img2, char *click1, char *click2, char *disabled1,
char *disabled2, char *action1, char *action2,
void AddCheckBox( char *id,
char *visible,
char *x, char *y,
char *img1, char *img2, char *click1, char *click2,
char *disabled1, char *disabled2,
char *action1, char *action2,
char *tooltiptext1, char *tooltiptext2, char *help );
void AddSlider( char *id, char *visible, char *x, char *y, char *type,
......
......@@ -2,7 +2,7 @@
* window.cpp: Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: window.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: window.cpp,v 1.2 2003/03/19 02:09:56 videolan Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -372,6 +372,9 @@ void Window::Init()
// Refresh Image buffer
RefreshImage( 0, 0, Width, Height );
// Move window as it hasn't been moved yet
Move( Left, Top );
}
//---------------------------------------------------------------------------
void Window::ReSize()
......
......@@ -2,7 +2,7 @@
* win32_window.cpp: Win32 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: win32_window.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $
* $Id: win32_window.cpp,v 1.2 2003/03/19 02:09:56 videolan Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -144,7 +144,6 @@ void Win32Window::OSShow( bool show )
//---------------------------------------------------------------------------
bool Win32Window::ProcessOSEvent( Event *evt )
{
HDC DC;
unsigned int msg = evt->GetMessage();
unsigned int p1 = evt->GetParam1();
int p2 = evt->GetParam2();
......@@ -152,6 +151,7 @@ bool Win32Window::ProcessOSEvent( Event *evt )
switch( msg )
{
case WM_PAINT:
HDC DC;
PAINTSTRUCT Infos;
DC = BeginPaint( hWnd , &Infos );
EndPaint( hWnd , &Infos );
......@@ -159,6 +159,12 @@ bool Win32Window::ProcessOSEvent( Event *evt )
return true;
case WM_MOUSEMOVE:
TRACKMOUSEEVENT TrackEvent;
TrackEvent.cbSize = sizeof( TRACKMOUSEEVENT );
TrackEvent.dwFlags = TME_LEAVE;
TrackEvent.hwndTrack = hWnd;
TrackEvent.dwHoverTime = 1;
TrackMouseEvent( &TrackEvent );
if( p1 == MK_LBUTTON )
MouseMove( LOWORD( p2 ), HIWORD( p2 ), 1 );
else if( p1 == MK_RBUTTON )
......@@ -190,6 +196,10 @@ bool Win32Window::ProcessOSEvent( Event *evt )
MouseDblClick( LOWORD( p2 ), HIWORD( p2 ), 1 );
return true;
case WM_MOUSELEAVE:
MouseMove( -1, -1, 0 );
return true;
default:
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment