mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Fix: coloured glitches in dropdown area
- Improved mouse drag in dropdown scrollbar git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8183 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+238
-217
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file
|
||||
* @author Flugente (bears-pit.com)
|
||||
*/
|
||||
/**
|
||||
* @file
|
||||
* @author Flugente (bears-pit.com)
|
||||
*/
|
||||
|
||||
#include "DropDown.h"
|
||||
#include "Font.h"
|
||||
@@ -30,10 +30,10 @@ void DisplaySmallLine( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 End
|
||||
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
// draw the line
|
||||
LineDraw(FALSE, usStartX, usStartY, EndX, EndY, usColor, pDestBuf);
|
||||
LineDraw( FALSE, usStartX, usStartY, EndX, EndY, usColor, pDestBuf );
|
||||
|
||||
// unlock frame buffer
|
||||
UnLockVideoSurface( FRAME_BUFFER );
|
||||
@@ -41,18 +41,18 @@ void DisplaySmallLine( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 End
|
||||
|
||||
void Display2Line2ShadowHorizontal( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 usColor1, UINT16 usColor2 )
|
||||
{
|
||||
DisplaySmallLine(usStartX, usStartY , EndX, usStartY, usColor1);
|
||||
DisplaySmallLine(usStartX, usStartY+1, EndX, usStartY+1, usColor1);
|
||||
DisplaySmallLine(usStartX, usStartY+2, EndX, usStartY+2, usColor2);
|
||||
DisplaySmallLine(usStartX, usStartY+3, EndX, usStartY+3, usColor2);
|
||||
DisplaySmallLine( usStartX, usStartY, EndX, usStartY, usColor1 );
|
||||
DisplaySmallLine( usStartX, usStartY + 1, EndX, usStartY + 1, usColor1 );
|
||||
DisplaySmallLine( usStartX, usStartY + 2, EndX, usStartY + 2, usColor2 );
|
||||
DisplaySmallLine( usStartX, usStartY + 3, EndX, usStartY + 3, usColor2 );
|
||||
}
|
||||
|
||||
void Display2Line2ShadowVertical( UINT16 usStartX, UINT16 usStartY, UINT16 EndY, UINT16 usColor1, UINT16 usColor2 )
|
||||
{
|
||||
DisplaySmallLine(usStartX, usStartY, usStartX, EndY, usColor1);
|
||||
DisplaySmallLine(usStartX+1, usStartY, usStartX+1, EndY, usColor1);
|
||||
DisplaySmallLine(usStartX+2, usStartY, usStartX+2, EndY, usColor2);
|
||||
DisplaySmallLine(usStartX+3, usStartY, usStartX+3, EndY, usColor2);
|
||||
DisplaySmallLine( usStartX, usStartY, usStartX, EndY, usColor1 );
|
||||
DisplaySmallLine( usStartX + 1, usStartY, usStartX + 1, EndY, usColor1 );
|
||||
DisplaySmallLine( usStartX + 2, usStartY, usStartX + 2, EndY, usColor2 );
|
||||
DisplaySmallLine( usStartX + 3, usStartY, usStartX + 3, EndY, usColor2 );
|
||||
}
|
||||
|
||||
WidgetBase::WidgetBase( )
|
||||
@@ -61,20 +61,20 @@ WidgetBase::WidgetBase( )
|
||||
musStartX = 0;
|
||||
musStartY = 0;
|
||||
|
||||
mColorLine = Get16BPPColor( FROMRGB( 231, 199, 90 ) );
|
||||
mColorLineShadow = Get16BPPColor( FROMRGB( 33, 24, 8 ) );
|
||||
mColorMarked = Get16BPPColor( FROMRGB( 200, 169, 87 ) );
|
||||
mColorHighLight = Get16BPPColor( FROMRGB( 235, 222, 171 ) );
|
||||
mColorLine = Get16BPPColor( FROMRGB( 231, 199, 90 ) );
|
||||
mColorLineShadow = Get16BPPColor( FROMRGB( 33, 24, 8 ) );
|
||||
mColorMarked = Get16BPPColor( FROMRGB( 200, 169, 87 ) );
|
||||
mColorHighLight = Get16BPPColor( FROMRGB( 235, 222, 171 ) );
|
||||
}
|
||||
|
||||
DropDownBase::DropDownBase()
|
||||
: WidgetBase()
|
||||
DropDownBase::DropDownBase( )
|
||||
: WidgetBase( )
|
||||
{
|
||||
// default settings
|
||||
musWidth = 100; // width of text field
|
||||
musArrowWidth = 22; // width of arrow (and thus scrollbar)
|
||||
|
||||
mEntryVector.clear();
|
||||
mEntryVector.clear( );
|
||||
|
||||
swprintf( mHelpText, L"" );
|
||||
|
||||
@@ -83,57 +83,57 @@ DropDownBase::DropDownBase()
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::Init(UINT16 sX, UINT16 sY)
|
||||
DropDownBase::Init( UINT16 sX, UINT16 sY )
|
||||
{
|
||||
mfMouseRegionsCreated = FALSE;
|
||||
|
||||
SetX( sX );
|
||||
SetY( sY );
|
||||
|
||||
mSelectedEntry = min(mSelectedEntry, mEntryVector.size() - 1);
|
||||
mNumDisplayedEntries = min(DROPDOWN_REGIONS, mEntryVector.size() );
|
||||
mFirstShownEntry = max(0, min(mFirstShownEntry, mEntryVector.size() - 1 - mNumDisplayedEntries));
|
||||
|
||||
mSelectedEntry = min( mSelectedEntry, mEntryVector.size( ) - 1 );
|
||||
mNumDisplayedEntries = min( DROPDOWN_REGIONS, mEntryVector.size( ) );
|
||||
mFirstShownEntry = max( 0, min( mFirstShownEntry, mEntryVector.size( ) - 1 - mNumDisplayedEntries ) );
|
||||
|
||||
musWidth = 0;
|
||||
UINT16 size = mEntryVector.size();
|
||||
UINT16 size = mEntryVector.size( );
|
||||
for ( UINT16 i = 0; i < size; ++i )
|
||||
{
|
||||
musWidth = max(musWidth, StringPixLength ( mEntryVector[i].second, DEF_DROPDOWN_FONT ));
|
||||
musWidth = max( musWidth, StringPixLength( mEntryVector[i].second, DEF_DROPDOWN_FONT ) );
|
||||
}
|
||||
|
||||
// account for a bit of space let and right
|
||||
// account for a bit of space left and right
|
||||
musWidth += 2 * CITY_NAME_OFFSET;
|
||||
|
||||
musUpArrowX = GetX() + musWidth;
|
||||
musUpArrowY = GetY() + 2;
|
||||
|
||||
musUpArrowX = GetX( ) + musWidth;
|
||||
musUpArrowY = GetY( ) + 2;
|
||||
|
||||
musFontHeight = GetFontHeight( DEF_DROPDOWN_FONT ); // does not work on init of static objects, as the fonts do not yet exist!
|
||||
|
||||
mfDropScrollBar = (size > DROPDOWN_REGIONS);
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::Init_Drop()
|
||||
DropDownBase::Init_Drop( )
|
||||
{
|
||||
mfMouseRegionsCreated_Drop = FALSE;
|
||||
|
||||
musStartX_Drop = GetX( );
|
||||
musStartY_Drop = GetY( ) + DEF_SCROLL_ARROW_HEIGHT;
|
||||
musScrollAreaX = musStartX_Drop + musWidth;
|
||||
|
||||
|
||||
musDownArrowX = musUpArrowX;
|
||||
musAreaHeight = mNumDisplayedEntries * (musFontHeight + 4);
|
||||
musDownArrowY = musStartY_Drop + musAreaHeight - 24 + 2;
|
||||
musDownArrowY = GetY( ) + musAreaHeight + 2;
|
||||
}
|
||||
|
||||
void * gDropObj;
|
||||
|
||||
void
|
||||
DropDownBase::Create(UINT16 sX, UINT16 sY)
|
||||
DropDownBase::Create( UINT16 sX, UINT16 sY )
|
||||
{
|
||||
Destroy();
|
||||
Destroy( );
|
||||
|
||||
Init(sX, sY);
|
||||
Init( sX, sY );
|
||||
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
@@ -144,30 +144,30 @@ DropDownBase::Create(UINT16 sX, UINT16 sY)
|
||||
return;
|
||||
|
||||
gDropObj = (void*) this;
|
||||
|
||||
|
||||
MSYS_DefineRegion( &mSelectedOpenDropDownRegion, GetX( ) + musWidth, GetY( ), GetX( ) + musWidth + musArrowWidth, GetY( ) + DEF_SCROLL_ARROW_HEIGHT, MSYS_PRIORITY_HIGHEST,
|
||||
CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_OPEN, &DropDownBase::Dummyfunc) );
|
||||
MSYS_AddRegion(&mSelectedOpenDropDownRegion);
|
||||
CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper( (void*) this, DROPDOWN_OPEN, &DropDownBase::Dummyfunc ) );
|
||||
MSYS_AddRegion( &mSelectedOpenDropDownRegion );
|
||||
|
||||
//click anywhere on the screen to close the window( only when the drop down window is active)
|
||||
MSYS_DefineRegion( &mSelectedCloseDropDownRegion, LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y, MSYS_PRIORITY_HIGHEST,
|
||||
CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_CLOSE, &DropDownBase::Dummyfunc) );
|
||||
MSYS_AddRegion(&mSelectedCloseDropDownRegion);
|
||||
MSYS_DisableRegion(&mSelectedCloseDropDownRegion);
|
||||
CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, CallBackWrapper( (void*) this, DROPDOWN_CLOSE, &DropDownBase::Dummyfunc ) );
|
||||
MSYS_AddRegion( &mSelectedCloseDropDownRegion );
|
||||
MSYS_DisableRegion( &mSelectedCloseDropDownRegion );
|
||||
|
||||
MSYS_DefineRegion( &mBubbleHelpRegion, GetX( ), GetY( ), GetX( ) + musWidth, GetY( ) + DEF_SCROLL_ARROW_HEIGHT, MSYS_PRIORITY_HIGHEST,
|
||||
CURSOR_WWW, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
|
||||
MSYS_AddRegion(&mBubbleHelpRegion);
|
||||
|
||||
CURSOR_WWW, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
|
||||
MSYS_AddRegion( &mBubbleHelpRegion );
|
||||
|
||||
mfMouseRegionsCreated = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::Create_Drop()
|
||||
DropDownBase::Create_Drop( )
|
||||
{
|
||||
Destroy_Drop();
|
||||
Destroy_Drop( );
|
||||
|
||||
Init_Drop();
|
||||
Init_Drop( );
|
||||
|
||||
UINT16 i;
|
||||
UINT16 usPosX = musStartX_Drop;
|
||||
@@ -177,9 +177,9 @@ DropDownBase::Create_Drop()
|
||||
for ( i = 0; i < mNumDisplayedEntries; ++i )
|
||||
{
|
||||
MSYS_DefineRegion( &mDropDownRegion[i], usPosX, (UINT16)(usPosY + 4), (UINT16)(usPosX + musWidth - 6), (UINT16)(usPosY + musFontHeight + 7), MSYS_PRIORITY_HIGHEST,
|
||||
CURSOR_WWW, CallBackWrapper((void*) this, DROPDOWN_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_REGION, &DropDownBase::Dummyfunc));
|
||||
MSYS_AddRegion(&mDropDownRegion[i]);
|
||||
MSYS_SetRegionUserData( &mDropDownRegion[ i ], 0, i);
|
||||
CURSOR_WWW, CallBackWrapper( (void*) this, DROPDOWN_MOVEMENT, &DropDownBase::Dummyfunc ), CallBackWrapper( (void*) this, DROPDOWN_REGION, &DropDownBase::Dummyfunc ) );
|
||||
MSYS_AddRegion( &mDropDownRegion[i] );
|
||||
MSYS_SetRegionUserData( &mDropDownRegion[i], 0, i );
|
||||
|
||||
usPosY += musFontHeight + 2;
|
||||
}
|
||||
@@ -189,12 +189,12 @@ DropDownBase::Create_Drop()
|
||||
//up arrow
|
||||
usPosX = musUpArrowX;
|
||||
usPosY = musUpArrowY;
|
||||
for(i=0; i<2; ++i)
|
||||
for ( i = 0; i<2; ++i )
|
||||
{
|
||||
MSYS_DefineRegion( &mgSelectedUpDownArrowOnScrollAreaRegion[i], usPosX, usPosY, (UINT16)(usPosX + musWidth), (UINT16)(usPosY + DEF_SCROLL_ARROW_HEIGHT), MSYS_PRIORITY_HIGHEST,
|
||||
CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_ARROW, &DropDownBase::Dummyfunc));
|
||||
MSYS_AddRegion(&mgSelectedUpDownArrowOnScrollAreaRegion[i]);
|
||||
MSYS_SetRegionUserData( &mgSelectedUpDownArrowOnScrollAreaRegion[ i ], 0, i);
|
||||
CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper( (void*) this, DROPDOWN_ARROW, &DropDownBase::Dummyfunc ) );
|
||||
MSYS_AddRegion( &mgSelectedUpDownArrowOnScrollAreaRegion[i] );
|
||||
MSYS_SetRegionUserData( &mgSelectedUpDownArrowOnScrollAreaRegion[i], 0, i );
|
||||
usPosX = musDownArrowX;
|
||||
usPosY = musDownArrowY;
|
||||
}
|
||||
@@ -205,86 +205,86 @@ DropDownBase::Create_Drop()
|
||||
//the scroll area itself
|
||||
usPosX = musUpArrowX;
|
||||
usPosY = musUpArrowY + DEF_SCROLL_ARROW_HEIGHT;
|
||||
|
||||
usHeight = ( musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - 4 ) / (mNumDisplayedEntries);
|
||||
|
||||
usHeight = (musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - 4) / (mNumDisplayedEntries);
|
||||
for ( i = 0; i<mNumDisplayedEntries - 1; ++i )
|
||||
{
|
||||
MSYS_DefineRegion( &mSelectedScrollAreaDropDownRegion[i], usPosX, usPosY, (UINT16)(usPosX + musWidth), (UINT16)(usPosY + usHeight), MSYS_PRIORITY_HIGHEST,
|
||||
CURSOR_LAPTOP_SCREEN, CallBackWrapper((void*) this, DROPDOWN_SCROLL_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_SCROLL_REGION, &DropDownBase::Dummyfunc));
|
||||
MSYS_AddRegion(&mSelectedScrollAreaDropDownRegion[i]);
|
||||
MSYS_SetRegionUserData( &mSelectedScrollAreaDropDownRegion[ i ], 0, i);
|
||||
CURSOR_LAPTOP_SCREEN, CallBackWrapper( (void*) this, DROPDOWN_SCROLL_MOVEMENT, &DropDownBase::Dummyfunc ), CallBackWrapper( (void*) this, DROPDOWN_SCROLL_REGION, &DropDownBase::Dummyfunc ) );
|
||||
MSYS_AddRegion( &mSelectedScrollAreaDropDownRegion[i] );
|
||||
MSYS_SetRegionUserData( &mSelectedScrollAreaDropDownRegion[i], 0, i );
|
||||
usPosY += usHeight;
|
||||
}
|
||||
|
||||
//put the last one down to cover the remaining area
|
||||
MSYS_DefineRegion( &mSelectedScrollAreaDropDownRegion[i], usPosX, usPosY, (UINT16)(usPosX + musWidth), musDownArrowY, MSYS_PRIORITY_HIGHEST,
|
||||
CURSOR_LAPTOP_SCREEN, CallBackWrapper((void*) this, DROPDOWN_SCROLL_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_SCROLL_REGION, &DropDownBase::Dummyfunc));
|
||||
MSYS_AddRegion(&mSelectedScrollAreaDropDownRegion[i]);
|
||||
MSYS_SetRegionUserData( &mSelectedScrollAreaDropDownRegion[ i ], 0, i);
|
||||
CURSOR_LAPTOP_SCREEN, CallBackWrapper( (void*) this, DROPDOWN_SCROLL_MOVEMENT, &DropDownBase::Dummyfunc ), CallBackWrapper( (void*) this, DROPDOWN_SCROLL_REGION, &DropDownBase::Dummyfunc ) );
|
||||
MSYS_AddRegion( &mSelectedScrollAreaDropDownRegion[i] );
|
||||
MSYS_SetRegionUserData( &mSelectedScrollAreaDropDownRegion[i], 0, i );
|
||||
}
|
||||
|
||||
MSYS_EnableRegion(&mSelectedCloseDropDownRegion);
|
||||
MSYS_EnableRegion( &mSelectedCloseDropDownRegion );
|
||||
|
||||
mfMouseRegionsCreated_Drop = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::Destroy()
|
||||
DropDownBase::Destroy( )
|
||||
{
|
||||
Destroy_Drop();
|
||||
Destroy_Drop( );
|
||||
|
||||
if( !mfMouseRegionsCreated )
|
||||
if ( !mfMouseRegionsCreated )
|
||||
return;
|
||||
|
||||
mfMouseRegionsCreated = FALSE;
|
||||
|
||||
MSYS_RemoveRegion( &mSelectedOpenDropDownRegion);
|
||||
MSYS_RemoveRegion( &mSelectedCloseDropDownRegion);
|
||||
MSYS_RemoveRegion( &mBubbleHelpRegion);
|
||||
mfMouseRegionsCreated = FALSE;
|
||||
|
||||
MSYS_RemoveRegion( &mSelectedOpenDropDownRegion );
|
||||
MSYS_RemoveRegion( &mSelectedCloseDropDownRegion );
|
||||
MSYS_RemoveRegion( &mBubbleHelpRegion );
|
||||
|
||||
DeleteVideoObjectFromIndex( guGoldArrowImages );
|
||||
|
||||
SetRefresh();
|
||||
SetRefresh( );
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::Destroy_Drop()
|
||||
DropDownBase::Destroy_Drop( )
|
||||
{
|
||||
if( !mfMouseRegionsCreated_Drop )
|
||||
if ( !mfMouseRegionsCreated_Drop )
|
||||
return;
|
||||
|
||||
UINT16 i;
|
||||
for ( i = 0; i< mNumDisplayedEntries; ++i )
|
||||
MSYS_RemoveRegion( &mDropDownRegion[i]);
|
||||
|
||||
MSYS_RemoveRegion( &mDropDownRegion[i] );
|
||||
|
||||
//destroy the scroll bar arrow regions
|
||||
for( i=0; i< 2; ++i)
|
||||
MSYS_RemoveRegion( &mgSelectedUpDownArrowOnScrollAreaRegion[i]);
|
||||
for ( i = 0; i< 2; ++i )
|
||||
MSYS_RemoveRegion( &mgSelectedUpDownArrowOnScrollAreaRegion[i] );
|
||||
|
||||
// create scrollbars and arrows only if they are needed
|
||||
if ( mfDropScrollBar )
|
||||
{
|
||||
//destroy the scroll bar regions
|
||||
for ( i = 0; i<mNumDisplayedEntries; ++i )
|
||||
MSYS_RemoveRegion( &mSelectedScrollAreaDropDownRegion[i]);
|
||||
MSYS_RemoveRegion( &mSelectedScrollAreaDropDownRegion[i] );
|
||||
}
|
||||
|
||||
//disable the close region
|
||||
MSYS_DisableRegion(&mSelectedCloseDropDownRegion);
|
||||
|
||||
mfMouseRegionsCreated_Drop = FALSE;
|
||||
MSYS_DisableRegion( &mSelectedCloseDropDownRegion );
|
||||
|
||||
SetRefresh();
|
||||
mfMouseRegionsCreated_Drop = FALSE;
|
||||
|
||||
SetRefresh( );
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::Display()
|
||||
DropDownBase::Display( )
|
||||
{
|
||||
if( !mfMouseRegionsCreated )
|
||||
if ( !mfMouseRegionsCreated )
|
||||
return;
|
||||
|
||||
HVOBJECT hArrowHandle;
|
||||
|
||||
|
||||
//Display the background for the drop down window
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, GetX( ), GetY( ), GetX( ) + musWidth + musArrowWidth, GetY( ) + DEF_SCROLL_ARROW_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
|
||||
@@ -296,45 +296,45 @@ DropDownBase::Display()
|
||||
|
||||
// right between text and arrow
|
||||
Display2Line2ShadowVertical( GetX( ) + musWidth - 4, GetY( ) + 2, GetY( ) + DEF_SCROLL_ARROW_HEIGHT - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||
|
||||
|
||||
// bottom
|
||||
Display2Line2ShadowHorizontal( GetX( ), GetY( ) + DEF_SCROLL_ARROW_HEIGHT - 4, GetX( ) + musWidth + musArrowWidth - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||
|
||||
|
||||
// right
|
||||
Display2Line2ShadowVertical( GetX( ) + musWidth + musArrowWidth - 4, GetY( ), GetY( ) + DEF_SCROLL_ARROW_HEIGHT - 3, GetColorLine( ), GetColorLineShadow( ) );
|
||||
|
||||
DrawTopEntry();
|
||||
|
||||
DrawTopEntry( );
|
||||
|
||||
//get and display the up and down arrows
|
||||
GetVideoObject( &hArrowHandle, guGoldArrowImages );
|
||||
|
||||
//top arrow
|
||||
BltVideoObject(FRAME_BUFFER, hArrowHandle, 0, musUpArrowX, musUpArrowY, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
|
||||
BltVideoObject( FRAME_BUFFER, hArrowHandle, 0, musUpArrowX, musUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
// Set region help text
|
||||
if ( StringPixLength ( mHelpText, DEF_DROPDOWN_FONT ) > 0 )
|
||||
if ( StringPixLength( mHelpText, DEF_DROPDOWN_FONT ) > 0 )
|
||||
{
|
||||
SetRegionFastHelpText( &mBubbleHelpRegion, mHelpText );
|
||||
SetRegionHelpEndCallback( &mBubbleHelpRegion, MSYS_NO_CALLBACK );
|
||||
}
|
||||
|
||||
InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
|
||||
|
||||
InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y );
|
||||
|
||||
// display dropped region if necessary
|
||||
Display_Drop();
|
||||
Display_Drop( );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DropDownBase::Display_Drop()
|
||||
DropDownBase::Display_Drop( )
|
||||
{
|
||||
if( !mfMouseRegionsCreated_Drop )
|
||||
if ( !mfMouseRegionsCreated_Drop )
|
||||
return;
|
||||
|
||||
HVOBJECT hArrowHandle;
|
||||
|
||||
|
||||
//Display the background for the drop down window
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop, musStartY_Drop, musStartX_Drop+musWidth+musArrowWidth, musStartY_Drop+musAreaHeight, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop, musStartY_Drop, musStartX_Drop + musWidth + musArrowWidth, musStartY_Drop + musAreaHeight, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
|
||||
// top
|
||||
Display2Line2ShadowHorizontal( musStartX_Drop, musStartY_Drop - 4, musStartX_Drop + musWidth + musArrowWidth - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||
@@ -344,73 +344,75 @@ DropDownBase::Display_Drop()
|
||||
|
||||
// right between text and arrow
|
||||
Display2Line2ShadowVertical( musStartX_Drop + musWidth - 4, musStartY_Drop - 2, musStartY_Drop + musAreaHeight - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||
|
||||
|
||||
// bottom
|
||||
Display2Line2ShadowHorizontal( musStartX_Drop, musStartY_Drop + musAreaHeight - 4, musStartX_Drop + musWidth + musArrowWidth - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||
|
||||
|
||||
// right
|
||||
Display2Line2ShadowVertical( musStartX_Drop + musWidth + musArrowWidth - 4, musStartY_Drop - 4, musStartY_Drop + musAreaHeight - 3, GetColorLine( ), GetColorLineShadow( ) );
|
||||
|
||||
DrawSelectedCity();
|
||||
|
||||
DrawSelectedCity( );
|
||||
|
||||
//get and display the up and down arrows
|
||||
GetVideoObject( &hArrowHandle, guGoldArrowImages );
|
||||
// top arrow
|
||||
BltVideoObject(FRAME_BUFFER, hArrowHandle, 1, musUpArrowX, musUpArrowY, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
BltVideoObject( FRAME_BUFFER, hArrowHandle, 1, musUpArrowX, musUpArrowY, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
// down arrow
|
||||
BltVideoObject(FRAME_BUFFER, hArrowHandle, 0, musDownArrowX, musDownArrowY, VO_BLT_SRCTRANSPARENCY,NULL);
|
||||
BltVideoObject( FRAME_BUFFER, hArrowHandle, 0, musDownArrowX, musDownArrowY, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
//display the scroll rectangle
|
||||
DrawGoldRectangle();
|
||||
DrawGoldRectangle( );
|
||||
|
||||
InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
|
||||
InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y );
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::DrawTopEntry()
|
||||
DropDownBase::DrawTopEntry( )
|
||||
{
|
||||
// make sure we don't get bogus values
|
||||
if ( !mEntryVector.empty( ) )
|
||||
{
|
||||
mSelectedEntry = min( mSelectedEntry, mEntryVector.size( ) - 1 );
|
||||
|
||||
|
||||
//display the name in the list
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, GetX( ) + 4, GetY( ) + 4, GetX( ) + musWidth - 4, GetY( ) + musFontHeight + 8, GetColorMarked( ) );
|
||||
|
||||
SetFontShadow(NO_SHADOW);
|
||||
SetFontShadow( NO_SHADOW );
|
||||
|
||||
DrawTextToScreen( mEntryVector[mSelectedEntry].second, GetX( ) + CITY_NAME_OFFSET, (UINT16)(GetY( ) + 7), 0, DEF_DROPDOWN_FONT, FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
|
||||
SetFontShadow(DEFAULT_SHADOW);
|
||||
SetFontShadow( DEFAULT_SHADOW );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::DrawSelectedCity()
|
||||
DropDownBase::DrawSelectedCity( )
|
||||
{
|
||||
UINT16 usPosY = musStartY_Drop;
|
||||
UINT16 usMaxY = 0;
|
||||
UINT16 usMinY = 0;
|
||||
|
||||
// make sure we dont go out of our array
|
||||
if ( mFirstShownEntry + mNumDisplayedEntries > (UINT16)(mEntryVector.size( )) )
|
||||
mFirstShownEntry = mEntryVector.size() - mNumDisplayedEntries;
|
||||
|
||||
mFirstShownEntry = mEntryVector.size( ) - mNumDisplayedEntries;
|
||||
|
||||
for ( UINT16 i = mFirstShownEntry; i < mFirstShownEntry + mNumDisplayedEntries; ++i )
|
||||
{
|
||||
usMaxY = min(usPosY+musFontHeight+2, musStartY_Drop + musAreaHeight - 4);
|
||||
usMaxY = min( usPosY + musFontHeight + 1, musStartY_Drop + musAreaHeight - 4 );
|
||||
usMinY = max( usPosY - 3, musStartY_Drop );
|
||||
|
||||
if ( i == mSelectedEntry )
|
||||
{
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop + 4, usPosY - 2, musStartX_Drop + musWidth - 4, usMaxY, GetColorMarked( ) );
|
||||
SetFontShadow(NO_SHADOW);
|
||||
DrawTextToScreen( mEntryVector[i].second, musStartX_Drop+CITY_NAME_OFFSET, usPosY, 0, DEF_DROPDOWN_FONT, FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
SetFontShadow(DEFAULT_SHADOW);
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop + CITY_NAME_OFFSET - 2, usMinY, musStartX_Drop + musWidth - CITY_NAME_OFFSET + 2, usMaxY, GetColorMarked( ) );
|
||||
SetFontShadow( NO_SHADOW );
|
||||
DrawTextToScreen( mEntryVector[i].second, musStartX_Drop + CITY_NAME_OFFSET, usPosY, 0, DEF_DROPDOWN_FONT, FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
SetFontShadow( DEFAULT_SHADOW );
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop+4, usPosY-2, musStartX_Drop+musWidth-4, usMaxY, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
DrawTextToScreen( mEntryVector[i].second, musStartX_Drop+CITY_NAME_OFFSET, usPosY, 0, DEF_DROPDOWN_FONT, STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop + CITY_NAME_OFFSET - 2, usMinY, musStartX_Drop + musWidth - CITY_NAME_OFFSET + 2, usMaxY, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||
DrawTextToScreen( mEntryVector[i].second, musStartX_Drop + CITY_NAME_OFFSET, usPosY, 0, DEF_DROPDOWN_FONT, STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
||||
}
|
||||
|
||||
usPosY += musFontHeight + 4;
|
||||
@@ -418,14 +420,14 @@ DropDownBase::DrawSelectedCity()
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::DrawGoldRectangle()
|
||||
DropDownBase::DrawGoldRectangle( )
|
||||
{
|
||||
UINT32 uiDestPitchBYTES;
|
||||
UINT8 *pDestBuf;
|
||||
UINT16 usWidth, usTempHeight;
|
||||
FLOAT dHeight = 0.0f;
|
||||
UINT16 usPosX, usPosY;
|
||||
|
||||
|
||||
usPosX = musScrollAreaX;
|
||||
usWidth = musArrowWidth - 5;
|
||||
|
||||
@@ -445,8 +447,8 @@ DropDownBase::DrawGoldRectangle()
|
||||
usPosY = musStartY_Drop + (UINT16)((dHeight * mFirstShownEntry));
|
||||
|
||||
dHeight *= mNumDisplayedEntries;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( mfDropScrollBar )
|
||||
{
|
||||
if ( usPosY >= musStartY_Drop + musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - dHeight )
|
||||
@@ -464,7 +466,7 @@ DropDownBase::DrawGoldRectangle()
|
||||
|
||||
//display the line
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
// draw the gold highlite line on the top and left
|
||||
LineDraw( FALSE, usPosX, usPosY, usPosX + usWidth, usPosY, GetColorHighLight( ), pDestBuf );
|
||||
@@ -480,172 +482,191 @@ DropDownBase::DrawGoldRectangle()
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::SelectDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 reason )
|
||||
DropDownBase::SelectDropDownMovementCallBack( MOUSE_REGION * pRegion, INT32 reason )
|
||||
{
|
||||
if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE )
|
||||
if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE )
|
||||
{
|
||||
pRegion->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY);
|
||||
pRegion->uiFlags &= (~BUTTON_CLICKED_ON);
|
||||
InvalidateRegion( pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY );
|
||||
}
|
||||
else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
|
||||
else if ( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
|
||||
{
|
||||
pRegion->uiFlags |= BUTTON_CLICKED_ON ;
|
||||
pRegion->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
mSelectedEntry = (UINT16)MSYS_GetRegionUserData( pRegion, 0 ) + mFirstShownEntry;
|
||||
|
||||
InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY);
|
||||
|
||||
DrawTopEntry();
|
||||
DrawSelectedCity();
|
||||
DrawGoldRectangle();
|
||||
|
||||
InvalidateRegion( musStartX_Drop - CITY_NAME_OFFSET + 2, musStartY_Drop, musStartX_Drop + musWidth - CITY_NAME_OFFSET + 2, musStartY_Drop + musAreaHeight - 4 );
|
||||
|
||||
DrawTopEntry( );
|
||||
DrawGoldRectangle( );
|
||||
DrawSelectedCity( );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::SelectDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
|
||||
DropDownBase::SelectDropDownRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
{
|
||||
if (iReason & MSYS_CALLBACK_REASON_INIT)
|
||||
if ( iReason & MSYS_CALLBACK_REASON_INIT )
|
||||
{
|
||||
}
|
||||
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
|
||||
else if ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
UINT16 ubSelected = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
mSelectedEntry = min( ubSelected + mFirstShownEntry, (UINT16)(max( 0, mEntryVector.size( ) - 1 )) );
|
||||
|
||||
Destroy_Drop();
|
||||
Destroy_Drop( );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::SelectUpDownArrowOnScrollAreaRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
|
||||
DropDownBase::SelectUpDownArrowOnScrollAreaRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
{
|
||||
if (iReason & MSYS_CALLBACK_REASON_INIT)
|
||||
if ( iReason & MSYS_CALLBACK_REASON_INIT )
|
||||
{
|
||||
}
|
||||
else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP || iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
|
||||
else if ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP || iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
|
||||
{
|
||||
UINT16 ubDownArrow = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
|
||||
if( ubDownArrow )
|
||||
if ( ubDownArrow )
|
||||
{
|
||||
if( mSelectedEntry < mEntryVector.size() - 1 )
|
||||
if ( mSelectedEntry < mEntryVector.size( ) - 1 )
|
||||
{
|
||||
++mSelectedEntry;
|
||||
}
|
||||
|
||||
if( ( mSelectedEntry - mFirstShownEntry ) >= mNumDisplayedEntries && mFirstShownEntry <= mEntryVector.size() - 1 - mNumDisplayedEntries )
|
||||
if ( (mSelectedEntry - mFirstShownEntry) >= mNumDisplayedEntries && mFirstShownEntry <= mEntryVector.size( ) - 1 - mNumDisplayedEntries )
|
||||
{
|
||||
++mFirstShownEntry;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( mSelectedEntry > 0 )
|
||||
if ( mSelectedEntry > 0 )
|
||||
--mSelectedEntry;
|
||||
|
||||
if( mSelectedEntry < mFirstShownEntry )
|
||||
if ( mSelectedEntry < mFirstShownEntry )
|
||||
--mFirstShownEntry;
|
||||
}
|
||||
|
||||
DrawTopEntry();
|
||||
DrawSelectedCity();
|
||||
DrawGoldRectangle();
|
||||
|
||||
DrawTopEntry( );
|
||||
DrawGoldRectangle( );
|
||||
DrawSelectedCity( );
|
||||
|
||||
SetRefresh( );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::SelectScrollAreaDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 reason )
|
||||
DropDownBase::SelectScrollAreaDropDownMovementCallBack( MOUSE_REGION * pRegion, INT32 reason )
|
||||
{
|
||||
if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE )
|
||||
if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE )
|
||||
{
|
||||
pRegion->uiFlags &= (~BUTTON_CLICKED_ON );
|
||||
InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY);
|
||||
pRegion->uiFlags &= (~BUTTON_CLICKED_ON);
|
||||
InvalidateRegion( pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY );
|
||||
}
|
||||
else if (reason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
|
||||
else if ( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE )
|
||||
{
|
||||
if( gfLeftButtonState )
|
||||
if ( gfLeftButtonState )
|
||||
{
|
||||
UINT16 ubCityNum = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
|
||||
pRegion->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
if( mFirstShownEntry + ubCityNum < mSelectedEntry )
|
||||
// if mouse is outside of the bar, simply move bar up or down
|
||||
if ( pRegion->MouseYPos < pRegion->RegionTopLeftY )
|
||||
{
|
||||
mSelectedEntry = max(mFirstShownEntry + ubCityNum, 0);
|
||||
pRegion->uiFlags &= ~BUTTON_CLICKED_ON;
|
||||
|
||||
if( ubCityNum == 0 )
|
||||
mFirstShownEntry = max(mFirstShownEntry - 1, 0);
|
||||
mFirstShownEntry = max( mFirstShownEntry - 1, 0 );
|
||||
|
||||
if ( mSelectedEntry > mFirstShownEntry + mNumDisplayedEntries )
|
||||
mSelectedEntry = mFirstShownEntry + mNumDisplayedEntries;
|
||||
}
|
||||
else if( mFirstShownEntry + ubCityNum > mSelectedEntry )
|
||||
else if ( pRegion->MouseYPos > pRegion->RegionBottomRightY )
|
||||
{
|
||||
mSelectedEntry = min( mFirstShownEntry + ubCityNum, (UINT16)(max( 0, mEntryVector.size( ) - 1 )) );
|
||||
pRegion->uiFlags &= ~BUTTON_CLICKED_ON;
|
||||
|
||||
if ( ubCityNum == mNumDisplayedEntries - 1 )
|
||||
mFirstShownEntry = min( mFirstShownEntry + 1, (UINT16)(max( 0, mEntryVector.size( ) - 1 )) );
|
||||
mFirstShownEntry = min( mFirstShownEntry + 1, (UINT16)(max( 0, mEntryVector.size( ) - 1 )) );
|
||||
|
||||
if ( mSelectedEntry < mFirstShownEntry )
|
||||
++mSelectedEntry;
|
||||
}
|
||||
|
||||
InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY);
|
||||
|
||||
DrawTopEntry();
|
||||
DrawSelectedCity();
|
||||
DrawGoldRectangle();
|
||||
// inside the scroll bar, determine where the middle of the slider is to determine where to go
|
||||
else
|
||||
{
|
||||
pRegion->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
// go to the relative position in our list of entries depending on where we click
|
||||
if ( !mEntryVector.empty( ) && musAreaHeight - 2 * DEF_SCROLL_ARROW_HEIGHT > 0 )
|
||||
{
|
||||
FLOAT rate = (FLOAT)(pRegion->MouseYPos - musStartY_Drop) / (FLOAT)(musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - 4);
|
||||
|
||||
mFirstShownEntry = rate * mEntryVector.size( );
|
||||
|
||||
if ( mSelectedEntry > mFirstShownEntry + mNumDisplayedEntries )
|
||||
mSelectedEntry = mFirstShownEntry + mNumDisplayedEntries;
|
||||
else if ( mSelectedEntry < mFirstShownEntry )
|
||||
mSelectedEntry = mFirstShownEntry;
|
||||
}
|
||||
}
|
||||
|
||||
InvalidateRegion( musStartX_Drop, musStartY_Drop, musStartX_Drop + musWidth + musArrowWidth, musStartY_Drop + musAreaHeight - 4 );
|
||||
|
||||
DrawTopEntry( );
|
||||
DrawGoldRectangle( );
|
||||
DrawSelectedCity( );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::SelectScrollAreaDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
|
||||
DropDownBase::SelectScrollAreaDropDownRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
{
|
||||
if (iReason & MSYS_CALLBACK_REASON_INIT)
|
||||
if ( iReason & MSYS_CALLBACK_REASON_INIT )
|
||||
{
|
||||
}
|
||||
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
|
||||
else if ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
UINT16 ubCityNum = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
|
||||
if( ubCityNum < mSelectedEntry )
|
||||
if ( ubCityNum < mSelectedEntry )
|
||||
{
|
||||
--mSelectedEntry;
|
||||
if( mSelectedEntry < mFirstShownEntry )
|
||||
if ( mSelectedEntry < mFirstShownEntry )
|
||||
--mFirstShownEntry;
|
||||
}
|
||||
else if( ubCityNum > mSelectedEntry )
|
||||
else if ( ubCityNum > mSelectedEntry )
|
||||
{
|
||||
++mSelectedEntry;
|
||||
if( ( mSelectedEntry - mFirstShownEntry ) >= mNumDisplayedEntries )
|
||||
if ( (mSelectedEntry - mFirstShownEntry) >= mNumDisplayedEntries )
|
||||
++mFirstShownEntry;
|
||||
}
|
||||
|
||||
DrawTopEntry();
|
||||
DrawSelectedCity();
|
||||
DrawGoldRectangle();
|
||||
|
||||
DrawTopEntry( );
|
||||
DrawGoldRectangle( );
|
||||
DrawSelectedCity( );
|
||||
}
|
||||
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT)
|
||||
else if ( iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT )
|
||||
{
|
||||
UINT16 ubCityNum = (UINT16)MSYS_GetRegionUserData( pRegion, 0 );
|
||||
|
||||
pRegion->uiFlags |= BUTTON_CLICKED_ON ;
|
||||
pRegion->uiFlags |= BUTTON_CLICKED_ON;
|
||||
|
||||
if( ubCityNum < mSelectedEntry )
|
||||
if ( ubCityNum < mSelectedEntry )
|
||||
{
|
||||
--mSelectedEntry;
|
||||
if( mSelectedEntry < mFirstShownEntry )
|
||||
if ( mSelectedEntry < mFirstShownEntry )
|
||||
--mFirstShownEntry;
|
||||
}
|
||||
else if( ubCityNum > mSelectedEntry )
|
||||
else if ( ubCityNum > mSelectedEntry )
|
||||
{
|
||||
++mSelectedEntry;
|
||||
if( ( mSelectedEntry - mFirstShownEntry ) >= mNumDisplayedEntries )
|
||||
if ( (mSelectedEntry - mFirstShownEntry) >= mNumDisplayedEntries )
|
||||
++mFirstShownEntry;
|
||||
}
|
||||
|
||||
InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY);
|
||||
|
||||
DrawTopEntry();
|
||||
DrawSelectedCity();
|
||||
DrawGoldRectangle();
|
||||
|
||||
InvalidateRegion( pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY );
|
||||
|
||||
DrawTopEntry( );
|
||||
DrawGoldRectangle( );
|
||||
DrawSelectedCity( );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,8 +677,8 @@ void
|
||||
DropDownBase::SetSelectedEntryKey( INT16 aKey )
|
||||
{
|
||||
UINT16 cnt = 0;
|
||||
std::vector<std::pair<INT16, STR16> >::iterator itend = mEntryVector.end();
|
||||
for ( std::vector<std::pair<INT16, STR16> >::iterator it = mEntryVector.begin(); it != itend; ++it )
|
||||
std::vector<std::pair<INT16, STR16> >::iterator itend = mEntryVector.end( );
|
||||
for ( std::vector<std::pair<INT16, STR16> >::iterator it = mEntryVector.begin( ); it != itend; ++it )
|
||||
{
|
||||
if ( (*it).first == aKey )
|
||||
{
|
||||
@@ -675,31 +696,31 @@ DropDownBase::SetSelectedEntryKey( INT16 aKey )
|
||||
void
|
||||
DropDownBase::SetNthEntry( UINT16 aNr )
|
||||
{
|
||||
mSelectedEntry = min( aNr, max(0, mEntryVector.size() - 1) );
|
||||
mSelectedEntry = min( aNr, max( 0, mEntryVector.size( ) - 1 ) );
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::OpenDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
|
||||
DropDownBase::OpenDropDownRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
{
|
||||
if (iReason & MSYS_CALLBACK_REASON_INIT)
|
||||
if ( iReason & MSYS_CALLBACK_REASON_INIT )
|
||||
{
|
||||
}
|
||||
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
|
||||
else if ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
Create_Drop();
|
||||
Display_Drop();
|
||||
Create_Drop( );
|
||||
Display_Drop( );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DropDownBase::CloseDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason )
|
||||
DropDownBase::CloseDropDownRegionCallBack( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
{
|
||||
if (iReason & MSYS_CALLBACK_REASON_INIT)
|
||||
if ( iReason & MSYS_CALLBACK_REASON_INIT )
|
||||
{
|
||||
}
|
||||
else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
|
||||
else if ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
Destroy_Drop();
|
||||
Destroy_Drop( );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user