diff options
author | Michał Konopacki <konopacki.m@gmail.com> | 2012-09-15 16:35:48 +0200 |
---|---|---|
committer | Michał Konopacki <konopacki.m@gmail.com> | 2012-09-15 16:35:48 +0200 |
commit | d439f4fa93eb45175dcdfa773af8f68efa1bad9d (patch) | |
tree | a2620bee6aae9ee49726892c5d1ebe717ad88e33 /src/ui/control.h | |
parent | e57be247c2ddce796fd64e9f3c1b3bfa4759b74a (diff) | |
parent | e9fcec9de52471508933c9d90cc6041ce0af9752 (diff) | |
download | colobot-d439f4fa93eb45175dcdfa773af8f68efa1bad9d.tar.gz colobot-d439f4fa93eb45175dcdfa773af8f68efa1bad9d.tar.bz2 colobot-d439f4fa93eb45175dcdfa773af8f68efa1bad9d.zip |
Merge branch 'dev-ui' into dev
Conflicts:
src/CMakeLists.txt
src/common/misc.cpp
src/common/misc.h
src/object/robotmain.cpp
src/object/robotmain.h
src/script/cbottoken.cpp
src/script/cbottoken.h
src/ui/button.cpp
src/ui/button.h
src/ui/check.cpp
src/ui/check.h
src/ui/color.cpp
src/ui/color.h
src/ui/compass.cpp
src/ui/compass.h
src/ui/control.cpp
src/ui/control.h
src/ui/displayinfo.cpp
src/ui/displayinfo.h
src/ui/displaytext.cpp
src/ui/displaytext.h
src/ui/edit.cpp
src/ui/edit.h
src/ui/gauge.cpp
src/ui/gauge.h
src/ui/interface.cpp
src/ui/interface.h
src/ui/key.cpp
src/ui/map.h
src/ui/shortcut.h
src/ui/slider.h
src/ui/target.cpp
src/ui/target.h
src/ui/window.cpp
src/ui/window.h
Diffstat (limited to 'src/ui/control.h')
-rw-r--r-- | src/ui/control.h | 238 |
1 files changed, 120 insertions, 118 deletions
diff --git a/src/ui/control.h b/src/ui/control.h index c3a35f4..48c3ef9 100644 --- a/src/ui/control.h +++ b/src/ui/control.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,129 +19,130 @@ #pragma once +#include <string> -//#include "old/text.h" -#include "graphics/engine/text.h" -//#include "common/struct.h" -#include "common/event.h" +#include <common/event.h> +#include <common/iman.h> +#include <common/language.h> +#include <common/misc.h> +#include <common/restext.h> + +#include <graphics/core/device.h> +#include <graphics/engine/engine.h> +#include <graphics/engine/particle.h> +#include <graphics/engine/text.h> + +#include <object/robotmain.h> + +#include <sound/sound.h> -namespace Gfx { -class CEngine; -class CParticle; -}; -class CInstanceManager; -class CEvent; -//class Gfx::CEngine; -class CRobotMain; -//class Gfx::CParticle; -class CSoundInterface; namespace Ui { -enum ControlState -{ - STATE_ENABLE = (1<<0), // active - STATE_CHECK = (1<<1), // pressed - STATE_HILIGHT = (1<<2), // overflown by mouse - STATE_PRESS = (1<<3), // pressed by mouse - STATE_VISIBLE = (1<<4), // visible - STATE_DEAD = (1<<5), // inaccessible (x) - STATE_DEFAULT = (1<<6), // actuated by RETURN - STATE_OKAY = (1<<7), // green point at the bottom right - STATE_SHADOW = (1<<8), // shadow - STATE_GLINT = (1<<9), // dynamic reflection - STATE_CARD = (1<<10), // tab - STATE_EXTEND = (1<<11), // extended mode - STATE_SIMPLY = (1<<12), // undecorated - STATE_FRAME = (1<<13), // framework highlighting - STATE_WARNING = (1<<14), // framework hatched yellow / black - STATE_VALUE = (1<<15), // displays the value - STATE_RUN = (1<<16) // running program -}; - - - -class CControl -{ -public: -// CControl(CInstanceManager* iMan); - CControl (); - virtual ~CControl(); - - virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); - - virtual bool EventProcess(const Event &event); - - virtual void SetPos(Math::Point pos); - virtual Math::Point GetPos(); - virtual void SetDim(Math::Point dim); - virtual Math::Point GetDim(); - virtual bool SetState(int state, bool bState); - virtual bool SetState(int state); - virtual bool ClearState(int state); - virtual bool TestState(int state); - virtual int GetState(); - virtual void SetIcon(int icon); - virtual int GetIcon(); - virtual void SetName(char* name, bool bTooltip=true); - virtual char* GetName(); - virtual void SetTextAlign(Gfx::TextAlign mode); - virtual int GetTextAlign(); - virtual void SetFontSize(float size); - virtual float GetFontSize(); - virtual void SetFontStretch(float stretch); - virtual float GetFontStretch(); - virtual void SetFontType(Gfx::FontType font); - virtual Gfx::FontType GetFontType(); - virtual bool SetTooltip(const char* name); - virtual bool GetTooltip(Math::Point pos, char* name); - virtual void SetFocus(bool bFocus); - virtual bool GetFocus(); - - virtual EventType GetEventType(); - - virtual void Draw(); - -protected: - void GlintDelete(); - void GlintCreate(Math::Point ref, bool bLeft=true, bool bUp=true); - void GlintFrame(const Event &event); - void DrawPart(int icon, float zoom, float ex); - void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, float ex=0.0f); - void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, Math::Point corner, float ex); - void DrawWarning(Math::Point pos, Math::Point dim); - void DrawShadow(Math::Point pos, Math::Point dim, float deep=1.0f); - virtual bool Detect(Math::Point pos); - -protected: - CInstanceManager* m_iMan; - Gfx::CEngine* m_engine; - CEventQueue* m_event; - CRobotMain* m_main; - Gfx::CParticle* m_particle; - CSoundInterface* m_sound; - - Math::Point m_pos; // corner upper / left - Math::Point m_dim; // dimensions - int m_icon; - EventType m_eventType; // message to send when clicking - int m_state; // states (STATE_ *) - float m_fontSize; // size of the button name - float m_fontStretch; // stretch of the font - Gfx::FontType m_fontType; // type of font - Gfx::TextAlign m_textAlign; //type of alignment //comes in the place of m_justif -// int m_justif; // type of justification (-1,0,1) - char m_name[100]; // name of the button - char m_tooltip[100]; // name of tooltip - bool m_bFocus; - bool m_bCapture; - - bool m_bGlint; - Math::Point m_glintCorner1; - Math::Point m_glintCorner2; - float m_glintProgress; - Math::Point m_glintMouse; -}; + enum ControlState + { + STATE_ENABLE = (1<<0), // active + STATE_CHECK = (1<<1), // pressed + STATE_HILIGHT = (1<<2), // overflown by mouse + STATE_PRESS = (1<<3), // pressed by mouse + STATE_VISIBLE = (1<<4), // visible + STATE_DEAD = (1<<5), // inaccessible (x) + STATE_DEFAULT = (1<<6), // actuated by RETURN + STATE_OKAY = (1<<7), // green point at the bottom right + STATE_SHADOW = (1<<8), // shadow + STATE_GLINT = (1<<9), // dynamic reflection + STATE_CARD = (1<<10), // tab + STATE_EXTEND = (1<<11), // extended mode + STATE_SIMPLY = (1<<12), // undecorated + STATE_FRAME = (1<<13), // framework highlighting + STATE_WARNING = (1<<14), // framework hatched yellow / black + STATE_VALUE = (1<<15), // displays the value + STATE_RUN = (1<<16) // running program + }; + + + + class CControl + { + public: + // CControl(CInstanceManager* iMan); + CControl (); + virtual ~CControl(); + + virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); + + virtual bool EventProcess(const Event &event); + + virtual void SetPos(Math::Point pos); + virtual Math::Point GetPos(); + virtual void SetDim(Math::Point dim); + virtual Math::Point GetDim(); + virtual bool SetState(int state, bool bState); + virtual bool SetState(int state); + virtual bool ClearState(int state); + virtual bool TestState(int state); + virtual int GetState(); + virtual void SetIcon(int icon); + virtual int GetIcon(); + virtual void SetName(std::string name, bool bTooltip=true); + virtual std::string GetName(); + virtual void SetTextAlign(Gfx::TextAlign mode); + virtual int GetTextAlign(); + virtual void SetFontSize(float size); + virtual float GetFontSize(); + virtual void SetFontStretch(float stretch); + virtual float GetFontStretch(); + virtual void SetFontType(Gfx::FontType font); + virtual Gfx::FontType GetFontType(); + virtual bool SetTooltip(std::string name); + virtual bool GetTooltip(Math::Point pos, std::string &name); + virtual void SetFocus(bool bFocus); + virtual bool GetFocus(); + + virtual EventType GetEventType(); + + virtual void Draw(); + + protected: + void GlintDelete(); + void GlintCreate(Math::Point ref, bool bLeft=true, bool bUp=true); + void GlintFrame(const Event &event); + void DrawPart(int icon, float zoom, float ex); + void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, float ex=0.0f); + void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, Math::Point corner, float ex); + void DrawWarning(Math::Point pos, Math::Point dim); + void DrawShadow(Math::Point pos, Math::Point dim, float deep=1.0f); + virtual bool Detect(Math::Point pos); + + protected: + CInstanceManager* m_iMan; + Gfx::CEngine* m_engine; + CEventQueue* m_event; + CRobotMain* m_main; + Gfx::CParticle* m_particle; + CSoundInterface* m_sound; + + Math::Point m_pos; // corner upper / left + Math::Point m_dim; // dimensions + int m_icon; + EventType m_eventType; // message to send when clicking + int m_state; // states (STATE_ *) + float m_fontSize; // size of the button name + float m_fontStretch; // stretch of the font + Gfx::FontType m_fontType; // type of font + Gfx::TextAlign m_textAlign; //type of alignment //comes in the place of m_justif + // int m_justif; // type of justification (-1,0,1) + std::string m_name; // name of the button + std::string m_tooltip; // name of tooltip + bool m_bFocus; + bool m_bCapture; + + bool m_bGlint; + Math::Point m_glintCorner1; + Math::Point m_glintCorner2; + float m_glintProgress; + Math::Point m_glintMouse; + }; } |