mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
- New: WidgetBase serves as a base for future widgets.
- Fix: ctd if dropdown contained exactly one entry git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7272 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+56
-45
@@ -53,7 +53,20 @@ void Display2Line2ShadowVertical( UINT16 usStartX, UINT16 usStartY, UINT16 EndY,
|
|||||||
DisplaySmallLine(usStartX+3, usStartY, usStartX+3, EndY, usColor2);
|
DisplaySmallLine(usStartX+3, usStartY, usStartX+3, EndY, usColor2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WidgetBase::WidgetBase( )
|
||||||
|
{
|
||||||
|
// default settings
|
||||||
|
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 ) );
|
||||||
|
}
|
||||||
|
|
||||||
DropDownBase::DropDownBase()
|
DropDownBase::DropDownBase()
|
||||||
|
: WidgetBase()
|
||||||
{
|
{
|
||||||
// default settings
|
// default settings
|
||||||
musWidth = 100; // width of text field
|
musWidth = 100; // width of text field
|
||||||
@@ -65,11 +78,6 @@ DropDownBase::DropDownBase()
|
|||||||
|
|
||||||
mSelectedEntry = 0;
|
mSelectedEntry = 0;
|
||||||
mFirstShownEntry = 0;
|
mFirstShownEntry = 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 ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -77,8 +85,8 @@ DropDownBase::Init(UINT16 sX, UINT16 sY)
|
|||||||
{
|
{
|
||||||
mfMouseRegionsCreated = FALSE;
|
mfMouseRegionsCreated = FALSE;
|
||||||
|
|
||||||
musStartX = sX;
|
SetX( sX );
|
||||||
musStartY = sY;
|
SetY( sY );
|
||||||
|
|
||||||
mSelectedEntry = min(mSelectedEntry, mEntryVector.size() - 1);
|
mSelectedEntry = min(mSelectedEntry, mEntryVector.size() - 1);
|
||||||
mNumDisplayedEntries = min(DROPDOWN_REGIONS, mEntryVector.size() );
|
mNumDisplayedEntries = min(DROPDOWN_REGIONS, mEntryVector.size() );
|
||||||
@@ -94,8 +102,8 @@ DropDownBase::Init(UINT16 sX, UINT16 sY)
|
|||||||
// account for a bit of space let and right
|
// account for a bit of space let and right
|
||||||
musWidth += 2 * CITY_NAME_OFFSET;
|
musWidth += 2 * CITY_NAME_OFFSET;
|
||||||
|
|
||||||
musUpArrowX = musStartX + musWidth;
|
musUpArrowX = GetX() + musWidth;
|
||||||
musUpArrowY = musStartY + 2;
|
musUpArrowY = GetY() + 2;
|
||||||
|
|
||||||
musFontHeight = GetFontHeight( DEF_DROPDOWN_FONT ); // does not work on init of static objects, as the fonts do not yet exist!
|
musFontHeight = GetFontHeight( DEF_DROPDOWN_FONT ); // does not work on init of static objects, as the fonts do not yet exist!
|
||||||
}
|
}
|
||||||
@@ -105,8 +113,8 @@ DropDownBase::Init_Drop()
|
|||||||
{
|
{
|
||||||
mfMouseRegionsCreated_Drop = FALSE;
|
mfMouseRegionsCreated_Drop = FALSE;
|
||||||
|
|
||||||
musStartX_Drop = musStartX;
|
musStartX_Drop = GetX( );
|
||||||
musStartY_Drop = musStartY + DEF_SCROLL_ARROW_HEIGHT;
|
musStartY_Drop = GetY( ) + DEF_SCROLL_ARROW_HEIGHT;
|
||||||
musScrollAreaX = musStartX_Drop + musWidth;
|
musScrollAreaX = musStartX_Drop + musWidth;
|
||||||
|
|
||||||
musDownArrowX = musUpArrowX;
|
musDownArrowX = musUpArrowX;
|
||||||
@@ -133,7 +141,7 @@ DropDownBase::Create(UINT16 sX, UINT16 sY)
|
|||||||
|
|
||||||
gDropObj = (void*) this;
|
gDropObj = (void*) this;
|
||||||
|
|
||||||
MSYS_DefineRegion( &mSelectedOpenDropDownRegion, musStartX + musWidth, musStartY, musStartX + musWidth + musArrowWidth, musStartY + DEF_SCROLL_ARROW_HEIGHT, MSYS_PRIORITY_HIGH,
|
MSYS_DefineRegion( &mSelectedOpenDropDownRegion, GetX( ) + musWidth, GetY( ), GetX( ) + musWidth + musArrowWidth, GetY( ) + DEF_SCROLL_ARROW_HEIGHT, MSYS_PRIORITY_HIGH,
|
||||||
CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_OPEN, &DropDownBase::Dummyfunc) );
|
CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_OPEN, &DropDownBase::Dummyfunc) );
|
||||||
MSYS_AddRegion(&mSelectedOpenDropDownRegion);
|
MSYS_AddRegion(&mSelectedOpenDropDownRegion);
|
||||||
|
|
||||||
@@ -143,7 +151,7 @@ DropDownBase::Create(UINT16 sX, UINT16 sY)
|
|||||||
MSYS_AddRegion(&mSelectedCloseDropDownRegion);
|
MSYS_AddRegion(&mSelectedCloseDropDownRegion);
|
||||||
MSYS_DisableRegion(&mSelectedCloseDropDownRegion);
|
MSYS_DisableRegion(&mSelectedCloseDropDownRegion);
|
||||||
|
|
||||||
MSYS_DefineRegion( &mBubbleHelpRegion, musStartX, musStartY, musStartX + musWidth, musStartY + DEF_SCROLL_ARROW_HEIGHT, MSYS_PRIORITY_HIGH,
|
MSYS_DefineRegion( &mBubbleHelpRegion, GetX( ), GetY( ), GetX( ) + musWidth, GetY( ) + DEF_SCROLL_ARROW_HEIGHT, MSYS_PRIORITY_HIGH,
|
||||||
CURSOR_WWW, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
|
CURSOR_WWW, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
|
||||||
MSYS_AddRegion(&mBubbleHelpRegion);
|
MSYS_AddRegion(&mBubbleHelpRegion);
|
||||||
|
|
||||||
@@ -265,22 +273,22 @@ DropDownBase::Display()
|
|||||||
HVOBJECT hArrowHandle;
|
HVOBJECT hArrowHandle;
|
||||||
|
|
||||||
//Display the background for the drop down window
|
//Display the background for the drop down window
|
||||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX, musStartY, musStartX + musWidth + musArrowWidth, musStartY + DEF_SCROLL_ARROW_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
ColorFillVideoSurfaceArea( FRAME_BUFFER, GetX( ), GetY( ), GetX( ) + musWidth + musArrowWidth, GetY( ) + DEF_SCROLL_ARROW_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||||
|
|
||||||
// top
|
// top
|
||||||
Display2Line2ShadowHorizontal( musStartX, musStartY, musStartX + musWidth + musArrowWidth - 1, mColorLine, mColorLineShadow );
|
Display2Line2ShadowHorizontal( GetX( ), GetY( ), GetX( ) + musWidth + musArrowWidth - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||||
|
|
||||||
// left
|
// left
|
||||||
Display2Line2ShadowVertical( musStartX, musStartY+2, musStartY + DEF_SCROLL_ARROW_HEIGHT - 1, mColorLine, mColorLineShadow );
|
Display2Line2ShadowVertical( GetX( ), GetY( ) + 2, GetY( ) + DEF_SCROLL_ARROW_HEIGHT - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||||
|
|
||||||
// right between text and arrow
|
// right between text and arrow
|
||||||
Display2Line2ShadowVertical( musStartX + musWidth - 4, musStartY+2, musStartY + DEF_SCROLL_ARROW_HEIGHT - 1, mColorLine, mColorLineShadow );
|
Display2Line2ShadowVertical( GetX( ) + musWidth - 4, GetY( ) + 2, GetY( ) + DEF_SCROLL_ARROW_HEIGHT - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||||
|
|
||||||
// bottom
|
// bottom
|
||||||
Display2Line2ShadowHorizontal( musStartX, musStartY + DEF_SCROLL_ARROW_HEIGHT - 4, musStartX + musWidth + musArrowWidth - 1, mColorLine, mColorLineShadow );
|
Display2Line2ShadowHorizontal( GetX( ), GetY( ) + DEF_SCROLL_ARROW_HEIGHT - 4, GetX( ) + musWidth + musArrowWidth - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||||
|
|
||||||
// right
|
// right
|
||||||
Display2Line2ShadowVertical( musStartX + musWidth + musArrowWidth - 4, musStartY, musStartY + DEF_SCROLL_ARROW_HEIGHT - 3, mColorLine, mColorLineShadow );
|
Display2Line2ShadowVertical( GetX( ) + musWidth + musArrowWidth - 4, GetY( ), GetY( ) + DEF_SCROLL_ARROW_HEIGHT - 3, GetColorLine( ), GetColorLineShadow( ) );
|
||||||
|
|
||||||
DrawTopEntry();
|
DrawTopEntry();
|
||||||
|
|
||||||
@@ -315,19 +323,19 @@ DropDownBase::Display_Drop()
|
|||||||
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
|
// top
|
||||||
Display2Line2ShadowHorizontal( musStartX_Drop, musStartY_Drop-4, musStartX_Drop + musWidth + musArrowWidth - 1, mColorLine, mColorLineShadow );
|
Display2Line2ShadowHorizontal( musStartX_Drop, musStartY_Drop - 4, musStartX_Drop + musWidth + musArrowWidth - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||||
|
|
||||||
// left
|
// left
|
||||||
Display2Line2ShadowVertical( musStartX_Drop, musStartY_Drop-2, musStartY_Drop + musAreaHeight - 1, mColorLine, mColorLineShadow );
|
Display2Line2ShadowVertical( musStartX_Drop, musStartY_Drop - 2, musStartY_Drop + musAreaHeight - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||||
|
|
||||||
// right between text and arrow
|
// right between text and arrow
|
||||||
Display2Line2ShadowVertical( musStartX_Drop + musWidth - 4, musStartY_Drop-2, musStartY_Drop + musAreaHeight - 1, mColorLine, mColorLineShadow );
|
Display2Line2ShadowVertical( musStartX_Drop + musWidth - 4, musStartY_Drop - 2, musStartY_Drop + musAreaHeight - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||||
|
|
||||||
// bottom
|
// bottom
|
||||||
Display2Line2ShadowHorizontal( musStartX_Drop, musStartY_Drop + musAreaHeight - 4, musStartX_Drop + musWidth + musArrowWidth - 1, mColorLine, mColorLineShadow );
|
Display2Line2ShadowHorizontal( musStartX_Drop, musStartY_Drop + musAreaHeight - 4, musStartX_Drop + musWidth + musArrowWidth - 1, GetColorLine( ), GetColorLineShadow( ) );
|
||||||
|
|
||||||
// right
|
// right
|
||||||
Display2Line2ShadowVertical( musStartX_Drop + musWidth + musArrowWidth - 4, musStartY_Drop-4, musStartY_Drop + musAreaHeight - 3, mColorLine, mColorLineShadow );
|
Display2Line2ShadowVertical( musStartX_Drop + musWidth + musArrowWidth - 4, musStartY_Drop - 4, musStartY_Drop + musAreaHeight - 3, GetColorLine( ), GetColorLineShadow( ) );
|
||||||
|
|
||||||
DrawSelectedCity();
|
DrawSelectedCity();
|
||||||
|
|
||||||
@@ -352,11 +360,11 @@ DropDownBase::DrawTopEntry()
|
|||||||
mSelectedEntry = min(mSelectedEntry, mEntryVector.size() - 1);
|
mSelectedEntry = min(mSelectedEntry, mEntryVector.size() - 1);
|
||||||
|
|
||||||
//display the name in the list
|
//display the name in the list
|
||||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX+4, musStartY+4, musStartX+musWidth-4, musStartY+musFontHeight+8, mColorMarked );
|
ColorFillVideoSurfaceArea( FRAME_BUFFER, GetX( ) + 4, GetY( ) + 4, GetX( ) + musWidth - 4, GetY( ) + musFontHeight + 8, GetColorMarked( ) );
|
||||||
|
|
||||||
SetFontShadow(NO_SHADOW);
|
SetFontShadow(NO_SHADOW);
|
||||||
|
|
||||||
DrawTextToScreen( mEntryVector[mSelectedEntry].second, musStartX+CITY_NAME_OFFSET, (UINT16)(musStartY+7), 0, DEF_DROPDOWN_FONT, FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
|
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);
|
||||||
}
|
}
|
||||||
@@ -377,7 +385,7 @@ DropDownBase::DrawSelectedCity()
|
|||||||
|
|
||||||
if ( i == mSelectedEntry )
|
if ( i == mSelectedEntry )
|
||||||
{
|
{
|
||||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop+4, usPosY-2, musStartX_Drop+musWidth-4, usMaxY, mColorMarked );
|
ColorFillVideoSurfaceArea( FRAME_BUFFER, musStartX_Drop + 4, usPosY - 2, musStartX_Drop + musWidth - 4, usMaxY, GetColorMarked( ) );
|
||||||
SetFontShadow(NO_SHADOW);
|
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 );
|
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);
|
SetFontShadow(DEFAULT_SHADOW);
|
||||||
@@ -402,36 +410,39 @@ DropDownBase::DrawGoldRectangle()
|
|||||||
|
|
||||||
UINT16 temp;
|
UINT16 temp;
|
||||||
|
|
||||||
usTempPosY = musStartY;
|
usTempPosY = GetY();
|
||||||
usTempPosY += DEF_SCROLL_ARROW_HEIGHT;
|
usTempPosY += DEF_SCROLL_ARROW_HEIGHT;
|
||||||
usPosX = musScrollAreaX;
|
usPosX = musScrollAreaX;
|
||||||
usWidth = musArrowWidth - 5;
|
usWidth = musArrowWidth - 5;
|
||||||
usTempHeight = ( musAreaHeight - DEF_SCROLL_ARROW_HEIGHT ) - 4;
|
usTempHeight = ( musAreaHeight - DEF_SCROLL_ARROW_HEIGHT ) - 4;
|
||||||
|
|
||||||
usHeight = usTempHeight / (mEntryVector.size() - 1);
|
if ( mEntryVector.size() > 1 )
|
||||||
|
{
|
||||||
|
usHeight = usTempHeight / (mEntryVector.size() - 1);
|
||||||
|
|
||||||
usPosY = usTempPosY + (UINT16)( ( usHeight * mSelectedEntry ) );
|
usPosY = usTempPosY + (UINT16)( ( usHeight * mSelectedEntry ) );
|
||||||
|
|
||||||
temp = musStartY_Drop + musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - usHeight;
|
temp = musStartY_Drop + musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - usHeight;
|
||||||
|
|
||||||
if( usPosY >= temp )
|
if( usPosY >= temp )
|
||||||
usPosY = musStartY_Drop + musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - usHeight - 5;
|
usPosY = musStartY_Drop + musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - usHeight - 5;
|
||||||
|
|
||||||
// color everything black and then color te rectangle, that way we dont have to redraw the entire page
|
// color everything black and then color te rectangle, that way we dont have to redraw the entire page
|
||||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musScrollAreaX, usTempPosY, musScrollAreaX+usWidth, usTempPosY+usTempHeight, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
ColorFillVideoSurfaceArea( FRAME_BUFFER, musScrollAreaX, usTempPosY, musScrollAreaX+usWidth, usTempPosY+usTempHeight, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
|
||||||
ColorFillVideoSurfaceArea( FRAME_BUFFER, musScrollAreaX, usPosY, musScrollAreaX+usWidth, usPosY+usHeight, mColorMarked );
|
ColorFillVideoSurfaceArea( FRAME_BUFFER, musScrollAreaX, usPosY, musScrollAreaX + usWidth, usPosY + usHeight, GetColorMarked( ) );
|
||||||
|
|
||||||
//display the line
|
//display the line
|
||||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
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
|
// draw the gold highlite line on the top and left
|
||||||
LineDraw(FALSE, usPosX, usPosY, usPosX+usWidth, usPosY, mColorHighLight, pDestBuf);
|
LineDraw( FALSE, usPosX, usPosY, usPosX + usWidth, usPosY, GetColorHighLight( ), pDestBuf );
|
||||||
LineDraw(FALSE, usPosX, usPosY, usPosX, usPosY+usHeight, mColorHighLight, pDestBuf);
|
LineDraw( FALSE, usPosX, usPosY, usPosX, usPosY + usHeight, GetColorHighLight(), pDestBuf );
|
||||||
|
|
||||||
// draw the shadow line on the bottom and right
|
// draw the shadow line on the bottom and right
|
||||||
LineDraw(FALSE, usPosX, usPosY+usHeight, usPosX+usWidth, usPosY+usHeight, mColorLineShadow, pDestBuf);
|
LineDraw( FALSE, usPosX, usPosY + usHeight, usPosX + usWidth, usPosY + usHeight, GetColorLineShadow( ), pDestBuf );
|
||||||
LineDraw(FALSE, usPosX+usWidth, usPosY, usPosX+usWidth, usPosY+usHeight, mColorLineShadow, pDestBuf);
|
LineDraw( FALSE, usPosX + usWidth, usPosY, usPosX + usWidth, usPosY + usHeight, GetColorLineShadow(), pDestBuf );
|
||||||
|
}
|
||||||
|
|
||||||
// unlock frame buffer
|
// unlock frame buffer
|
||||||
UnLockVideoSurface( FRAME_BUFFER );
|
UnLockVideoSurface( FRAME_BUFFER );
|
||||||
|
|||||||
+61
-32
@@ -15,6 +15,62 @@ void DisplaySmallLine( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 End
|
|||||||
void Display2Line2ShadowVertical( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 usColor1, UINT16 usColor2 );
|
void Display2Line2ShadowVertical( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 usColor1, UINT16 usColor2 );
|
||||||
void Display2Line2ShadowHorizontal( UINT16 usStartX, UINT16 usStartY, UINT16 EndY, UINT16 usColor1, UINT16 usColor2 );
|
void Display2Line2ShadowHorizontal( UINT16 usStartX, UINT16 usStartY, UINT16 EndY, UINT16 usColor1, UINT16 usColor2 );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A simple class that takes coordiantes and colors.
|
||||||
|
* It simply exists to provide these simple methods for other classes.
|
||||||
|
*/
|
||||||
|
class WidgetBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WidgetBase( );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* X and Y-Coordinates define the upper left corner
|
||||||
|
*/
|
||||||
|
void SetX( UINT16 aVal ) { musStartX = aVal; }
|
||||||
|
UINT16 GetX( ) { return musStartX; }
|
||||||
|
void SetY( UINT16 aVal ) { musStartY = aVal; }
|
||||||
|
UINT16 GetY( ) { return musStartY; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Color of boundary line
|
||||||
|
*/
|
||||||
|
void SetColorLine( UINT16 aCol ) { mColorLine = aCol; }
|
||||||
|
UINT16 GetColorLine( ) { return mColorLine; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Color of boundary line shadow
|
||||||
|
*/
|
||||||
|
void SetColorLineShadow( UINT16 aCol ) { mColorLineShadow = aCol; }
|
||||||
|
UINT16 GetColorLineShadow( ) { return mColorLineShadow; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* background color of selected entry
|
||||||
|
*/
|
||||||
|
void SetColorMarked( UINT16 aCol ) { mColorMarked = aCol; }
|
||||||
|
UINT16 GetColorMarked( ) { return mColorMarked; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Color of highlighted element
|
||||||
|
*/
|
||||||
|
void SetColorHighLight( UINT16 aCol ) { mColorHighLight = aCol; }
|
||||||
|
UINT16 GetColorHighLight( ) { return mColorHighLight; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// declare but don't define
|
||||||
|
WidgetBase( WidgetBase const& );
|
||||||
|
void operator=(WidgetBase const&);
|
||||||
|
|
||||||
|
private:
|
||||||
|
UINT16 musStartX;
|
||||||
|
UINT16 musStartY;
|
||||||
|
|
||||||
|
UINT16 mColorLine; // color of boundary lines
|
||||||
|
UINT16 mColorLineShadow; // color of boundary line shadows
|
||||||
|
UINT16 mColorMarked; // color of marked entries
|
||||||
|
UINT16 mColorHighLight; // color of bar highlighting
|
||||||
|
};
|
||||||
|
|
||||||
// the maximum number of entries that can be shown at once. Increase requires recompilation!
|
// the maximum number of entries that can be shown at once. Increase requires recompilation!
|
||||||
#define DROPDOWN_REGIONS 8
|
#define DROPDOWN_REGIONS 8
|
||||||
|
|
||||||
@@ -47,7 +103,7 @@ enum definedDropDowns
|
|||||||
*
|
*
|
||||||
* Apart from that, you will only have to implement void SetRefresh(). This function is necessary to refresh the screen after the popup-section is closed, otherwise it will still be shown.
|
* Apart from that, you will only have to implement void SetRefresh(). This function is necessary to refresh the screen after the popup-section is closed, otherwise it will still be shown.
|
||||||
*
|
*
|
||||||
* As this class refreshes itself once you have properly implemented SetRefresh(), you can even move the box aroun onscreen, it will properly refresh, so moving it with a mouse will be possible
|
* As this class refreshes itself once you have properly implemented SetRefresh(), you can even move the box around onscreen, it will properly refresh, so moving it with a mouse will be possible
|
||||||
*
|
*
|
||||||
* You can get an instance by calling DropDownTemplate<int X>.Create(UINT16 usX, UINT16 usY);, the constructor itself is private (singleton).
|
* You can get an instance by calling DropDownTemplate<int X>.Create(UINT16 usX, UINT16 usY);, the constructor itself is private (singleton).
|
||||||
|
|
||||||
@@ -61,7 +117,7 @@ enum definedDropDowns
|
|||||||
...
|
...
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class DropDownBase
|
class DropDownBase : public WidgetBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DropDownBase();
|
DropDownBase();
|
||||||
@@ -72,7 +128,7 @@ public:
|
|||||||
void Create(UINT16 sX, UINT16 sY);
|
void Create(UINT16 sX, UINT16 sY);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Destroy Dropdown, for example once a webiste isn't displayed anymore
|
* Destroy Dropdown, for example once a website isn't displayed anymore
|
||||||
*/
|
*/
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
@@ -84,7 +140,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Sometimes a refresh inside the class isn't enough - best example is closing the dropdown area, after which the previous background cannot be restored by this class.
|
* Sometimes a refresh inside the class isn't enough - best example is closing the dropdown area, after which the previous background cannot be restored by this class.
|
||||||
* In that case, the background and this class has to be redrawn.
|
* In that case, the background and this class has to be redrawn.
|
||||||
* This function is called internally whenver such a refreh is necessary.
|
* This function is called internally whenever such a refresh is necessary.
|
||||||
* It has to be defined in derived classes and should notify your dialogues to redraw at appropriate times
|
* It has to be defined in derived classes and should notify your dialogues to redraw at appropriate times
|
||||||
*
|
*
|
||||||
* This function has to be implemented!
|
* This function has to be implemented!
|
||||||
@@ -108,26 +164,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetEntries( std::vector<std::pair<INT16, STR16> >& arEntryVec ) { mEntryVector = arEntryVec; }
|
void SetEntries( std::vector<std::pair<INT16, STR16> >& arEntryVec ) { mEntryVector = arEntryVec; }
|
||||||
|
|
||||||
/*
|
|
||||||
* Set Color of boundary line
|
|
||||||
*/
|
|
||||||
void SetColorLine( UINT16 aCol ) { mColorLine = aCol; }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set Color of boundary line shadow
|
|
||||||
*/
|
|
||||||
void SetColorLineShadow( UINT16 aCol ) { mColorLineShadow = aCol; }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set background color of selected entry
|
|
||||||
*/
|
|
||||||
void SetColorMarked( UINT16 aCol ) { mColorMarked = aCol; }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set Color of highlight of the scrollbar mover
|
|
||||||
*/
|
|
||||||
void SetColorHighLight( UINT16 aCol ) { mColorHighLight = aCol; }
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set help text decribing what can be selected
|
* Set help text decribing what can be selected
|
||||||
*/
|
*/
|
||||||
@@ -151,7 +187,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Get right x coordinate
|
* Get right x coordinate
|
||||||
*/
|
*/
|
||||||
UINT16 GetLastX() { return musStartX + GetTotalWidth(); }
|
UINT16 GetLastX() { return GetX() + GetTotalWidth(); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Are we displayed?
|
* Are we displayed?
|
||||||
@@ -210,8 +246,6 @@ private:
|
|||||||
UINT16 musHeight;
|
UINT16 musHeight;
|
||||||
UINT16 musWidth;
|
UINT16 musWidth;
|
||||||
|
|
||||||
UINT16 musStartX;
|
|
||||||
UINT16 musStartY;
|
|
||||||
UINT16 musStartX_Drop;
|
UINT16 musStartX_Drop;
|
||||||
UINT16 musStartY_Drop;
|
UINT16 musStartY_Drop;
|
||||||
UINT16 musScrollAreaX;
|
UINT16 musScrollAreaX;
|
||||||
@@ -225,11 +259,6 @@ private:
|
|||||||
|
|
||||||
UINT16 musFontHeight;
|
UINT16 musFontHeight;
|
||||||
|
|
||||||
UINT16 mColorLine; // color of boundary lines
|
|
||||||
UINT16 mColorLineShadow; // color of boundary line shadows
|
|
||||||
UINT16 mColorMarked; // color of marked entries
|
|
||||||
UINT16 mColorHighLight; // color of bar highlighting
|
|
||||||
|
|
||||||
BOOLEAN mfMouseRegionsCreated;
|
BOOLEAN mfMouseRegionsCreated;
|
||||||
BOOLEAN mfMouseRegionsCreated_Drop;
|
BOOLEAN mfMouseRegionsCreated_Drop;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user