From Nils' UI work

Adds ability to control button margin of IconButtons
Adds ability to define button offset of window controls
Add mouse drag callback for window controls
Tweaks colors of gui slider control
Tweak to line split for text edit slider bitmap control
Tweaks to colors for text edit slider control
Tweaks to colors for Edit control
Tweaks to default menubar height
This commit is contained in:
Areloch 2023-09-04 22:50:45 -05:00
parent a445a43646
commit d0f914b3e6
9 changed files with 53 additions and 24 deletions

View file

@ -68,6 +68,8 @@ IMPLEMENT_CALLBACK( GuiWindowCtrl, onRestore, void, (), (),
"Called when the window is restored from minimized, maximized, or collapsed state." );
IMPLEMENT_CALLBACK(GuiWindowCtrl, onResize, void, (S32 posX, S32 posY, S32 width, S32 height), (0, 0, 0, 0),
"Called when the window is resized in a regular manner by mouse manipulation.");
IMPLEMENT_CALLBACK(GuiWindowCtrl, onMouseDragged, void, (), (),
"Called when the height has changed.");
//-----------------------------------------------------------------------------
@ -87,7 +89,8 @@ GuiWindowCtrl::GuiWindowCtrl()
mCollapseGroup(-1),
mCollapseGroupNum(-1),
mIsCollapsed(false),
mIsMouseResizing(false)
mIsMouseResizing(false),
mButtonOffset(0, 3)
{
// mTitleHeight will change in instanciation most likely...
mTitleHeight = 24;
@ -154,6 +157,8 @@ void GuiWindowCtrl::initPersistFields()
"Script code to execute when the window is closed." );
addField( "edgeSnap", TypeBool, Offset( mEdgeSnap,GuiWindowCtrl ),
"If true, the window will snap to the edges of other windows when moved close to them." );
addField( "buttonOffset", TypePoint2I, Offset (mButtonOffset, GuiWindowCtrl),
"Margin between window edge and the button(s).");
endGroup( "Window" );
@ -1019,6 +1024,9 @@ void GuiWindowCtrl::onMouseDragged(const GuiEvent &event)
}
else // Normal window sizing functionality
resize(newPosition, newExtent);
// Add a callback for the GUI scripts
onMouseDragged_callback();
}
//-----------------------------------------------------------------------------
@ -1409,7 +1417,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
}
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, offset + mCloseButton.point, mBitmapBounds[bmp]);
drawUtil->drawBitmapSR(mTextureObject, mButtonOffset + offset + mCloseButton.point, mBitmapBounds[bmp]);
}
// Draw the maximize button
@ -1428,7 +1436,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
}
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR( mTextureObject, offset + mMaximizeButton.point, mBitmapBounds[bmp] );
drawUtil->drawBitmapSR( mTextureObject, mButtonOffset + offset + mMaximizeButton.point, mBitmapBounds[bmp] );
}
// Draw the minimize button
@ -1447,7 +1455,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
}
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR( mTextureObject, offset + mMinimizeButton.point, mBitmapBounds[bmp] );
drawUtil->drawBitmapSR( mTextureObject, mButtonOffset + offset + mMinimizeButton.point, mBitmapBounds[bmp] );
}
if( !mMinimized )