no message
This was SVN commit r1106.
This commit is contained in:
parent
f57e5ab737
commit
ab63c17678
38
source/gui/CImage.cpp
Executable file
38
source/gui/CImage.cpp
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
CImage
|
||||||
|
by Gustav Larsson
|
||||||
|
gee@pyro.nu
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precompiled.h"
|
||||||
|
#include "GUI.h"
|
||||||
|
#include "CImage.h"
|
||||||
|
|
||||||
|
#include "ogl.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Constructor / Destructor
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
CImage::CImage()
|
||||||
|
{
|
||||||
|
AddSetting(GUIST_CStr, "sprite");
|
||||||
|
}
|
||||||
|
|
||||||
|
CImage::~CImage()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CImage::Draw()
|
||||||
|
{
|
||||||
|
if (GetGUI())
|
||||||
|
{
|
||||||
|
float bz = GetBufferedZ();
|
||||||
|
|
||||||
|
CStr sprite;
|
||||||
|
GUI<CStr>::GetSetting(this, "sprite", sprite);
|
||||||
|
|
||||||
|
GetGUI()->DrawSprite(sprite, bz, m_CachedActualSize);
|
||||||
|
}
|
||||||
|
}
|
65
source/gui/CImage.h
Executable file
65
source/gui/CImage.h
Executable file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
GUI Object - Image object
|
||||||
|
by Gustav Larsson
|
||||||
|
gee@pyro.nu
|
||||||
|
|
||||||
|
--Overview--
|
||||||
|
|
||||||
|
GUI Object for just drawing a sprite.
|
||||||
|
|
||||||
|
--More info--
|
||||||
|
|
||||||
|
Check GUI.h
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CImage_H
|
||||||
|
#define CImage_H
|
||||||
|
|
||||||
|
//--------------------------------------------------------
|
||||||
|
// Includes / Compiler directives
|
||||||
|
//--------------------------------------------------------
|
||||||
|
#include "GUI.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------
|
||||||
|
// Macros
|
||||||
|
//--------------------------------------------------------
|
||||||
|
|
||||||
|
//--------------------------------------------------------
|
||||||
|
// Types
|
||||||
|
//--------------------------------------------------------
|
||||||
|
|
||||||
|
//--------------------------------------------------------
|
||||||
|
// Declarations
|
||||||
|
//--------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Gustav Larsson
|
||||||
|
*
|
||||||
|
* Object just for drawing a sprite. Like CText, without the
|
||||||
|
* possibility to draw text.
|
||||||
|
*
|
||||||
|
* Created, because I've seen the user being indecisive about
|
||||||
|
* what control to use in these situations. I've seen button
|
||||||
|
* without functionality used, and that is a lot of unnecessary
|
||||||
|
* overhead. That's why I thought I'd go with an intuitive
|
||||||
|
* control.
|
||||||
|
*
|
||||||
|
* @see IGUIObject
|
||||||
|
*/
|
||||||
|
class CImage : public IGUIObject
|
||||||
|
{
|
||||||
|
GUI_OBJECT(CImage)
|
||||||
|
|
||||||
|
public:
|
||||||
|
CImage();
|
||||||
|
virtual ~CImage();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* Draws the Image
|
||||||
|
*/
|
||||||
|
virtual void Draw();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -69,7 +69,7 @@ void CText::SetupText()
|
|||||||
GUI<CGUIString>::GetSetting(this, "caption", caption);
|
GUI<CGUIString>::GetSetting(this, "caption", caption);
|
||||||
GUI<bool>::GetSetting(this, "scrollbar", scrollbar);
|
GUI<bool>::GetSetting(this, "scrollbar", scrollbar);
|
||||||
|
|
||||||
int width = m_CachedActualSize.GetWidth();
|
int width = (int)m_CachedActualSize.GetWidth();
|
||||||
// remove scrollbar if applicable
|
// remove scrollbar if applicable
|
||||||
if (scrollbar && GetScrollBar(0).GetStyle())
|
if (scrollbar && GetScrollBar(0).GetStyle())
|
||||||
width -= GetScrollBar(0).GetStyle()->m_Width;
|
width -= GetScrollBar(0).GetStyle()->m_Width;
|
||||||
@ -83,7 +83,7 @@ void CText::SetupText()
|
|||||||
if (scrollbar)
|
if (scrollbar)
|
||||||
{
|
{
|
||||||
GetScrollBar(0).SetScrollRange( m_GeneratedTexts[0]->m_Size.cy );
|
GetScrollBar(0).SetScrollRange( m_GeneratedTexts[0]->m_Size.cy );
|
||||||
GetScrollBar(0).SetScrollSpace( m_CachedActualSize.GetHeight() );
|
GetScrollBar(0).SetScrollSpace( (int)m_CachedActualSize.GetHeight() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +106,8 @@ void CText::HandleMessage(const SGUIMessage &Message)
|
|||||||
Message.value == CStr("absolute")))
|
Message.value == CStr("absolute")))
|
||||||
{
|
{
|
||||||
|
|
||||||
GetScrollBar(0).SetX( m_CachedActualSize.right );
|
GetScrollBar(0).SetX( (int)m_CachedActualSize.right );
|
||||||
GetScrollBar(0).SetY( m_CachedActualSize.top );
|
GetScrollBar(0).SetY( (int)m_CachedActualSize.top );
|
||||||
GetScrollBar(0).SetZ( GetBufferedZ() );
|
GetScrollBar(0).SetZ( GetBufferedZ() );
|
||||||
GetScrollBar(0).SetLength( m_CachedActualSize.bottom - m_CachedActualSize.top );
|
GetScrollBar(0).SetLength( m_CachedActualSize.bottom - m_CachedActualSize.top );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user