FF Diff Viewer

Comparing 2006 Base SDK to Fortress Forever 2.46

cl_dll/game_controls/mouseoverpanelbutton.h

131415161718
#include #include #include extern vgui::Panel *g_lastPanel;
13141516171819
#include #include #include #include extern vgui::Panel *g_lastPanel;
192021222324252627282930313233343536373839404142434445
//----------------------------------------------------------------------------- // Purpose: Triggers a new panel when the mouse goes over the button // // the new panel has the same dimensions as the passed templatePanel and is of // the same class. // // must at least inherit from vgui::EditablePanel to support LoadControlSettings //----------------------------------------------------------------------------- template class MouseOverButton : public vgui::Button { private: DECLARE_CLASS_SIMPLE( MouseOverButton, vgui::Button ); public: MouseOverButton(vgui::Panel *parent, const char *panelName, T *templatePanel ) : Button( parent, panelName, "MouseOverButton") { m_pPanel = new T( parent, NULL ); m_pPanel ->SetVisible( false ); // copy size&pos from template panel int x,y,wide,tall; templatePanel->GetBounds( x, y, wide, tall ); m_pPanel->SetBounds( x, y, wide, tall ); int px, py;
202122232425262728293031323334353637383940
//----------------------------------------------------------------------------- // Purpose: Triggers a new panel when the mouse goes over the button //----------------------------------------------------------------------------- class MouseOverPanelButton : public vgui::Button { private: DECLARE_CLASS_SIMPLE( MouseOverPanelButton, vgui::Button ); public: MouseOverPanelButton( vgui::Panel *parent, const char *panelName, vgui::Panel *templatePanel ) : vgui::Button( parent, panelName, L"MouseOverPanelButton" ) { m_pPanel = new vgui::HTML( parent, NULL ); m_pPanel->SetVisible( false ); // copy size&pos from template panel int x,y, wide, tall; templatePanel->GetBounds( x, y, wide, tall ); m_pPanel->SetBounds( x, y, wide, tall ); int px, py;
51525354555657585960616263646566676869
} virtual void ShowPage() { if( m_pPanel ) { m_pPanel->SetVisible( true ); m_pPanel->MoveToFront(); g_lastPanel = m_pPanel; } } virtual void HidePage() { if ( m_pPanel ) { m_pPanel->SetVisible( false ); }
46474849505152535455565758596061626364
} void ShowPage( ) { if( m_pPanel ) { m_pPanel->SetVisible( true ); m_pPanel->MoveToFront( ); g_lastPanel = m_pPanel; } } void HidePage( ) { if( m_pPanel ) { m_pPanel->SetVisible( false ); }
7273747576777879808182838485
const char *GetClassPage( const char *className ) { static char classPanel[ _MAX_PATH ]; Q_snprintf( classPanel, sizeof( classPanel ), "classes/%s.res", className); if ( vgui::filesystem()->FileExists( classPanel ) ) { } else if (vgui::filesystem()->FileExists( "classes/default.res" ) ) { Q_snprintf ( classPanel, sizeof( classPanel ), "classes/default.res" ); } else {
6768697071727374757677787980818283848586878889
const char *GetClassPage( const char *className ) { static char classPanel[ _MAX_PATH ]; // --> Mirv: [HACK] Quick way to get round renaming files for now (V SILLY) char name[128]; sprintf( name, GetName() ); if( strlen(name) > 6 ) name[strlen(name) - 6] = 0; Q_snprintf( classPanel, sizeof( classPanel ), "resource/classes/%s.html", /*className*/ name ); // <-- Mirv: [HACK] Quick way to get round renaming files for now (V SILLY) if( vgui::filesystem( )->FileExists( classPanel ) ) { } else if( vgui::filesystem( )->FileExists( "resource/classes/default.html" ) ) { Q_snprintf ( classPanel, sizeof( classPanel ), "resource/classes/default.html" ); } else {
868788899091
return NULL; } return classPanel; }
90919293949596
return NULL; } return classPanel; }
102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
{ BaseClass::ApplySettings( resourceData ); // name, position etc of button is set, now load matching // resource file for associated info panel: m_pPanel->LoadControlSettings( GetClassPage( GetName() ) ); } private: virtual void OnCursorEntered() { BaseClass::OnCursorEntered(); if ( m_pPanel && IsEnabled() ) { if ( g_lastPanel ) { g_lastPanel->SetVisible( false ); } ShowPage(); } } T *m_pPanel; }; #define MouseOverPanelButton MouseOverButton #endif // MOUSEOVERPANELBUTTON_H
107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
{ BaseClass::ApplySettings( resourceData ); char szLocalFile[ _MAX_PATH ]; vgui::filesystem( )->GetLocalPath( GetClassPage( GetName( ) ), szLocalFile, sizeof( szLocalFile ) ); m_pPanel->OpenURL( szLocalFile ); } private: virtual void OnCursorEntered( ) { BaseClass::OnCursorEntered( ); if( m_pPanel && IsEnabled( ) ) { if( g_lastPanel ) { g_lastPanel->SetVisible( false ); } ShowPage( ); } } vgui::HTML *m_pPanel; }; #endif // MOUSEOVERPANELBUTTON_H