Commit 9b4e33b4 authored by VideoLAN's avatar VideoLAN

* Fixed bug: When button or checkbox are disabled, the previous control can't

             take the hand
parent c31926a0
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* button.cpp: Button control * button.cpp: Button control
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: button.cpp,v 1.4 2003/03/20 09:29:07 karibu Exp $ * $Id: button.cpp,v 1.5 2003/04/11 21:19:49 videolan Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -134,16 +134,20 @@ void ControlButton::Draw( int x, int y, int w, int h, Graphics *dest ) ...@@ -134,16 +134,20 @@ void ControlButton::Draw( int x, int y, int w, int h, Graphics *dest )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool ControlButton::MouseUp( int x, int y, int button ) bool ControlButton::MouseUp( int x, int y, int button )
{ {
if( !Enabled ) // If hit in the button
return false; if( Img[1]->Hit( x - Left, y - Top ) )
if( Img[1]->Hit( x - Left, y - Top ) && button == 1 && Selected )
{ {
State = 1; if( !Enabled )
Selected = false; return true;
ClickAction->SendEvent();
ParentWindow->Refresh( Left, Top, Width, Height ); if( button == 1 && Selected )
return true; {
State = 1;
Selected = false;
ClickAction->SendEvent();
ParentWindow->Refresh( Left, Top, Width, Height );
return true;
}
} }
if( button == 1 ) if( button == 1 )
...@@ -154,16 +158,20 @@ bool ControlButton::MouseUp( int x, int y, int button ) ...@@ -154,16 +158,20 @@ bool ControlButton::MouseUp( int x, int y, int button )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool ControlButton::MouseDown( int x, int y, int button ) bool ControlButton::MouseDown( int x, int y, int button )
{ {
if( !Enabled ) if( Img[0]->Hit( x - Left, y - Top ) )
return false;
if( Img[0]->Hit( x - Left, y - Top ) && button == 1 )
{ {
State = 0; if( !Enabled )
Selected = true; return true;
ParentWindow->Refresh( Left, Top, Width, Height );
return true; if( button == 1 )
{
State = 0;
Selected = true;
ParentWindow->Refresh( Left, Top, Width, Height );
return true;
}
} }
return false; return false;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* checkbox.cpp: Checkbox control * checkbox.cpp: Checkbox control
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: checkbox.cpp,v 1.2 2003/03/19 17:14:50 karibu Exp $ * $Id: checkbox.cpp,v 1.3 2003/04/11 21:19:49 videolan Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -199,8 +199,9 @@ void ControlCheckBox::Draw( int x, int y, int w, int h, Graphics *dest ) ...@@ -199,8 +199,9 @@ void ControlCheckBox::Draw( int x, int y, int w, int h, Graphics *dest )
bool ControlCheckBox::MouseUp( int x, int y, int button ) bool ControlCheckBox::MouseUp( int x, int y, int button )
{ {
// Test enabled // Test enabled
if( ( !Enabled1 && Act == 1 ) || ( !Enabled2 && Act == 2 ) ) if( ( !Enabled1 && Act == 1 && Img[1]->Hit( x - Left, y - Top ) ) ||
return false; ( !Enabled2 && Act == 2 && Img[3]->Hit( x - Left, y - Top ) ) )
return true;
if( button == 1 && Selected ) if( button == 1 && Selected )
{ {
...@@ -229,10 +230,11 @@ bool ControlCheckBox::MouseUp( int x, int y, int button ) ...@@ -229,10 +230,11 @@ bool ControlCheckBox::MouseUp( int x, int y, int button )
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool ControlCheckBox::MouseDown( int x, int y, int button ) bool ControlCheckBox::MouseDown( int x, int y, int button )
{ {
// Test enabled
if( ( !Enabled1 && Act == 1 ) || ( !Enabled2 && Act == 2 ) )
return false;
// Test enabled
if( ( !Enabled1 && Act == 1 && Img[1]->Hit( x - Left, y - Top ) ) ||
( !Enabled2 && Act == 2 && Img[3]->Hit( x - Left, y - Top ) ) )
return true;
if( button == 1 ) if( button == 1 )
{ {
if( Act == 1 && Img[0]->Hit( x - Left, y - Top ) ) if( Act == 1 && Img[0]->Hit( x - Left, y - Top ) )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* image.cpp: Image control * image.cpp: Image control
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: image.cpp,v 1.1 2003/03/18 02:21:47 ipkiss Exp $ * $Id: image.cpp,v 1.2 2003/04/11 21:19:49 videolan Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -95,7 +95,8 @@ bool ControlImage::MouseDown( int x, int y, int button ) ...@@ -95,7 +95,8 @@ bool ControlImage::MouseDown( int x, int y, int button )
{ {
if( !Enabled || !Img[0]->Hit( x - Left, y - Top ) || button != 1 || if( !Enabled || !Img[0]->Hit( x - Left, y - Top ) || button != 1 ||
!MouseDownAction->SendEvent() ) !MouseDownAction->SendEvent() )
return false; return false;
return true; return true;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
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