mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-22 06:06:50 +00:00
arm64 : fix vgui2 VPAMEL in messagemap
This commit is contained in:
parent
0499fde751
commit
3bc519aecf
@ -135,7 +135,7 @@ int BuyPresetListBox::computeVPixelsNeeded( void )
|
||||
/**
|
||||
* Adds an item to the end of the listbox. UserData is assumed to be a pointer that can be freed by the listbox if non-NULL.
|
||||
*/
|
||||
int BuyPresetListBox::AddItem( vgui::Panel *panel, void * userData )
|
||||
int BuyPresetListBox::AddItem( vgui::Panel *panel, IBuyPresetListBoxUserData * userData )
|
||||
{
|
||||
assert(panel);
|
||||
|
||||
@ -192,7 +192,7 @@ Panel * BuyPresetListBox::GetItemPanel(int index) const
|
||||
/**
|
||||
* Returns the userData in the given index, or NULL
|
||||
*/
|
||||
void * BuyPresetListBox::GetItemUserData(int index)
|
||||
auto BuyPresetListBox::GetItemUserData(int index) -> IBuyPresetListBoxUserData *
|
||||
{
|
||||
if ( index < 0 || index >= m_items.Count() )
|
||||
{
|
||||
@ -206,7 +206,7 @@ void * BuyPresetListBox::GetItemUserData(int index)
|
||||
/**
|
||||
* Sets the userData in the given index
|
||||
*/
|
||||
void BuyPresetListBox::SetItemUserData( int index, void * userData )
|
||||
void BuyPresetListBox::SetItemUserData( int index, IBuyPresetListBoxUserData * userData )
|
||||
{
|
||||
if ( index < 0 || index >= m_items.Count() )
|
||||
return;
|
||||
|
@ -27,14 +27,21 @@ public:
|
||||
BuyPresetListBox( vgui::Panel *parent, char const *panelName );
|
||||
~BuyPresetListBox();
|
||||
|
||||
virtual int AddItem( vgui::Panel *panel, void * userData ); ///< Adds an item to the end of the listbox. UserData is assumed to be a pointer that can be freed by the listbox if non-NULL.
|
||||
class IBuyPresetListBoxUserData
|
||||
{
|
||||
protected:
|
||||
friend BuyPresetListBox;
|
||||
virtual ~IBuyPresetListBoxUserData() {};
|
||||
};
|
||||
|
||||
virtual int AddItem( vgui::Panel *panel, IBuyPresetListBoxUserData *userData ); ///< Adds an item to the end of the listbox. UserData is assumed to be a pointer that will be deleted by the listbox if non-NULL.
|
||||
virtual int GetItemCount( void ) const; ///< Returns the number of items in the listbox
|
||||
void SwapItems( int index1, int index2 ); ///< Exchanges two items in the listbox
|
||||
void MakeItemVisible( int index ); ///< Try to ensure that the given index is visible
|
||||
|
||||
vgui::Panel * GetItemPanel( int index ) const; ///< Returns the panel in the given index, or NULL
|
||||
void * GetItemUserData( int index ); ///< Returns the userData in the given index, or NULL
|
||||
void SetItemUserData( int index, void * userData ); ///< Sets the userData in the given index
|
||||
IBuyPresetListBoxUserData * GetItemUserData( int index ); ///< Returns the userData in the given index, or NULL
|
||||
void SetItemUserData( int index, IBuyPresetListBoxUserData * userData ); ///< Sets the userData in the given index
|
||||
|
||||
virtual void RemoveItem( int index ); ///< Removes an item from the table (changing the indices of all following items), deleting the panel and userData
|
||||
virtual void DeleteAllItems(); ///< clears the listbox, deleting all panels and userData
|
||||
@ -60,7 +67,7 @@ private:
|
||||
typedef struct dataitem_s
|
||||
{
|
||||
vgui::Panel *panel;
|
||||
void * userData;
|
||||
IBuyPresetListBoxUserData * userData;
|
||||
} DataItem;
|
||||
CUtlVector< DataItem > m_items;
|
||||
|
||||
|
@ -633,7 +633,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
MESSAGE_FUNC_INT( OnCursorEnteredMenuItem, "CursorEnteredMenuItem", VPanel);
|
||||
MESSAGE_FUNC_HANDLE( OnCursorEnteredMenuItem, "CursorEnteredMenuItem", menuItem);
|
||||
|
||||
private:
|
||||
CFooterPanel *m_pConsoleFooter;
|
||||
@ -644,9 +644,8 @@ private:
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Respond to cursor entering a menuItem.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CGameMenu::OnCursorEnteredMenuItem(int VPanel)
|
||||
void CGameMenu::OnCursorEnteredMenuItem(VPANEL menuItem)
|
||||
{
|
||||
VPANEL menuItem = (VPANEL)VPanel;
|
||||
MenuItem *item = static_cast<MenuItem *>(ipanel()->GetPanel(menuItem, GetModuleName()));
|
||||
KeyValues *pCommand = item->GetCommand();
|
||||
if ( !pCommand->GetFirstSubKey() )
|
||||
@ -655,7 +654,7 @@ void CGameMenu::OnCursorEnteredMenuItem(int VPanel)
|
||||
if ( !pszCmd || !pszCmd[0] )
|
||||
return;
|
||||
|
||||
BaseClass::OnCursorEnteredMenuItem( VPanel );
|
||||
BaseClass::OnCursorEnteredMenuItem( menuItem );
|
||||
}
|
||||
|
||||
static CBackgroundMenuButton* CreateMenuButton( CBasePanel *parent, const char *panelName, const wchar_t *panelText )
|
||||
|
@ -94,6 +94,7 @@ public:
|
||||
virtual const char *GetResourceName(void) { return m_pResourceName; }
|
||||
|
||||
virtual void PanelAdded(Panel* panel);
|
||||
virtual void PanelRemoved(Panel* panel);
|
||||
|
||||
virtual bool MousePressed(MouseCode code,Panel* panel);
|
||||
virtual bool MouseReleased(MouseCode code,Panel* panel);
|
||||
|
@ -295,8 +295,8 @@ protected:
|
||||
|
||||
void SetCurrentlySelectedItem(MenuItem *item);
|
||||
void SetCurrentlySelectedItem(int itemID);
|
||||
MESSAGE_FUNC_INT( OnCursorEnteredMenuItem, "CursorEnteredMenuItem", VPanel);
|
||||
MESSAGE_FUNC_INT( OnCursorExitedMenuItem, "CursorExitedMenuItem", VPanel);
|
||||
MESSAGE_FUNC_HANDLE( OnCursorEnteredMenuItem, "CursorEnteredMenuItem", menuItem);
|
||||
MESSAGE_FUNC_HANDLE( OnCursorExitedMenuItem, "CursorExitedMenuItem", menuItem);
|
||||
|
||||
void MoveAlongMenuItemList(int direction, int loopCount);
|
||||
|
||||
|
@ -46,7 +46,7 @@ class __virtual_inheritance Panel;
|
||||
#else
|
||||
class Panel;
|
||||
#endif
|
||||
typedef unsigned int VPANEL;
|
||||
typedef uintp VPANEL;
|
||||
|
||||
typedef void (Panel::*MessageFunc_t)(void);
|
||||
|
||||
@ -222,6 +222,7 @@ public: \
|
||||
#define MESSAGE_FUNC_PTR_WCHARPTR( name, scriptname, p1, p2 ) _MessageFuncCommon( name, scriptname, 2, vgui::DATATYPE_PTR, #p1, vgui::DATATYPE_CONSTWCHARPTR, #p2 ); virtual void name( vgui::Panel *p1, const wchar_t *p2 )
|
||||
#define MESSAGE_FUNC_HANDLE_WCHARPTR( name, scriptname, p1, p2 ) _MessageFuncCommon( name, scriptname, 2, vgui::DATATYPE_HANDLE, #p1, vgui::DATATYPE_CONSTWCHARPTR, #p2 ); virtual void name( vgui::VPANEL p1, const wchar_t *p2 )
|
||||
#define MESSAGE_FUNC_CHARPTR_CHARPTR( name, scriptname, p1, p2 ) _MessageFuncCommon( name, scriptname, 2, vgui::DATATYPE_CONSTCHARPTR, #p1, vgui::DATATYPE_CONSTCHARPTR, #p2 ); virtual void name( const char *p1, const char *p2 )
|
||||
#define MESSAGE_FUNC_HANDLE_HANDLE( name, scriptname, p1, p2 ) _MessageFuncCommon( name, scriptname, 2, vgui::DATATYPE_HANDLE, #p1, vgui::DATATYPE_HANDLE, #p2 ); virtual void name( vgui::VPANEL p1, vgui::VPANEL p2 )
|
||||
|
||||
// unlimited parameters (passed in the whole KeyValues)
|
||||
#define MESSAGE_FUNC_PARAMS( name, scriptname, p1 ) _MessageFuncCommon( name, scriptname, 1, vgui::DATATYPE_KEYVALUES, NULL, 0, 0 ); virtual void name( KeyValues *p1 )
|
||||
|
@ -27,16 +27,21 @@ class PHandle
|
||||
public:
|
||||
PHandle() : m_iPanelID(INVALID_PANEL) {} //m_iSerialNumber(0), m_pListEntry(0) {}
|
||||
|
||||
Panel *Get();
|
||||
Panel *Get() const;
|
||||
Panel *Set( Panel *pPanel );
|
||||
Panel *Set( HPanel hPanel );
|
||||
|
||||
operator Panel *() { return Get(); }
|
||||
operator Panel *() const { return Get(); }
|
||||
Panel * operator ->() { return Get(); }
|
||||
Panel * operator = (Panel *pPanel) { return Set(pPanel); }
|
||||
|
||||
bool operator == (Panel *pPanel) { return (Get() == pPanel); }
|
||||
operator bool () { return Get() != 0; }
|
||||
//bool operator == (Panel *pPanel) { return (Get() == pPanel); }
|
||||
operator bool () const { return Get() != 0; }
|
||||
|
||||
friend bool operator == ( const PHandle &p1, const PHandle &p2 )
|
||||
{
|
||||
return p1.m_iPanelID == p2.m_iPanelID;
|
||||
}
|
||||
|
||||
private:
|
||||
HPanel m_iPanelID;
|
||||
|
@ -673,7 +673,7 @@ protected:
|
||||
protected:
|
||||
virtual void OnChildSettingsApplied( KeyValues *pInResourceData, Panel *pChild );
|
||||
|
||||
MESSAGE_FUNC_ENUM_ENUM( OnRequestFocus, "OnRequestFocus", VPANEL, subFocus, VPANEL, defaultPanel);
|
||||
MESSAGE_FUNC_HANDLE_HANDLE( OnRequestFocus, "OnRequestFocus", subFocus, defaultPanel);
|
||||
MESSAGE_FUNC_INT_INT( OnScreenSizeChanged, "OnScreenSizeChanged", oldwide, oldtall );
|
||||
virtual void *QueryInterface(EInterfaceID id);
|
||||
|
||||
|
@ -869,6 +869,18 @@ void BuildGroup::PanelAdded(Panel *panel)
|
||||
_panelDar.AddToTail(temp);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Add panel the list of panels that are in the build group
|
||||
//-----------------------------------------------------------------------------
|
||||
void BuildGroup::PanelRemoved(Panel *panel)
|
||||
{
|
||||
Assert(panel);
|
||||
|
||||
PHandle temp;
|
||||
temp = panel;
|
||||
_panelDar.FindAndRemove(temp);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: loads the control settings from file
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -2365,9 +2365,8 @@ int Menu::GetCurrentlyHighlightedItem()
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Respond to cursor entering a menuItem.
|
||||
//-----------------------------------------------------------------------------
|
||||
void Menu::OnCursorEnteredMenuItem(int VPanel)
|
||||
void Menu::OnCursorEnteredMenuItem(VPANEL menuItem)
|
||||
{
|
||||
VPANEL menuItem = (VPANEL)VPanel;
|
||||
// if we are in mouse mode
|
||||
if (m_iInputMode == MOUSE)
|
||||
{
|
||||
@ -2389,9 +2388,8 @@ void Menu::OnCursorEnteredMenuItem(int VPanel)
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Respond to cursor exiting a menuItem
|
||||
//-----------------------------------------------------------------------------
|
||||
void Menu::OnCursorExitedMenuItem(int VPanel)
|
||||
void Menu::OnCursorExitedMenuItem(VPANEL menuItem)
|
||||
{
|
||||
VPANEL menuItem = (VPANEL)VPanel;
|
||||
// only care if we are in mouse mode
|
||||
if (m_iInputMode == MOUSE)
|
||||
{
|
||||
|
@ -222,7 +222,7 @@ void MenuItem::OnCursorEntered()
|
||||
// forward the message on to the parent of this menu.
|
||||
KeyValues *msg = new KeyValues ("CursorEnteredMenuItem");
|
||||
// tell the parent this menuitem is the one that was entered so it can highlight it
|
||||
msg->SetInt("VPanel", GetVPanel());
|
||||
msg->SetInt("menuItem", ToHandle() );
|
||||
|
||||
ivgui()->PostMessage(GetVParent(), msg, NULL);
|
||||
}
|
||||
@ -236,7 +236,7 @@ void MenuItem::OnCursorExited()
|
||||
// forward the message on to the parent of this menu.
|
||||
KeyValues *msg = new KeyValues ("CursorExitedMenuItem");
|
||||
// tell the parent this menuitem is the one that was entered so it can unhighlight it
|
||||
msg->SetInt("VPanel", GetVPanel());
|
||||
msg->SetInt("menuItem", ToHandle() );
|
||||
|
||||
ivgui()->PostMessage(GetVParent(), msg, NULL);
|
||||
}
|
||||
|
@ -880,7 +880,7 @@ const char *Panel::GetClassName()
|
||||
{
|
||||
// loop up the panel map name
|
||||
PanelMessageMap *panelMap = GetMessageMap();
|
||||
if ( panelMap )
|
||||
if ( panelMap && panelMap->pfnClassName )
|
||||
{
|
||||
return panelMap->pfnClassName();
|
||||
}
|
||||
@ -3575,7 +3575,7 @@ void Panel::RequestFocus(int direction)
|
||||
//-----------------------------------------------------------------------------
|
||||
void Panel::OnRequestFocus(VPANEL subFocus, VPANEL defaultPanel)
|
||||
{
|
||||
CallParentFunction(new KeyValues("OnRequestFocus", "subFocus", subFocus, "defaultPanel", defaultPanel));
|
||||
CallParentFunction(new KeyValues("OnRequestFocus", "subFocus", ivgui()->PanelToHandle( subFocus ), "defaultPanel", ivgui()->PanelToHandle( defaultPanel )));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -3800,13 +3800,17 @@ void Panel::SetTall(int tall)
|
||||
|
||||
void Panel::SetBuildGroup(BuildGroup* buildGroup)
|
||||
{
|
||||
//TODO: remove from old group
|
||||
|
||||
Assert(buildGroup != NULL);
|
||||
|
||||
_buildGroup = buildGroup;
|
||||
|
||||
_buildGroup->PanelAdded(this);
|
||||
if ( _buildGroup == buildGroup )
|
||||
return;
|
||||
if ( _buildGroup.Get() )
|
||||
{
|
||||
_buildGroup->PanelRemoved( this );
|
||||
}
|
||||
_buildGroup = buildGroup;
|
||||
if ( _buildGroup.Get() )
|
||||
{
|
||||
_buildGroup->PanelAdded(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool Panel::IsBuildGroupEnabled()
|
||||
@ -5134,6 +5138,13 @@ void Panel::OnMessage(const KeyValues *params, VPANEL ifromPanel)
|
||||
VPANEL vp = ivgui()->HandleToPanel( param1->GetInt() );
|
||||
(this->*((MessageFunc_HandleConstCharPtr_t)pMap->func))( vp, param2->GetWString() );
|
||||
}
|
||||
else if ( (DATATYPE_HANDLE == pMap->firstParamType) && (DATATYPE_HANDLE == pMap->secondParamType) )
|
||||
{
|
||||
typedef void (Panel::*MessageFunc_HandleConstCharPtr_t)(VPANEL, VPANEL);
|
||||
VPANEL vp1 = ivgui()->HandleToPanel( param1->GetInt() );
|
||||
VPANEL vp2 = ivgui()->HandleToPanel( param1->GetInt() );
|
||||
(this->*((MessageFunc_HandleConstCharPtr_t)pMap->func))( vp1, vp2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// the message isn't handled
|
||||
@ -5515,7 +5526,7 @@ void Panel::OnDelete()
|
||||
// Purpose: Panel handle implementation
|
||||
// Returns a pointer to a valid panel, NULL if the panel has been deleted
|
||||
//-----------------------------------------------------------------------------
|
||||
Panel *PHandle::Get()
|
||||
Panel *PHandle::Get() const
|
||||
{
|
||||
if (m_iPanelID != INVALID_PANEL)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user