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,10 +134,13 @@ void ControlButton::Draw( int x, int y, int w, int h, Graphics *dest ) ...@@ -134,10 +134,13 @@ 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 hit in the button
if( Img[1]->Hit( x - Left, y - Top ) )
{
if( !Enabled ) if( !Enabled )
return false; return true;
if( Img[1]->Hit( x - Left, y - Top ) && button == 1 && Selected ) if( button == 1 && Selected )
{ {
State = 1; State = 1;
Selected = false; Selected = false;
...@@ -145,6 +148,7 @@ bool ControlButton::MouseUp( int x, int y, int button ) ...@@ -145,6 +148,7 @@ bool ControlButton::MouseUp( int x, int y, int button )
ParentWindow->Refresh( Left, Top, Width, Height ); ParentWindow->Refresh( Left, Top, Width, Height );
return true; return true;
} }
}
if( button == 1 ) if( button == 1 )
Selected = false; Selected = false;
...@@ -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( Img[0]->Hit( x - Left, y - Top ) )
{
if( !Enabled ) if( !Enabled )
return false; return true;
if( Img[0]->Hit( x - Left, y - Top ) && button == 1 ) if( button == 1 )
{ {
State = 0; State = 0;
Selected = true; Selected = true;
ParentWindow->Refresh( Left, Top, Width, Height ); ParentWindow->Refresh( Left, Top, Width, Height );
return true; 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>
...@@ -96,6 +96,7 @@ bool ControlImage::MouseDown( int x, int y, int button ) ...@@ -96,6 +96,7 @@ 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