Project

General

Profile

SO3Engine
SO3BitmapWidget.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
32#ifndef __SO3_BITMAP_WIDGET_H__
33#define __SO3_BITMAP_WIDGET_H__
34
36#include "SO3Widget.h"
37
38namespace SO3
39{
40
41#define SO3_BITMAP_WIDGET_TYPE "BitmapWidget"
42
43class SBitmapWidget : public SWidget
44{
45public:
46protected:
47private:
48 unsigned int iLastWidth;
49 unsigned int iLastHeight;
50 bool bLastAlphaState;
51 void* pixelsData;
52
53public:
57 SBitmapWidget(SScene* targetScene, const std::string& bitmapWidgetName, const int& xPos, const int& yPos, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SViewPort* targetViewport, const unsigned int& widgetZOrder);
58
62 SBitmapWidget(SScene* targetScene, const std::string& bitmapWidgetName, const int& xPos, const int& yPos, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SViewPort* targetViewport);
63
67 SBitmapWidget(SScene* targetScene, const std::string& bitmapWidgetName, const unsigned short& widgetWidth, const unsigned short& widgetHeight, SMaterial* targetMaterial, const unsigned short& targetTechnique, const unsigned short& targetPass, const unsigned short& targetTextureUnit);
68
73
78
82 virtual void LoadURL(const std::string& url);
83
87 virtual void LoadFile(const std::string& file);
88
92 void UpdateRawData(PtrObjBitmap scolBitmap);
93
97 void UpdateRawData(unsigned char* buffer, int width, int height, int bitperpixel);
98
102 void UpdateRawData(PtrObjBitmap scolBitmap, PtrObjBitmap scolAlphaBitmap);
103
107 virtual void InjectMouseMove(const int& xPos, const int& yPos, const MouseButtonId& button);
108
112 virtual void InjectMouseWheel(const int& scrollX, const int& scrollY, const int& relativeScroll);
113
117 virtual void InjectMouseDown(const int& xPos, const int& yPos, const MouseButtonId& button);
118
122 virtual void InjectMouseUp(const int& xPos, const int& yPos, const MouseButtonId& button);
123
127 virtual void InjectTouchAdd(const int& xPos, const int& yPos, const int& touchid);
128
132 virtual void InjectTouchRemove(const int& touchid);
133
137 virtual void InjectTouchUpdate(const int& xPos, const int& yPos, const int& vx, const int& vy, const int& touchid);
138
142 virtual void InjectKeyEvent(const UINT& msg, const ScolWindowHandle& hwnd, const WPARAM& wParam, const LPARAM& lParam);
143
147 virtual void InjectTextEvent(const std::string& utf8);
148
152 virtual void RunScriptFunction(const std::string& functionName, const std::vector<std::string>& argumentList);
153
157 virtual void loadResource(Ogre::Resource* resource);
158protected:
162 virtual void SetFocusImpl(const bool& focusOnWidget);
163
167 virtual void SetTransparencyImpl(const bool& enableTransparency);
168
172 virtual void SetKeyboardEnableImpl(const bool& enableKeyboardOnWidget);
173
177 virtual void SetMouseEnableImpl(const bool& enableMouseOnWidget);
178
182 virtual void SetSizeImpl(const unsigned short& newWidth, const unsigned short& newHeight);
183
187 virtual bool CheckPixelAlpha(const int& posX, const int& posY);
188private:
191 void CheckSizeAndAlloc(const unsigned int& newWidth, const unsigned int& newHeight, const bool& alpha);
192
193};
194
195}
196
197#endif
unsigned int UINT
Definition SO3Android.h:58
librairies include
virtual void SetKeyboardEnableImpl(const bool &enableKeyboardOnWidget)
virtual void SetMouseEnableImpl(const bool &enableMouseOnWidget)
virtual void SetFocusImpl(const bool &focusOnWidget)
virtual void InjectTouchUpdate(const int &xPos, const int &yPos, const int &vx, const int &vy, const int &touchid)
virtual void RunScriptFunction(const std::string &functionName, const std::vector< std::string > &argumentList)
virtual void LoadFile(const std::string &file)
virtual void InjectMouseWheel(const int &scrollX, const int &scrollY, const int &relativeScroll)
virtual void loadResource(Ogre::Resource *resource)
virtual void InjectTouchRemove(const int &touchid)
virtual void InjectTouchAdd(const int &xPos, const int &yPos, const int &touchid)
virtual void InjectMouseMove(const int &xPos, const int &yPos, const MouseButtonId &button)
virtual void LoadURL(const std::string &url)
virtual void InjectMouseDown(const int &xPos, const int &yPos, const MouseButtonId &button)
virtual void SetSizeImpl(const unsigned short &newWidth, const unsigned short &newHeight)
virtual void InjectTextEvent(const std::string &utf8)
virtual void InjectMouseUp(const int &xPos, const int &yPos, const MouseButtonId &button)
virtual bool CheckPixelAlpha(const int &posX, const int &posY)
void UpdateRawData(PtrObjBitmap scolBitmap)
virtual void SetTransparencyImpl(const bool &enableTransparency)
virtual void InjectKeyEvent(const UINT &msg, const ScolWindowHandle &hwnd, const WPARAM &wParam, const LPARAM &lParam)
unsigned short width
Definition SO3Widget.h:80
unsigned short height
Definition SO3Widget.h:81