summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sound/plugins/oalsound/alsound.h2
-rw-r--r--src/sound/sound.h10
-rw-r--r--src/ui/button.h2
-rw-r--r--src/ui/check.h2
-rw-r--r--src/ui/color.h2
-rw-r--r--src/ui/compass.h2
-rw-r--r--src/ui/control.h14
-rw-r--r--src/ui/displayinfo.h2
-rw-r--r--src/ui/displaytext.h2
-rw-r--r--src/ui/edit.h19
-rw-r--r--src/ui/editvalue.h5
-rw-r--r--src/ui/gauge.h2
-rw-r--r--src/ui/group.h2
-rw-r--r--src/ui/image.h7
-rw-r--r--src/ui/interface.cpp550
-rw-r--r--src/ui/interface.h135
-rw-r--r--src/ui/key.cpp179
-rw-r--r--src/ui/key.h37
-rw-r--r--src/ui/label.cpp51
-rw-r--r--src/ui/label.h24
-rw-r--r--src/ui/list.h118
-rw-r--r--src/ui/map.h14
-rw-r--r--src/ui/scroll.h71
-rw-r--r--src/ui/shortcut.h27
-rw-r--r--src/ui/slider.h75
-rw-r--r--src/ui/target.h27
-rw-r--r--src/ui/window.h73
27 files changed, 547 insertions, 907 deletions
diff --git a/src/sound/plugins/oalsound/alsound.h b/src/sound/plugins/oalsound/alsound.h
index c1cdb81..ec23c86 100644
--- a/src/sound/plugins/oalsound/alsound.h
+++ b/src/sound/plugins/oalsound/alsound.h
@@ -33,7 +33,7 @@
#include "check.h"
-class ALSound : public CSoundInterface
+class ALSound : public CSound
{
public:
ALSound();
diff --git a/src/sound/sound.h b/src/sound/sound.h
index 45ec7e1..c2943f2 100644
--- a/src/sound/sound.h
+++ b/src/sound/sound.h
@@ -143,19 +143,19 @@ enum SoundNext
/**
-* @class CSoundInterface
+* @class CSound
*
* @brief Sound plugin interface
*
*/
-class CSoundInterface : public CPluginInterface
+class CSound : public CPluginInterface
{
public:
- CSoundInterface() {
+ CSound() {
//CInstanceManager::getInstance().AddInstance(CLASS_SOUND, this);
//m_iMan->AddInstance(CLASS_SOUND, this);
};
- virtual ~CSoundInterface() = 0;
+ virtual ~CSound() = 0;
/** Function to initialize sound device
* @param bool b3D - enable support for 3D sound
@@ -163,7 +163,7 @@ class CSoundInterface : public CPluginInterface
virtual bool Create(bool b3D) = 0;
/** Function called to cache all sound effect files.
- * Function calls \link CSoundInterface::Cache() \endlink for each file
+ * Function calls \link CSound::Cache() \endlink for each file
*/
virtual void CacheAll() = 0;
diff --git a/src/ui/button.h b/src/ui/button.h
index 38b2dab..4f1740d 100644
--- a/src/ui/button.h
+++ b/src/ui/button.h
@@ -29,7 +29,7 @@
class CButton : public CControl
{
public:
- CButton(CInstanceManager* iMan);
+ CButton();
virtual ~CButton();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
diff --git a/src/ui/check.h b/src/ui/check.h
index 3af6849..66375c0 100644
--- a/src/ui/check.h
+++ b/src/ui/check.h
@@ -29,7 +29,7 @@ class CD3DEngine;
class CCheck : public CControl
{
public:
- CCheck(CInstanceManager* iMan);
+ CCheck();
virtual ~CCheck();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
diff --git a/src/ui/color.h b/src/ui/color.h
index 151a4df..740b7e9 100644
--- a/src/ui/color.h
+++ b/src/ui/color.h
@@ -30,7 +30,7 @@
class CColor : public CControl
{
public:
- CColor(CInstanceManager* iMan);
+ CColor();
virtual ~CColor();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
diff --git a/src/ui/compass.h b/src/ui/compass.h
index ac5f608..fcbf860 100644
--- a/src/ui/compass.h
+++ b/src/ui/compass.h
@@ -29,7 +29,7 @@
class CCompass : public CControl
{
public:
- CCompass(CInstanceManager* iMan);
+ CCompass();
virtual ~CCompass();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
diff --git a/src/ui/control.h b/src/ui/control.h
index b211ff6..ef49b65 100644
--- a/src/ui/control.h
+++ b/src/ui/control.h
@@ -26,12 +26,14 @@
#include "graphics/engine/text.h"
#include "graphics/engine/particle.h"
+#include "sound/sound.h"
+
class CInstanceManager;
class CEvent;
//class Gfx::CEngine;
class CRobotMain;
//class Gfx::CParticle;
-class CSound;
+//class CSound;
enum ControlState
@@ -60,7 +62,7 @@ enum ControlState
class CControl
{
public:
- CControl(CInstanceManager* iMan);
+ CControl();
virtual ~CControl();
virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
@@ -78,8 +80,8 @@ public:
virtual int GetState();
virtual void SetIcon(int icon);
virtual int GetIcon();
- virtual void SetName(char* name, bool bTooltip=true);
- virtual char* GetName();
+ virtual void SetName(const char* name, bool bTooltip=true);
+ virtual const char* GetName();
virtual void SetTextAlign(Gfx::TextAlign mode);
virtual int GetTextAlign();
virtual void SetFontSize(float size);
@@ -88,8 +90,8 @@ public:
virtual float GetFontStretch();
virtual void SetFontType(Gfx::FontType font);
virtual Gfx::FontType GetFontType();
- virtual bool SetTooltip(char* name);
- virtual bool GetTooltip(Math::Point pos, char* name);
+ virtual bool SetTooltip(const char* name);
+ virtual bool GetTooltip(Math::Point pos, const char* name);
virtual void SetFocus(bool bFocus);
virtual bool GetFocus();
diff --git a/src/ui/displayinfo.h b/src/ui/displayinfo.h
index 29677d4..dbc9bed 100644
--- a/src/ui/displayinfo.h
+++ b/src/ui/displayinfo.h
@@ -37,7 +37,7 @@ class CLight;
class CDisplayInfo
{
public:
- CDisplayInfo(CInstanceManager* iMan);
+ CDisplayInfo();
~CDisplayInfo();
bool EventProcess(const Event &event);
diff --git a/src/ui/displaytext.h b/src/ui/displaytext.h
index c2eea98..93a3c8b 100644
--- a/src/ui/displaytext.h
+++ b/src/ui/displaytext.h
@@ -45,7 +45,7 @@ const int MAXDTLINE = 4;
class CDisplayText
{
public:
- CDisplayText(CInstanceManager* iMan);
+ CDisplayText();
~CDisplayText();
void DeleteObject();
diff --git a/src/ui/edit.h b/src/ui/edit.h
index dbd94d1..73bd062 100644
--- a/src/ui/edit.h
+++ b/src/ui/edit.h
@@ -19,14 +19,11 @@
#pragma once
-#include "common/struct.h"
-#include "ui/control.h"
-
-
-class CD3DEngine;
-class CScroll;
-
+#include <common/struct.h>
+#include <common/event.h>
+#include <ui/control.h>
+#include <ui/scroll.h>
const int EDITSTUDIOMAX = 20000; // maximum number of characters in CBOT edit
const int EDITLINEMAX = 1000; // maximum total number of lines
@@ -85,10 +82,10 @@ struct HyperHistory
class CEdit : public CControl
{
public:
- CEdit(CInstanceManager* iMan);
+ CEdit();
virtual ~CEdit();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
void SetPos(Math::Point pos);
void SetDim(Math::Point dim);
@@ -145,8 +142,8 @@ public:
void HyperFlush();
void HyperHome(char *filename);
- bool HyperTest(EventMsg event);
- bool HyperGo(EventMsg event);
+ bool HyperTest(EventType event);
+ bool HyperGo(EventType event);
void SetFontSize(float size);
diff --git a/src/ui/editvalue.h b/src/ui/editvalue.h
index dbb7812..758450a 100644
--- a/src/ui/editvalue.h
+++ b/src/ui/editvalue.h
@@ -21,6 +21,7 @@
#include "ui/control.h"
+#include "common/event.h"
enum EditValueType
{
@@ -39,10 +40,10 @@ class CButton;
class CEditValue : public CControl
{
public:
- CEditValue(CInstanceManager* iMan);
+ CEditValue();
virtual ~CEditValue();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
void SetPos(Math::Point pos);
void SetDim(Math::Point dim);
diff --git a/src/ui/gauge.h b/src/ui/gauge.h
index 1686c56..26ce8e9 100644
--- a/src/ui/gauge.h
+++ b/src/ui/gauge.h
@@ -29,7 +29,7 @@
class CGauge : public CControl
{
public:
- CGauge(CInstanceManager* iMan);
+ CGauge();
virtual ~CGauge();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
diff --git a/src/ui/group.h b/src/ui/group.h
index b54829d..12c4003 100644
--- a/src/ui/group.h
+++ b/src/ui/group.h
@@ -29,7 +29,7 @@ class CD3DEngine;
class CGroup : public CControl
{
public:
- CGroup(CInstanceManager* iMan);
+ CGroup();
virtual ~CGroup();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
diff --git a/src/ui/image.h b/src/ui/image.h
index 85c5962..b6b88c3 100644
--- a/src/ui/image.h
+++ b/src/ui/image.h
@@ -19,8 +19,9 @@
#pragma once
-#include "ui/control.h"
+#include <ui/control.h>
+#include <common/event.h>
class CD3DEngine;
@@ -29,10 +30,10 @@ class CD3DEngine;
class CImage : public CControl
{
public:
- CImage(CInstanceManager* iMan);
+ CImage();
virtual ~CImage();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
bool EventProcess(const Event &event);
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 50d2352..afedfc9 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,55 +18,19 @@
// interface.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "ui/control.h"
-#include "ui/button.h"
-#include "ui/color.h"
-#include "ui/check.h"
-#include "ui/key.h"
-#include "ui/group.h"
-#include "ui/image.h"
-#include "ui/label.h"
-#include "ui/edit.h"
-#include "ui/editvalue.h"
-#include "ui/scroll.h"
-#include "ui/slider.h"
-#include "ui/list.h"
-#include "ui/shortcut.h"
-#include "ui/compass.h"
-#include "ui/target.h"
-#include "ui/map.h"
-#include "ui/window.h"
-#include "old/camera.h"
-#include "ui/interface.h"
-
-
-
-
-// Object's constructor.
-
-CInterface::CInterface(CInstanceManager* iMan)
-{
- int i;
+#include <ui/interface.h>
- m_iMan = iMan;
- m_iMan->AddInstance(CLASS_INTERFACE, this);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_camera = 0;
+CInterface::CInterface()
+{
+ m_iMan = CInstanceManager::GetInstancePointer();
+ m_iMan->AddInstance(CLASS_INTERFACE, this);
+ m_event = static_cast<CEventQueue *>( m_iMan->SearchInstance(CLASS_EVENT) );
+ m_engine = static_cast<Gfx::CEngine *>( m_iMan->SearchInstance(CLASS_ENGINE) );
- for ( i=0 ; i<MAXCONTROL ; i++ )
+ for (int i = 0; i < MAXCONTROL; i++ )
{
- m_table[i] = 0;
+ m_table[i] = nullptr;
}
}
@@ -74,6 +39,7 @@ CInterface::CInterface(CInstanceManager* iMan)
CInterface::~CInterface()
{
Flush();
+ m_iMan->DeleteInstance(CLASS_INTERFACE, this);
}
@@ -81,424 +47,222 @@ CInterface::~CInterface()
void CInterface::Flush()
{
- int i;
-
- for ( i=0 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] != 0 )
- {
+ for (int i = 0; i < MAXCONTROL; i++ ) {
+ if ( m_table[i] != nullptr ) {
delete m_table[i];
- m_table[i] = 0;
+ m_table[i] = nullptr;
}
}
}
-// Creates a new button.
-
-CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+int CInterface::GetNextFreeControl()
{
- CWindow* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- if ( eventMsg == EVENT_WINDOW0 ) {i=0; goto create;}
- if ( eventMsg == EVENT_WINDOW1 ) {i=1; goto create;}
- if ( eventMsg == EVENT_WINDOW2 ) {i=2; goto create;}
- if ( eventMsg == EVENT_WINDOW3 ) {i=3; goto create;}
- if ( eventMsg == EVENT_WINDOW4 ) {i=4; goto create;}
- if ( eventMsg == EVENT_WINDOW5 ) {i=5; goto create;}
- if ( eventMsg == EVENT_WINDOW6 ) {i=6; goto create;}
- if ( eventMsg == EVENT_WINDOW7 ) {i=7; goto create;}
- if ( eventMsg == EVENT_WINDOW8 ) {i=8; goto create;}
- if ( eventMsg == EVENT_WINDOW9 ) {i=9; goto create;}
-
- if ( eventMsg == EVENT_TOOLTIP ) {i=MAXCONTROL-1; goto create;}
-
- for ( i=10 ; i<MAXCONTROL-1 ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- create:
- m_table[i] = new CWindow(m_iMan);
- pc = (CWindow*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
+ for (int i = 10; i < MAXCONTROL-1; i++) {
+ if (m_table[i] == nullptr)
+ return i;
}
- return 0;
+ return -1;
}
-// Creates a new button.
-CButton* CInterface::CreateButton(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+template <typename T> inline T* CInterface::CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CButton* pc;
- int i;
+ T* pc;
+ int index;
+ Event event;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CButton(m_iMan);
- pc = (CButton*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
+ if (eventMsg == EVENT_NULL) {
+ m_event->GetEvent(event);
+ eventMsg = event.type;
}
- return 0;
+
+ if ((index = GetNextFreeControl()) < 0)
+ return nullptr;
+
+ m_table[index] = new T();
+ pc = static_cast<T *>(m_table[index]);
+ pc->Create(pos, dim, icon, eventMsg);
+ return pc;
}
+
// Creates a new button.
-CColor* CInterface::CreateColor(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CColor* pc;
- int i;
+ CWindow* pc;
+ int index;
+ Event event;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if (eventMsg == EVENT_NULL) {
+ m_event->GetEvent(event);
+ eventMsg = event.type;
+ }
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CColor(m_iMan);
- pc = (CColor*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
+ switch (eventMsg) {
+ case EVENT_WINDOW0: index = 0; break;
+ case EVENT_WINDOW1: index = 1; break;
+ case EVENT_WINDOW2: index = 2; break;
+ case EVENT_WINDOW3: index = 3; break;
+ case EVENT_WINDOW4: index = 4; break;
+ case EVENT_WINDOW5: index = 5; break;
+ case EVENT_WINDOW6: index = 6; break;
+ case EVENT_WINDOW7: index = 7; break;
+ case EVENT_WINDOW8: index = 8; break;
+ case EVENT_WINDOW9: index = 9; break;
+ case EVENT_TOOLTIP: index = MAXCONTROL-1; break;
+ default: index = GetNextFreeControl(); break;
}
- return 0;
+
+ if (index < 0)
+ return nullptr;
+
+ m_table[index] = new CWindow();
+ pc = static_cast<CWindow *>(m_table[index]);
+ pc->Create(pos, dim, icon, eventMsg);
+ return pc;
}
// Creates a new button.
-CCheck* CInterface::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CButton* CInterface::CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CCheck* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CCheck(m_iMan);
- pc = (CCheck*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CButton>(pos, dim, icon, eventMsg);
}
// Creates a new button.
-CKey* CInterface::CreateKey(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CColor* CInterface::CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CKey* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CKey(m_iMan);
- pc = (CKey*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CColor>(pos, dim, icon, eventMsg);
}
// Creates a new button.
-CGroup* CInterface::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CCheck* CInterface::CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CGroup* pc;
- int i;
+ return CreateControl<CCheck>(pos, dim, icon, eventMsg);
+}
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+// Creates a new button.
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CGroup(m_iMan);
- pc = (CGroup*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+CKey* CInterface::CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
+{
+ return CreateControl<CKey>(pos, dim, icon, eventMsg);
}
// Creates a new button.
-CImage* CInterface::CreateImage(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CGroup* CInterface::CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CImage* pc;
- int i;
+ return CreateControl<CGroup>(pos, dim, icon, eventMsg);
+}
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+// Creates a new button.
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CImage(m_iMan);
- pc = (CImage*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+CImage* CInterface::CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
+{
+ return CreateControl<CImage>(pos, dim, icon, eventMsg);
}
// Creates a new label.
-CLabel* CInterface::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg,
- char *name)
+CLabel* CInterface::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, const char *name)
{
- CLabel* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CLabel(m_iMan);
- pc = (CLabel*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- pc->SetName(name);
- return pc;
- }
- }
- return 0;
+ CLabel* pc = CreateControl<CLabel>(pos, dim, icon, eventMsg);
+ if (pc != nullptr)
+ pc->SetName(name);
+ return pc;
}
// Creates a new pave editable.
-CEdit* CInterface::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CEdit* CInterface::CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CEdit* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CEdit(m_iMan);
- pc = (CEdit*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CEdit>(pos, dim, icon, eventMsg);
}
// Creates a new pave editable.
-CEditValue* CInterface::CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CEditValue* CInterface::CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CEditValue* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CEditValue(m_iMan);
- pc = (CEditValue*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CEditValue>(pos, dim, icon, eventMsg);
}
// Creates a new lift.
-CScroll* CInterface::CreateScroll(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CScroll* CInterface::CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CScroll* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CScroll(m_iMan);
- pc = (CScroll*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CScroll>(pos, dim, icon, eventMsg);
}
// Creates a new cursor.
-CSlider* CInterface::CreateSlider(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CSlider* CInterface::CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CSlider* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CSlider(m_iMan);
- pc = (CSlider*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CSlider>(pos, dim, icon, eventMsg);
}
// Creates a new list.
-CList* CInterface::CreateList(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg,
- float expand)
+CList* CInterface::CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand)
{
- CList* pc;
- int i;
+ CList* pc;
+ int index;
+ Event event;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CList(m_iMan);
- pc = (CList*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg, expand);
- return pc;
- }
+ if (eventMsg == EVENT_NULL) {
+ m_event->GetEvent(event);
+ eventMsg = event.type;
}
- return 0;
+
+ if ((index = GetNextFreeControl()) < 0)
+ return nullptr;
+
+ m_table[index] = new CList();
+ pc = static_cast<CList *>(m_table[index]);
+ pc->Create(pos, dim, icon, eventMsg, expand);
+ return pc;
}
// Creates a new shortcut.
-CShortcut* CInterface::CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CShortcut* CInterface::CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CShortcut* ps;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CShortcut(m_iMan);
- ps = (CShortcut*)m_table[i];
- ps->Create(pos, dim, icon, eventMsg);
- return ps;
- }
- }
- return 0;
+ return CreateControl<CShortcut>(pos, dim, icon, eventMsg);
}
// Creates a new compass.
-CCompass* CInterface::CreateCompass(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CCompass* CInterface::CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CCompass* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CCompass(m_iMan);
- pc = (CCompass*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CCompass>(pos, dim, icon, eventMsg);
}
// Creates a new target.
-CTarget* CInterface::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CTarget* CInterface::CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CTarget* pc;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CTarget(m_iMan);
- pc = (CTarget*)m_table[i];
- pc->Create(pos, dim, icon, eventMsg);
- return pc;
- }
- }
- return 0;
+ return CreateControl<CTarget>(pos, dim, icon, eventMsg);
}
// Creates a new map.
-CMap* CInterface::CreateMap(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+CMap* CInterface::CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- CMap* pm;
- int i;
-
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
-
- for ( i=10 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] == 0 )
- {
- m_table[i] = new CMap(m_iMan);
- pm = (CMap*)m_table[i];
- pm->Create(pos, dim, icon, eventMsg);
- return pm;
- }
- }
- return 0;
+ return CreateControl<CMap>(pos, dim, icon, eventMsg);
}
// Removes a control.
-bool CInterface::DeleteControl(EventMsg eventMsg)
+bool CInterface::DeleteControl(EventType eventMsg)
{
- int i;
-
- for ( i=0 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] != 0 )
- {
- if ( eventMsg == m_table[i]->RetEventMsg() )
- {
+ for (int i = 0; i < MAXCONTROL; i++) {
+ if ( m_table[i] != nullptr ) {
+ if (eventMsg == m_table[i]->GetEventType()) {
delete m_table[i];
- m_table[i] = 0;
+ m_table[i] = nullptr;
return true;
}
}
@@ -508,47 +272,32 @@ bool CInterface::DeleteControl(EventMsg eventMsg)
// Gives a control.
-CControl* CInterface::SearchControl(EventMsg eventMsg)
+CControl* CInterface::SearchControl(EventType eventMsg)
{
- int i;
-
- for ( i=0 ; i<MAXCONTROL ; i++ )
- {
- if ( m_table[i] != 0 )
- {
- if ( eventMsg == m_table[i]->RetEventMsg() )
- {
+ for (int i = 0; i < MAXCONTROL; i++) {
+ if (m_table[i] != nullptr) {
+ if (eventMsg == m_table[i]->GetEventType())
return m_table[i];
- }
}
}
- return 0;
+ return nullptr;
}
// Management of an event.
bool CInterface::EventProcess(const Event &event)
{
- int i;
-
- if ( event.event == EVENT_MOUSEMOVE )
- {
- if ( m_camera == 0 )
- {
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
+ if (event.type == EVENT_MOUSE_MOVE) {
+ if (m_camera == nullptr) {
+ m_camera = static_cast<Gfx::CCamera *>(m_iMan->SearchInstance(CLASS_CAMERA));
}
- m_engine->SetMouseType(m_camera->RetMouseDef(event.pos));
+ m_engine->SetMouseType(m_camera->GetMouseDef(event.pos));
}
- for ( i=MAXCONTROL-1 ; i>=0 ; i-- )
- {
- if ( m_table[i] != 0 &&
- m_table[i]->TestState(STATE_ENABLE) )
- {
+ for (int i = MAXCONTROL-1; i >= 0; i--) {
+ if (m_table[i] != nullptr && m_table[i]->TestState(STATE_ENABLE)) {
if ( !m_table[i]->EventProcess(event) )
- {
return false;
- }
}
}
@@ -558,18 +307,12 @@ bool CInterface::EventProcess(const Event &event)
// Gives the tooltip binding to the window.
-bool CInterface::GetTooltip(Math::Point pos, char* name)
+bool CInterface::GetTooltip(Math::Point pos, const char* name)
{
- int i;
-
- for ( i=MAXCONTROL-1 ; i>=0 ; i-- )
- {
- if ( m_table[i] != 0 )
- {
- if ( m_table[i]->GetTooltip(pos, name) )
- {
+ for (int i = MAXCONTROL-1; i >= 0; i--) {
+ if (m_table[i] != nullptr) {
+ if (m_table[i]->GetTooltip(pos, name))
return true;
- }
}
}
return false;
@@ -580,26 +323,17 @@ bool CInterface::GetTooltip(Math::Point pos, char* name)
void CInterface::Draw()
{
- D3DMATERIAL7 material;
- int i;
-
- ZeroMemory( &material, sizeof(D3DMATERIAL7) );
+ /*ZeroMemory( &material, sizeof(D3DMATERIAL7) );
material.diffuse.r = 1.0f;
material.diffuse.g = 1.0f;
material.diffuse.b = 1.0f;
material.ambient.r = 0.5f;
material.ambient.g = 0.5f;
material.ambient.b = 0.5f;
- m_engine->SetMaterial(material);
+ m_engine->SetMaterial(material);*/
- for ( i=0 ; i<MAXCONTROL ; i++ )
-//? for ( i=MAXCONTROL-1 ; i>=0 ; i-- )
- {
- if ( m_table[i] != 0 )
- {
+ for (int i = 0; i < MAXCONTROL; i++) {
+ if ( m_table[i] != nullptr )
m_table[i]->Draw();
- }
}
}
-
-
diff --git a/src/ui/interface.h b/src/ui/interface.h
index 8aa7f44..d8f4d62 100644
--- a/src/ui/interface.h
+++ b/src/ui/interface.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -19,32 +20,34 @@
#pragma once
-#include "common/event.h"
-#include "math/point.h"
-
-
-class CInstanceManager;
-class CD3DEngine;
-class CControl;
-class CWindow;
-class CButton;
-class CColor;
-class CCheck;
-class CKey;
-class CGroup;
-class CImage;
-class CLabel;
-class CEdit;
-class CEditValue;
-class CScroll;
-class CSlider;
-class CList;
-class CShortcut;
-class CMap;
-class CGauge;
-class CCompass;
-class CTarget;
-class CCamera;
+#include <common/event.h>
+#include <common/struct.h>
+#include <common/misc.h>
+#include <common/iman.h>
+
+#include <math/point.h>
+
+#include <graphics/engine/camera.h>
+#include <graphics/engine/engine.h>
+
+#include <ui/control.h>
+#include <ui/button.h>
+#include <ui/color.h>
+#include <ui/check.h>
+#include <ui/key.h>
+#include <ui/group.h>
+#include <ui/image.h>
+#include <ui/label.h>
+#include <ui/edit.h>
+#include <ui/editvalue.h>
+#include <ui/scroll.h>
+#include <ui/slider.h>
+#include <ui/list.h>
+#include <ui/shortcut.h>
+#include <ui/compass.h>
+#include <ui/target.h>
+#include <ui/map.h>
+#include <ui/window.h>
const int MAXCONTROL = 100;
@@ -52,44 +55,48 @@ const int MAXCONTROL = 100;
class CInterface
{
-public:
- CInterface(CInstanceManager* iMan);
- ~CInterface();
-
- bool EventProcess(const Event &event);
- bool GetTooltip(Math::Point pos, char* name);
-
- void Flush();
- CWindow* CreateWindows(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg, char *name);
- CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg, float expand=1.2f);
- CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- bool DeleteControl(EventMsg eventMsg);
- CControl* SearchControl(EventMsg eventMsg);
-
- void Draw();
-
-protected:
-
-protected:
- CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CCamera* m_camera;
-
- CControl* m_table[MAXCONTROL];
+ public:
+ CInterface();
+ ~CInterface();
+
+ bool EventProcess(const Event &event);
+ bool GetTooltip(Math::Point pos, const char* name);
+
+ void Flush();
+ CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+
+ CWindow* CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand=1.2f);
+ CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, const char *name);
+
+ bool DeleteControl(EventType eventMsg);
+ CControl* SearchControl(EventType eventMsg);
+
+ void Draw();
+
+ protected:
+ int GetNextFreeControl();
+ template <typename T> inline T* CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+
+ CInstanceManager* m_iMan;
+ CEventQueue* m_event;
+ Gfx::CEngine* m_engine;
+ Gfx::CCamera* m_camera;
+
+ CControl* m_table[MAXCONTROL];
};
diff --git a/src/ui/key.cpp b/src/ui/key.cpp
index a1eebb3..0d73ed0 100644
--- a/src/ui/key.cpp
+++ b/src/ui/key.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,54 +18,32 @@
// key.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+#include <ui/key.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "common/restext.h"
-#include "old/sound.h"
-#include "old/text.h"
-#include "ui/key.h"
-
-
-
-
-// Constructs the name of a button.
void GetKeyName(char *name, int key)
{
- if ( !GetResource(RES_KEY, key, name) )
- {
- if ( (key >= '0' && key <= '9') ||
- (key >= 'A' && key <= 'Z') ||
- (key >= 'a' && key <= 'z') )
- {
+ if ( !GetResource(RES_KEY, key, name) ) {
+ if (isalnum(key)) {
name[0] = key;
name[1] = 0;
}
- else
- {
+ else {
sprintf(name, "Code %d", key);
}
}
}
-
-
// Object's constructor.
-CKey::CKey(CInstanceManager* iMan) : CControl(iMan)
+CKey::CKey() : CControl()
{
m_key[0] = 0;
m_key[1] = 0;
m_bCatch = false;
+
+ m_app = CApplication::GetInstancePointer();
}
// Object's destructor.
@@ -76,18 +55,18 @@ CKey::~CKey()
// Creates a new button.
-bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- char name[100];
- char* p;
+ char name[100];
+ Event event;
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if (eventMsg == EVENT_NULL) {
+ m_event->GetEvent(event);
+ eventMsg = event.type;
+ }
CControl::Create(pos, dim, icon, eventMsg);
-
GetResource(RES_EVENT, eventMsg, name);
- p = strchr(name, '\\');
- if ( p != 0 ) *p = 0;
SetName(name);
return true;
@@ -98,24 +77,17 @@ bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
bool CKey::EventProcess(const Event &event)
{
- if ( m_state & STATE_DEAD ) return true;
+ if (m_state & STATE_DEAD)
+ return true;
CControl::EventProcess(event);
- if ( event.event == EVENT_LBUTTONDOWN )
- {
- if ( Detect(event.pos) )
- {
- m_bCatch = true;
- }
- else
- {
- m_bCatch = false;
- }
+ if (event.type == EVENT_MOUSE_BUTTON_DOWN) {
+ if (event.mouseButton.button == 1) // left
+ m_bCatch = Detect(event.pos);
}
- if ( event.event == EVENT_KEYDOWN && m_bCatch )
- {
+ if (event.type == EVENT_MOUSE_BUTTON_DOWN && m_bCatch) {
m_bCatch = false;
if ( TestKey(event.param) ) // impossible ?
@@ -124,21 +96,17 @@ bool CKey::EventProcess(const Event &event)
}
else
{
- if ( event.param == m_key[0] ||
- event.param == m_key[1] )
- {
+ if ( event.param == m_key[0] || event.param == m_key[1] ) {
m_key[0] = event.param;
m_key[1] = 0;
- }
- else
- {
+ } else {
m_key[1] = m_key[0];
m_key[0] = event.param;
}
m_sound->Play(SOUND_CLICK);
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
}
return false;
@@ -152,25 +120,17 @@ bool CKey::EventProcess(const Event &event)
bool CKey::TestKey(int key)
{
- int i, j;
+ if ( key == VK_PAUSE || key == VK_SNAPSHOT ) return true; // blocked key
- if ( key == VK_PAUSE ||
- key == VK_SNAPSHOT ) return true; // blocked key
-
- for ( i=0 ; i<20 ; i++ )
- {
- for ( j=0 ; j<2 ; j++ )
- {
- if ( key == m_engine->RetKey(i, j) ) // key used?
- {
- m_engine->SetKey(i, j, 0); // nothing!
- }
+ for (int i = 0; i < 20; i++) {
+ for (int j = 0; j < 2; j++) {
+ if (key == m_app->GetKey(i, j) ) // key used?
+ m_app->SetKey(i, j, 0); // nothing!
}
- if ( m_engine->RetKey(i, 0) == 0 ) // first free option?
- {
- m_engine->SetKey(i, 0, m_engine->RetKey(i, 1)); // shift
- m_engine->SetKey(i, 1, 0);
+ if ( m_app->GetKey(i, 0) == 0 ) { // first free option?
+ m_app->SetKey(i, 0, m_app->GetKey(i, 1)); // shift
+ m_app->SetKey(i, 1, 0);
}
}
@@ -182,106 +142,97 @@ bool CKey::TestKey(int key)
void CKey::Draw()
{
- Math::Point iDim, pos;
- float zoomExt, zoomInt, h;
- int icon;
- char text[100];
+ Math::Point iDim, pos;
+ float zoomExt, zoomInt, h;
+ int icon;
+ char text[100];
- if ( (m_state & STATE_VISIBLE) == 0 ) return;
+ if ( (m_state & STATE_VISIBLE) == 0 )
+ return;
iDim = m_dim;
m_dim.x = 200.0f/640.0f;
if ( m_state & STATE_SHADOW )
- {
DrawShadow(m_pos, m_dim);
- }
+
m_engine->SetTexture("button1.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); // was D3DSTATENORMAL
zoomExt = 1.00f;
zoomInt = 0.95f;
icon = 2;
- if ( m_key[0] == 0 &&
- m_key[1] == 0 ) // no shortcut?
- {
+ if ( m_key[0] == 0 && m_key[1] == 0 ) // no shortcut?
icon = 3;
- }
- if ( m_state & STATE_DEFAULT )
- {
+
+ if ( m_state & STATE_DEFAULT ) {
DrawPart(23, 1.3f, 0.0f);
zoomExt *= 1.15f;
zoomInt *= 1.15f;
}
+
if ( m_state & STATE_HILIGHT )
- {
icon = 1;
- }
+
if ( m_state & STATE_CHECK )
- {
icon = 0;
- }
- if ( m_state & STATE_PRESS )
- {
+
+ if ( m_state & STATE_PRESS ) {
icon = 3;
zoomInt *= 0.9f;
}
+
if ( (m_state & STATE_ENABLE) == 0 )
- {
icon = 7;
- }
+
if ( m_state & STATE_DEAD )
- {
icon = 17;
- }
+
if ( m_bCatch )
- {
icon = 23;
- }
- DrawPart(icon, zoomExt, 8.0f/256.0f); // draws the button
- h = m_engine->RetText()->RetHeight(m_fontSize, m_fontType)/2.0f;
+ DrawPart(icon, zoomExt, 8.0f / 256.0f); // draws the button
+
+ h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f;
GetKeyName(text, m_key[0]);
- if ( m_key[1] != 0 )
- {
+ if ( m_key[1] != 0 ) {
GetResource(RES_TEXT, RT_KEY_OR, text+strlen(text));
GetKeyName(text+strlen(text), m_key[1]);
}
- pos.x = m_pos.x+m_dim.x*0.5f;
- pos.y = m_pos.y+m_dim.y*0.5f;
+ pos.x = m_pos.x + m_dim.x * 0.5f;
+ pos.y = m_pos.y + m_dim.y * 0.5f;
pos.y -= h;
- m_engine->RetText()->DrawText(text, pos, m_dim.x, 0, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(std::string(text), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_CENTER, 0);
m_dim = iDim;
- if ( m_state & STATE_DEAD ) return;
+ if ( m_state & STATE_DEAD )
+ return;
// Draws the name.
- pos.x = m_pos.x+(214.0f/640.0f);
- pos.y = m_pos.y+m_dim.y*0.5f;
+ pos.x = m_pos.x + (214.0f / 640.0f);
+ pos.y = m_pos.y + m_dim.y * 0.5f;
pos.y -= h;
- m_engine->RetText()->DrawText(m_name, pos, m_dim.x, 1, m_fontSize, m_fontStretch, m_fontType, 0);
+ m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, 0);
}
void CKey::SetKey(int option, int key)
{
- if ( option < 0 ||
- option > 1 ) return;
+ if ( option < 0 || option > 1 ) return;
m_key[option] = key;
}
-int CKey::RetKey(int option)
+int CKey::GetKey(int option)
{
- if ( option < 0 ||
- option > 1 ) return 0;
+ if ( option < 0 || option > 1 ) return 0;
return m_key[option];
}
diff --git a/src/ui/key.h b/src/ui/key.h
index 314f39b..db7d856 100644
--- a/src/ui/key.h
+++ b/src/ui/key.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -18,35 +19,39 @@
#pragma once
+#include <cctype>
+#include <string>
-#include "ui/control.h"
+#include <ui/control.h>
+#include <common/iman.h>
+#include <common/event.h>
+#include <common/restext.h>
-class CD3DEngine;
-
+#include <app/app.h>
class CKey : public CControl
{
-public:
- CKey(CInstanceManager* iMan);
- virtual ~CKey();
+ public:
+ CKey();
+ virtual ~CKey();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool EventProcess(const Event &event);
- bool EventProcess(const Event &event);
+ void Draw();
- void Draw();
+ void SetKey(int option, int key);
+ int GetKey(int option);
- void SetKey(int option, int key);
- int RetKey(int option);
+ protected:
+ bool TestKey(int key);
-protected:
- bool TestKey(int key);
+ int m_key[2];
+ bool m_bCatch;
-protected:
- int m_key[2];
- bool m_bCatch;
+ CApplication *m_app;
};
diff --git a/src/ui/label.cpp b/src/ui/label.cpp
index cd96493..261f3fc 100644
--- a/src/ui/label.cpp
+++ b/src/ui/label.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -17,25 +18,12 @@
// label.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "old/text.h"
-#include "ui/label.h"
-
-
+#include <ui/label.h>
// Object's constructor.
-CLabel::CLabel(CInstanceManager* iMan) : CControl(iMan)
+CLabel::CLabel() : CControl()
{
}
@@ -48,9 +36,14 @@ CLabel::~CLabel()
// Creates a new button.
-bool CLabel::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CLabel::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ Event event;
+
+ if (eventMsg == EVENT_NULL) {
+ m_event->GetEvent(event);
+ eventMsg = event.type;
+ }
CControl::Create(pos, dim, icon, eventMsg);
return true;
@@ -72,22 +65,16 @@ void CLabel::Draw()
{
Math::Point pos;
- if ( (m_state & STATE_VISIBLE) == 0 ) return;
+ if ( (m_state & STATE_VISIBLE) == 0 )
+ return;
- pos.y = m_pos.y+m_dim.y/2.0f;
+ pos.y = m_pos.y + m_dim.y / 2.0f;
- if ( m_justif > 0 )
- {
- pos.x = m_pos.x;
+ switch (m_justif) {
+ case Gfx::TEXT_ALIGN_LEFT: pos.x = m_pos.x; break;
+ case Gfx::TEXT_ALIGN_CENTER: pos.x = m_pos.x + m_dim.x / 2.0f; break;
+ case Gfx::TEXT_ALIGN_RIGHT: pos.x = m_pos.x + m_dim.x; break;
}
- if ( m_justif == 0 )
- {
- pos.x = m_pos.x+m_dim.x/2.0f;
- }
- if ( m_justif < 0 )
- {
- pos.x = m_pos.x+m_dim.x;
- }
- m_engine->RetText()->DrawText(m_name, pos, m_dim.x, m_justif, m_fontSize, m_fontStretch, m_fontType, 0);
-}
+ m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, m_justif, 0);
+}
diff --git a/src/ui/label.h b/src/ui/label.h
index d3cb915..f65e1dd 100644
--- a/src/ui/label.h
+++ b/src/ui/label.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
@@ -19,28 +20,21 @@
#pragma once
-#include "ui/control.h"
-
-
-class CD3DEngine;
+#include <ui/control.h>
+#include <common/event.h>
class CLabel : public CControl
{
-public:
- CLabel(CInstanceManager* iMan);
- virtual ~CLabel();
-
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
-
- bool EventProcess(const Event &event);
-
- void Draw();
+ public:
+ CLabel();
+ virtual ~CLabel();
-protected:
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool EventProcess(const Event &event);
-protected:
+ void Draw();
};
diff --git a/src/ui/list.h b/src/ui/list.h
index cc9e646..c7c278d 100644
--- a/src/ui/list.h
+++ b/src/ui/list.h
@@ -19,13 +19,9 @@
#pragma once
-#include "ui/control.h"
-#include "common/event.h"
+#include <ui/control.h>
-
-class CD3DEngine;
-class CButton;
-class CScroll;
+#include <common/event.h>
const int LISTMAXDISPLAY = 20; // maximum number of visible lines
@@ -35,81 +31,81 @@ const int LISTMAXTOTAL = 100; // maximum total number of lines
class CList : public CControl
{
-public:
- CList(CInstanceManager* iMan);
- ~CList();
+ public:
+ CList();
+ ~CList();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg, float expand);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand);
- void SetPos(Math::Point pos);
- void SetDim(Math::Point dim);
+ void SetPos(Math::Point pos);
+ void SetDim(Math::Point dim);
- bool SetState(int state, bool bState);
- bool SetState(int state);
- bool ClearState(int state);
+ bool SetState(int state, bool bState);
+ bool SetState(int state);
+ bool ClearState(int state);
- bool EventProcess(const Event &event);
- void Draw();
+ bool EventProcess(const Event &event);
+ void Draw();
- void Flush();
+ void Flush();
- void SetTotal(int i);
- int RetTotal();
+ void SetTotal(int i);
+ int RetTotal();
- void SetSelect(int i);
- int RetSelect();
+ void SetSelect(int i);
+ int RetSelect();
- void SetSelectCap(bool bEnable);
- bool RetSelectCap();
+ void SetSelectCap(bool bEnable);
+ bool RetSelectCap();
- void SetBlink(bool bEnable);
- bool RetBlink();
+ void SetBlink(bool bEnable);
+ bool RetBlink();
- void SetName(int i, char* name);
- char* RetName(int i);
+ void SetName(int i, char* name);
+ char* RetName(int i);
- void SetCheck(int i, bool bMode);
- bool RetCheck(int i);
+ void SetCheck(int i, bool bMode);
+ bool RetCheck(int i);
- void SetEnable(int i, bool bEnable);
- bool RetEnable(int i);
+ void SetEnable(int i, bool bEnable);
+ bool RetEnable(int i);
- void SetTabs(int i, float pos, int justif=1);
- float RetTabs(int i);
+ void SetTabs(int i, float pos, int justif=1);
+ float RetTabs(int i);
- void ShowSelect(bool bFixed);
+ void ShowSelect(bool bFixed);
- EventMsg RetEventMsgButton(int i);
- EventMsg RetEventMsgScroll();
+ EventType RetEventMsgButton(int i);
+ EventType RetEventMsgScroll();
-protected:
- bool MoveAdjust();
- void UpdateButton();
- void UpdateScroll();
- void MoveScroll();
- void DrawCase(char *text, Math::Point pos, float width, int justif);
+ protected:
+ bool MoveAdjust();
+ void UpdateButton();
+ void UpdateScroll();
+ void MoveScroll();
+ void DrawCase(char *text, Math::Point pos, float width, int justif);
-protected:
- CButton* m_button[LISTMAXDISPLAY];
- CScroll* m_scroll;
+ protected:
+ CButton* m_button[LISTMAXDISPLAY];
+ CScroll* m_scroll;
- EventMsg m_eventButton[LISTMAXDISPLAY];
- EventMsg m_eventScroll;
+ EventType m_eventButton[LISTMAXDISPLAY];
+ EventType m_eventScroll;
- float m_expand;
- int m_totalLine; // total number of lines
- int m_displayLine; // number of visible lines
- int m_selectLine; // selected line
- int m_firstLine; // first visible line
- bool m_bBlink;
- bool m_bSelectCap;
- float m_blinkTime;
- float m_tabs[10];
- int m_justifs[10];
+ float m_expand;
+ int m_totalLine; // total number of lines
+ int m_displayLine; // number of visible lines
+ int m_selectLine; // selected line
+ int m_firstLine; // first visible line
+ bool m_bBlink;
+ bool m_bSelectCap;
+ float m_blinkTime;
+ float m_tabs[10];
+ int m_justifs[10];
- char m_text[LISTMAXTOTAL][100];
- char m_check[LISTMAXTOTAL];
- char m_enable[LISTMAXTOTAL];
+ char m_text[LISTMAXTOTAL][100];
+ char m_check[LISTMAXTOTAL];
+ char m_enable[LISTMAXTOTAL];
};
diff --git a/src/ui/map.h b/src/ui/map.h
index efdf54b..693398c 100644
--- a/src/ui/map.h
+++ b/src/ui/map.h
@@ -19,16 +19,14 @@
#pragma once
-#include "ui/control.h"
-#include "object/object.h"
+#include <ui/control.h>
+#include <object/object.h>
+
+#include <common/event.h>
-class CD3DEngine;
class CTerrain;
class CWater;
-class CRobotMain;
-
-
const int MAPMAXOBJECT = 100;
@@ -62,10 +60,10 @@ struct MapObject
class CMap : public CControl
{
public:
- CMap(CInstanceManager* iMan);
+ CMap();
~CMap();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
bool EventProcess(const Event &event);
void Draw();
diff --git a/src/ui/scroll.h b/src/ui/scroll.h
index 6854e61..a82fea0 100644
--- a/src/ui/scroll.h
+++ b/src/ui/scroll.h
@@ -19,12 +19,9 @@
#pragma once
-#include "ui/control.h"
-
-
-class CD3DEngine;
-class CButton;
+#include <ui/control.h>
+#include <common/event.h>
const float SCROLL_WIDTH = (15.0f/640.0f);
@@ -32,50 +29,50 @@ const float SCROLL_WIDTH = (15.0f/640.0f);
class CScroll : public CControl
{
-public:
- CScroll(CInstanceManager* iMan);
- ~CScroll();
+ public:
+ CScroll();
+ ~CScroll();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- void SetPos(Math::Point pos);
- void SetDim(Math::Point dim);
+ void SetPos(Math::Point pos);
+ void SetDim(Math::Point dim);
- bool SetState(int state, bool bState);
- bool SetState(int state);
- bool ClearState(int state);
+ bool SetState(int state, bool bState);
+ bool SetState(int state);
+ bool ClearState(int state);
- bool EventProcess(const Event &event);
- void Draw();
+ bool EventProcess(const Event &event);
+ void Draw();
- void SetVisibleValue(float value);
- float RetVisibleValue();
+ void SetVisibleValue(float value);
+ float RetVisibleValue();
- void SetVisibleRatio(float value);
- float RetVisibleRatio();
+ void SetVisibleRatio(float value);
+ float RetVisibleRatio();
- void SetArrowStep(float step);
- float RetArrowStep();
+ void SetArrowStep(float step);
+ float RetArrowStep();
-protected:
- void MoveAdjust();
- void AdjustGlint();
- void DrawVertex(Math::Point pos, Math::Point dim, int icon);
+ protected:
+ void MoveAdjust();
+ void AdjustGlint();
+ void DrawVertex(Math::Point pos, Math::Point dim, int icon);
-protected:
- CButton* m_buttonUp;
- CButton* m_buttonDown;
+ protected:
+ CButton* m_buttonUp;
+ CButton* m_buttonDown;
- float m_visibleValue;
- float m_visibleRatio;
- float m_step;
+ float m_visibleValue;
+ float m_visibleRatio;
+ float m_step;
- bool m_bCapture;
- Math::Point m_pressPos;
- float m_pressValue;
+ bool m_bCapture;
+ Math::Point m_pressPos;
+ float m_pressValue;
- EventMsg m_eventUp;
- EventMsg m_eventDown;
+ EventType m_eventUp;
+ EventType m_eventDown;
};
diff --git a/src/ui/shortcut.h b/src/ui/shortcut.h
index b918ccc..d819bf2 100644
--- a/src/ui/shortcut.h
+++ b/src/ui/shortcut.h
@@ -18,31 +18,28 @@
#pragma once
+#include <ui/control.h>
-#include "ui/control.h"
-
-
-class CD3DEngine;
-
+#include <common/event.h>
class CShortcut : public CControl
{
-public:
- CShortcut(CInstanceManager* iMan);
- ~CShortcut();
+ public:
+ CShortcut();
+ ~CShortcut();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- bool EventProcess(const Event &event);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
-protected:
- void DrawVertex(int icon, float zoom);
+ protected:
+ void DrawVertex(int icon, float zoom);
-protected:
- float m_time;
+ protected:
+ float m_time;
};
diff --git a/src/ui/slider.h b/src/ui/slider.h
index 1ec9ea5..e79b348 100644
--- a/src/ui/slider.h
+++ b/src/ui/slider.h
@@ -19,63 +19,60 @@
#pragma once
-#include "ui/control.h"
-
-
-class CD3DEngine;
-class CButton;
+#include <ui/control.h>
+#include <common/event.h>
class CSlider : public CControl
{
-public:
- CSlider(CInstanceManager* iMan);
- ~CSlider();
+ public:
+ CSlider();
+ ~CSlider();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- void SetPos(Math::Point pos);
- void SetDim(Math::Point dim);
+ void SetPos(Math::Point pos);
+ void SetDim(Math::Point dim);
- bool SetState(int state, bool bState);
- bool SetState(int state);
- bool ClearState(int state);
+ bool SetState(int state, bool bState);
+ bool SetState(int state);
+ bool ClearState(int state);
- bool EventProcess(const Event &event);
- void Draw();
+ bool EventProcess(const Event &event);
+ void Draw();
- void SetLimit(float min, float max);
+ void SetLimit(float min, float max);
- void SetVisibleValue(float value);
- float RetVisibleValue();
+ void SetVisibleValue(float value);
+ float RetVisibleValue();
- void SetArrowStep(float step);
- float RetArrowStep();
+ void SetArrowStep(float step);
+ float RetArrowStep();
-protected:
- void MoveAdjust();
- void AdjustGlint();
- void DrawVertex(Math::Point pos, Math::Point dim, int icon);
+ protected:
+ void MoveAdjust();
+ void AdjustGlint();
+ void DrawVertex(Math::Point pos, Math::Point dim, int icon);
-protected:
- CButton* m_buttonLeft;
- CButton* m_buttonRight;
+ protected:
+ CButton* m_buttonLeft;
+ CButton* m_buttonRight;
- float m_min;
- float m_max;
- float m_visibleValue;
- float m_step;
+ float m_min;
+ float m_max;
+ float m_visibleValue;
+ float m_step;
- bool m_bHoriz;
- float m_marginButton;
+ bool m_bHoriz;
+ float m_marginButton;
- bool m_bCapture;
- Math::Point m_pressPos;
- float m_pressValue;
+ bool m_bCapture;
+ Math::Point m_pressPos;
+ float m_pressValue;
- EventMsg m_eventUp;
- EventMsg m_eventDown;
+ EventType m_eventUp;
+ EventType m_eventDown;
};
diff --git a/src/ui/target.h b/src/ui/target.h
index ae0c7af..a2615b4 100644
--- a/src/ui/target.h
+++ b/src/ui/target.h
@@ -19,30 +19,25 @@
#pragma once
-#include "ui/control.h"
-
-
-class CD3DEngine;
-class CObject;
+#include <ui/control.h>
+#include <common/event.h>
class CTarget : public CControl
{
-public:
- CTarget(CInstanceManager* iMan);
- ~CTarget();
-
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
+ public:
+ CTarget();
+ ~CTarget();
- bool EventProcess(const Event &event);
- void Draw();
- bool GetTooltip(Math::Point pos, char* name);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
-protected:
- CObject* DetectFriendObject(Math::Point pos);
+ bool EventProcess(const Event &event);
+ void Draw();
+ bool GetTooltip(Math::Point pos, char* name);
-protected:
+ protected:
+ CObject* DetectFriendObject(Math::Point pos);
};
diff --git a/src/ui/window.h b/src/ui/window.h
index 3acf3b4..8884c6f 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -19,27 +19,8 @@
#pragma once
-#include "ui/control.h"
-
-
-class CD3DEngine;
-class CButton;
-class CColor;
-class CCheck;
-class CKey;
-class CGroup;
-class CImage;
-class CLabel;
-class CEdit;
-class CEditValue;
-class CScroll;
-class CSlider;
-class CList;
-class CShortcut;
-class CMap;
-class CGauge;
-class CCompass;
-class CTarget;
+#include <ui/control.h>
+#include <common/event.h>
const int MAXWINDOW = 100;
@@ -48,34 +29,34 @@ const int MAXWINDOW = 100;
class CWindow : public CControl
{
public:
- CWindow(CInstanceManager* iMan);
+ CWindow();
~CWindow();
void Flush();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg, char *name);
- CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg, float expand=1.2f);
- CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CGauge* CreateGauge(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg);
- bool DeleteControl(EventMsg eventMsg);
- CControl* SearchControl(EventMsg eventMsg);
-
- EventMsg RetEventMsgReduce();
- EventMsg RetEventMsgFull();
- EventMsg RetEventMsgClose();
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CColor* CreateColor(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CCheck* CreateCheck(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, char *name);
+ CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CSlider* CreateSlider(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand=1.2f);
+ CShortcut* CreateShortcut(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CMap* CreateMap(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CGauge* CreateGauge(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CCompass* CreateCompass(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ CTarget* CreateTarget(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool DeleteControl(EventType eventMsg);
+ CControl* SearchControl(EventType eventMsg);
+
+ EventType RetEventTypeReduce();
+ EventType RetEventTypeFull();
+ EventType RetEventTypeClose();
void SetName(char* name);