fill in the validated variables

This commit is contained in:
AzaezelX 2025-03-09 11:53:23 -05:00
parent fa760fa746
commit f633ef3a3d
184 changed files with 1359 additions and 1216 deletions

View file

@ -112,14 +112,14 @@ void GuiAutoScrollCtrl::initPersistFields()
addField( "scrollDirection", TYPEID< Direction >(), Offset( mDirection, GuiAutoScrollCtrl ),
"Direction in which the child control is moved." );
addField( "startDelay", TypeF32, Offset( mStartDelay, GuiAutoScrollCtrl ),
addFieldV( "startDelay", TypeRangedF32, Offset( mStartDelay, GuiAutoScrollCtrl ), &CommonValidators::PositiveFloat,
"Seconds to wait before starting to scroll." );
addField( "resetDelay", TypeF32, Offset( mResetDelay, GuiAutoScrollCtrl ),
addFieldV( "resetDelay", TypeRangedF32, Offset( mResetDelay, GuiAutoScrollCtrl ), &CommonValidators::PositiveFloat,
"Seconds to wait after scrolling completes before resetting and starting over.\n\n"
"@note Only takes effect if #isLooping is true." );
addField( "childBorder", TypeS32, Offset( mChildBorder, GuiAutoScrollCtrl ),
addFieldV( "childBorder", TypeRangedS32, Offset( mChildBorder, GuiAutoScrollCtrl ), &CommonValidators::PositiveInt,
"Padding to put around child control (in pixels)." );
addField( "scrollSpeed", TypeF32, Offset( mScrollSpeed, GuiAutoScrollCtrl ),
addFieldV( "scrollSpeed", TypeRangedF32, Offset( mScrollSpeed, GuiAutoScrollCtrl ), &CommonValidators::PositiveFloat,
"Scrolling speed in pixels per second." );
addField( "isLooping", TypeBool, Offset( mIsLooping, GuiAutoScrollCtrl ),
"If true, the scrolling will reset to the beginning once completing a cycle." );

View file

@ -56,15 +56,15 @@ void GuiControlArrayControl::initPersistFields()
docsURL;
addGroup( "Array" );
addField( "colCount", TypeS32, Offset(mCols, GuiControlArrayControl),
addFieldV( "colCount", TypeRangedS32, Offset(mCols, GuiControlArrayControl), &CommonValidators::PositiveInt,
"Number of colums in the array." );
addField( "colSizes", TypeS32Vector, Offset(mColumnSizes, GuiControlArrayControl),
"Size of each individual column." );
addField( "rowSize", TypeS32, Offset(mRowSize, GuiControlArrayControl),
addFieldV( "rowSize", TypeRangedS32, Offset(mRowSize, GuiControlArrayControl), &CommonValidators::PositiveInt,
"Heigth of a row in the array." );
addField( "rowSpacing", TypeS32, Offset(mRowSpacing, GuiControlArrayControl),
addFieldV( "rowSpacing", TypeRangedS32, Offset(mRowSpacing, GuiControlArrayControl), &CommonValidators::PositiveInt,
"Padding to put between rows." );
addField( "colSpacing", TypeS32, Offset(mColSpacing, GuiControlArrayControl),
addFieldV( "colSpacing", TypeRangedS32, Offset(mColSpacing, GuiControlArrayControl), &CommonValidators::PositiveInt,
"Padding to put between columns." );
endGroup( "Array" );

View file

@ -215,6 +215,9 @@ void GuiDragAndDropControl::onMouseDragged( const GuiEvent& event )
// Allow the control under the drag to react to a potential drop
GuiControl* enterTarget = findDragTarget( event.mousePoint, "onControlDragEnter" );
if(enterTarget != nullptr)
Con::printf("GuiDragAndDropControl::onMouseDragged() - enterTarget: %d", enterTarget->getId());
if( mLastTarget != enterTarget )
{
if( mLastTarget )

View file

@ -98,28 +98,28 @@ ConsoleDocClass( GuiDynamicCtrlArrayControl,
void GuiDynamicCtrlArrayControl::initPersistFields()
{
docsURL;
addField( "colCount", TypeS32, Offset( mCols, GuiDynamicCtrlArrayControl ),
addFieldV( "colCount", TypeRangedS32, Offset( mCols, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt,
"Number of columns the child controls have been arranged into. This "
"value is calculated automatically when children are added, removed or "
"resized; writing it directly has no effect." );
addField( "colSize", TypeS32, Offset( mColSize, GuiDynamicCtrlArrayControl ),
addFieldV( "colSize", TypeRangedS32, Offset( mColSize, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt,
"Width of each column. If <i>autoCellSize</i> is set, this will be "
"calculated automatically from the widest child control" );
addField( "rowCount", TypeS32, Offset( mRows, GuiDynamicCtrlArrayControl ),
addFieldV( "rowCount", TypeRangedS32, Offset( mRows, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt,
"Number of rows the child controls have been arranged into. This value "
"is calculated automatically when children are added, removed or resized; "
"writing it directly has no effect." );
addField( "rowSize", TypeS32, Offset( mRowSize, GuiDynamicCtrlArrayControl ),
addFieldV( "rowSize", TypeRangedS32, Offset( mRowSize, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt,
"Height of each row. If <i>autoCellSize</i> is set, this will be "
"calculated automatically from the tallest child control" );
addField( "rowSpacing", TypeS32, Offset( mRowSpacing, GuiDynamicCtrlArrayControl ),
addFieldV( "rowSpacing", TypeRangedS32, Offset( mRowSpacing, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt,
"Spacing between rows" );
addField( "colSpacing", TypeS32, Offset( mColSpacing, GuiDynamicCtrlArrayControl ),
addFieldV( "colSpacing", TypeRangedS32, Offset( mColSpacing, GuiDynamicCtrlArrayControl ), &CommonValidators::PositiveInt,
"Spacing between columns" );
addField( "frozen", TypeBool, Offset( mFrozen, GuiDynamicCtrlArrayControl ),

View file

@ -92,7 +92,7 @@ void GuiFrameSetCtrl::initPersistFields()
addField( "rows", TypeS32Vector, Offset(mRowOffsets, GuiFrameSetCtrl),
"A vector of row offsets (determines the height of each row)." );
addField( "borderWidth", TypeS32, Offset(mFramesetDetails.mBorderWidth, GuiFrameSetCtrl),
addFieldV( "borderWidth", TypeRangedS32, Offset(mFramesetDetails.mBorderWidth, GuiFrameSetCtrl), &CommonValidators::PositiveInt,
"Width of interior borders between cells in pixels." );
addField( "borderColor", TypeColorI, Offset(mFramesetDetails.mBorderColor, GuiFrameSetCtrl),
@ -111,7 +111,7 @@ void GuiFrameSetCtrl::initPersistFields()
"If true, row and column offsets are automatically scaled to match the "
"new extents when the control is resized." );
addField( "fudgeFactor", TypeS32, Offset(mFudgeFactor, GuiFrameSetCtrl),
addFieldV( "fudgeFactor", TypeRangedS32, Offset(mFudgeFactor, GuiFrameSetCtrl), &CommonValidators::PositiveInt,
"Offset for row and column dividers in pixels" );
Parent::initPersistFields();

View file

@ -99,7 +99,7 @@ void GuiRolloutCtrl::initPersistFields()
"Text label to display on the rollout header." );
addField( "margin", TypeRectI, Offset( mMargin, GuiRolloutCtrl ),
"Margin to put around child control." );
addField( "defaultHeight", TypeS32, Offset( mDefaultHeight, GuiRolloutCtrl ),
addFieldV( "defaultHeight", TypeRangedS32, Offset( mDefaultHeight, GuiRolloutCtrl ), &CommonValidators::PositiveInt,
"Default height of the client area. This is used when no child control has been added to the rollout." );
addProtectedField( "expanded", TypeBool, Offset( mIsExpanded, GuiRolloutCtrl), &setExpanded, &defaultProtectedGetFn,
"The current rollout expansion state." );

View file

@ -111,7 +111,7 @@ void GuiScrollCtrl::initPersistFields()
addField( "constantThumbHeight", TypeBool, Offset(mUseConstantHeightThumb, GuiScrollCtrl));
addField( "childMargin", TypePoint2I, Offset(mChildMargin, GuiScrollCtrl),
"Padding region to put around child contents." );
addField( "mouseWheelScrollSpeed", TypeS32, Offset(mScrollAnimSpeed, GuiScrollCtrl),
addFieldV( "mouseWheelScrollSpeed", TypeRangedS32, Offset(mScrollAnimSpeed, GuiScrollCtrl), &CommonValidators::PositiveInt,
"Pixels/Tick - if not positive then mousewheel scrolling occurs instantly (like other scrolling).");
endGroup( "Scrolling" );

View file

@ -118,14 +118,14 @@ void GuiSplitContainer::initPersistFields()
addField( "orientation", TYPEID< Orientation >(), Offset( mOrientation, GuiSplitContainer),
"Whether to split between top and bottom (horizontal) or between left and right (vertical)." );
addField( "splitterSize", TypeS32, Offset( mSplitterSize, GuiSplitContainer),
addFieldV( "splitterSize", TypeRangedS32, Offset( mSplitterSize, GuiSplitContainer), &CommonValidators::PositiveInt,
"Width of the splitter bar between the two sides. Default is 2." );
addField( "splitPoint", TypePoint2I, Offset( mSplitPoint, GuiSplitContainer),
"Point on control through which the splitter goes.\n\n"
"Changed relatively if size of control changes." );
addField( "fixedPanel", TYPEID< FixedPanel >(), Offset( mFixedPanel, GuiSplitContainer),
"Which (if any) side of the splitter to keep at a fixed size." );
addField( "fixedSize", TypeS32, Offset( mFixedPanelSize, GuiSplitContainer),
addFieldV( "fixedSize", TypeRangedS32, Offset( mFixedPanelSize, GuiSplitContainer), &CommonValidators::PositiveInt,
"Width of the fixed panel specified by #fixedPanel (if any)." );
endGroup( "Splitter" );

View file

@ -110,4 +110,4 @@ DefineEnumType( GuiSplitFixedPanel );
/// @}
#endif // _GUI_SPLTCONTAINER_H_
#endif // _GUI_SPLTCONTAINER_H_

View file

@ -110,7 +110,7 @@ void GuiStackControl::initPersistFields()
"Controls the type of vertical stacking to use (<i>Top to Bottom</i> or "
"<i>Bottom to Top</i>)" );
addField( "padding", TypeS32, Offset(mPadding, GuiStackControl),
addFieldV( "padding", TypeRangedS32, Offset(mPadding, GuiStackControl), &CommonValidators::PositiveInt,
"Distance (in pixels) between stacked child controls." );
addField( "dynamicSize", TypeBool, Offset(mDynamicSize, GuiStackControl),

View file

@ -27,6 +27,7 @@
#include "gui/controls/guiPopUpCtrl.h"
#include "gui/core/guiDefaultControlRender.h"
#include "gfx/gfxDrawUtil.h"
#include "console/typeValidators.h"
IMPLEMENT_CONOBJECT( GuiTabBookCtrl );
@ -107,19 +108,19 @@ void GuiTabBookCtrl::initPersistFields()
addField( "tabPosition", TYPEID< TabPosition >(), Offset( mTabPosition, GuiTabBookCtrl ),
"Where to place the tab page headers." );
addField( "tabMargin", TypeS32, Offset( mTabMargin, GuiTabBookCtrl ),
addFieldV( "tabMargin", TypeRangedS32, Offset( mTabMargin, GuiTabBookCtrl ), &CommonValidators::PositiveInt,
"Spacing to put between individual tab page headers." );
addField( "minTabWidth", TypeS32, Offset( mMinTabWidth, GuiTabBookCtrl ),
addFieldV( "minTabWidth", TypeRangedS32, Offset( mMinTabWidth, GuiTabBookCtrl ), &CommonValidators::PositiveInt,
"Minimum width allocated to a tab page header." );
addField( "tabHeight", TypeS32, Offset( mTabHeight, GuiTabBookCtrl ),
addFieldV( "tabHeight", TypeRangedS32, Offset( mTabHeight, GuiTabBookCtrl ), &CommonValidators::PositiveInt,
"Height of tab page headers." );
addField( "allowReorder", TypeBool, Offset( mAllowReorder, GuiTabBookCtrl ),
"Whether reordering tabs with the mouse is allowed." );
addField( "defaultPage", TypeS32, Offset( mDefaultPageNum, GuiTabBookCtrl ),
addFieldV( "defaultPage", TypeRangedS32, Offset( mDefaultPageNum, GuiTabBookCtrl ), &CommonValidators::NegDefaultInt,
"Index of page to select on first onWake() call (-1 to disable)." );
addProtectedField( "selectedPage", TypeS32, Offset( mSelectedPageNum, GuiTabBookCtrl ),
&_setSelectedPage, &defaultProtectedGetFn,
addProtectedFieldV( "selectedPage", TypeRangedS32, Offset( mSelectedPageNum, GuiTabBookCtrl ),
&_setSelectedPage, &defaultProtectedGetFn, &CommonValidators::PositiveInt,
"Index of currently selected page." );
addField( "frontTabPadding", TypeS32, Offset( mFrontTabPadding, GuiTabBookCtrl ),
@ -320,6 +321,15 @@ bool GuiTabBookCtrl::resize(const Point2I &newPosition, const Point2I &newExtent
bool result = Parent::resize( newPosition, newExtent );
calculatePageTabs();
for (S32 i = 0; i < mPages.size(); i++)
{
const TabHeaderInfo& info = mPages[i];
GuiTabPageCtrl* page = info.Page;
if(page->getFitBook())
fitPage(page);
}
return result;
}
@ -430,6 +440,18 @@ void GuiTabBookCtrl::onMouseMove(const GuiEvent &event)
void GuiTabBookCtrl::onMouseLeave( const GuiEvent &event )
{
Parent::onMouseLeave( event );
if(mDraggingTab)
{
//we dragged the tab out, so do something about that
GuiTabPageCtrl* selectedPage = NULL;
if (mSelectedPageNum != -1)
selectedPage = mPages[mSelectedPageNum].Page;
mDraggingTab = false;
Con::executef(this, "onTabDraggedOut", selectedPage->getIdString());
}
mHoverTab = NULL;
}

View file

@ -143,7 +143,7 @@ void GuiWindowCtrl::initPersistFields()
"Whether the window can be resized horizontally." );
addField( "resizeHeight", TypeBool, Offset( mResizeHeight, GuiWindowCtrl ),
"Whether the window can be resized vertically." );
addField("resizeMargin", TypeF32, Offset(mResizeMargin, GuiWindowCtrl),
addFieldV("resizeMargin", TypeRangedF32, Offset(mResizeMargin, GuiWindowCtrl), &CommonValidators::PositiveFloat,
"Margin along the window edge to allow grabbing.");
addField( "canMove", TypeBool, Offset( mCanMove, GuiWindowCtrl ),
"Whether the window can be moved by dragging its titlebar." );