VGUI HTML Screen In Orange Box/IHTMLView.h: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Added syntax highlighting)
m (→‎top: clean up, added deadend tag)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{See also|VGUI HTML Screen In Orange Box/HTMLView.cpp}}
{{Dead end|date=January 2024}}
<source lang="cpp">
<source lang="cpp">
//========= Public Domain 2009, Julian 'Daedalus' Thatcher. =====================//
//========= Public Domain 2009, Julian 'Daedalus' Thatcher. =====================//
Line 60: Line 63:
     panel->SetPos((panel->ScreenWidth()-w)/2,(panel->ScreenHeight()-h)/2)
     panel->SetPos((panel->ScreenWidth()-w)/2,(panel->ScreenHeight()-h)/2)
</source>
</source>
[[Category:Programming]]
[[Category:VGUI]]

Latest revision as of 10:18, 21 January 2024

See also:  VGUI HTML Screen In Orange Box/HTMLView.cpp
Dead End - Icon.png
This article has no Wikipedia icon links to other VDC articles. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024
//========= Public Domain 2009, Julian 'Daedalus' Thatcher. =====================//
//
// Purpose: Header file for HTMLView window
//
//
// $NoKeywords: $
//=============================================================================//

// IHTMLView.h
#include <vgui_controls/Frame.h>
#include <vgui_controls/HTML.h>
// JT: OB
#include <vgui_controls/EntHTML.h>

using namespace vgui;

class IHTMLView
{
public:
	virtual void		Create( vgui::VPANEL parent ) = 0;
	virtual void		Destroy( void ) = 0;
	virtual void		Activate( void ) = 0;
	virtual void		UpdateHTML ( void ) = 0;
};

//CHTMLView_Panel class: Our HTMLView Frame example class
class CHTMLView_Panel : public vgui::Frame
{
	DECLARE_CLASS_SIMPLE(CHTMLView_Panel, vgui::Frame); 
	//CHTMLView_Panel : This Class / vgui::Frame : BaseClass

	CHTMLView_Panel(vgui::VPANEL parent); 	// Constructor
	~CHTMLView_Panel(){};					// Destructor

protected:
	//VGUI overrides:
	virtual void OnTick();
	virtual void OnCommand(const char* pcCommand);

private:
	//Other used VGUI control Elements:
	vgui::Button *m_exit;
	vgui::Image  *m_img;

public:
	EntHTML   *m_HTML;
};

extern IHTMLView* htmlview;

#define CenterThisPanelOnScreen()\
    int x,w,h;\
    GetBounds(x,x,w,h);\
    SetPos((ScreenWidth()-w)/2,(ScreenHeight()-h)/2)

#define CenterPanelOnScreen(panel)\
    int x,w,h;\
    panel->GetBounds(x,x,w,h);\
    panel->SetPos((panel->ScreenWidth()-w)/2,(panel->ScreenHeight()-h)/2)