mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 13:03:27 +02:00
fix compile error on mingw32, add lua events for channels
This commit is contained in:
41
src/framework/ui/uiimage.cpp
Normal file
41
src/framework/ui/uiimage.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "uiimage.h"
|
||||
#include <framework/otml/otmlnode.h>
|
||||
|
||||
void UIImage::draw(const Rect& screenCoords)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UIImage::applyStyle(const OTMLNodePtr& styleNode)
|
||||
{
|
||||
/*
|
||||
for(const OTMLNodePtr& node : styleNode->children()) {
|
||||
if(node->tag() == "image-source")
|
||||
setImageSource(node->value());
|
||||
else if(node->tag() == "image-clip")
|
||||
setImageClip(node->value<Rect>());
|
||||
else if(node->tag() == "image-rect")
|
||||
setImageRect(node->value<Rect>());
|
||||
else if(node->tag() == "image-fixed-ratio")
|
||||
setImageFixedRatio(node->value<bool>());
|
||||
else if(node->tag() == "image-repeated")
|
||||
setImageRepeated(node->value<bool>());
|
||||
else if(node->tag() == "image-smooth")
|
||||
setImageSmooth(node->value<bool>());
|
||||
else if(node->tag() == "image-color")
|
||||
setImageColor(node->value<Color>());
|
||||
else if(node->tag() == "image-border-top")
|
||||
setImageBorderTop(node->value<int>());
|
||||
else if(node->tag() == "image-border-right")
|
||||
setImageBorderRight(node->value<int>());
|
||||
else if(node->tag() == "image-border-bottom")
|
||||
setImageBorderBottom(node->value<int>());
|
||||
else if(node->tag() == "image-border-left")
|
||||
setImageBorderLeft(node->value<int>());
|
||||
else if(node->tag() == "image-border") {
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
69
src/framework/ui/uiimage.h
Normal file
69
src/framework/ui/uiimage.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2010-2011 OTClient <https://github.com/edubart/otclient>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef UIIMAGE_H
|
||||
#define UIIMAGE_H
|
||||
|
||||
#include <framework/graphics/declarations.h>
|
||||
#include <framework/otml/declarations.h>
|
||||
#include "declarations.h"
|
||||
|
||||
class UIImage
|
||||
{
|
||||
public:
|
||||
void draw(const Rect& screenCoords);
|
||||
void applyStyle(const OTMLNodePtr& styleNode);
|
||||
|
||||
void setImageSource(const std::string& source);
|
||||
void setImageClip(const Rect& clipRect);
|
||||
void setImageRect(const Rect& rect);
|
||||
void setImageFixedRatio(bool fixedRatio);
|
||||
void setImageRepeated(bool repeated);
|
||||
void setImageSmooth(bool smooth);
|
||||
void setImageColor(const Color& color);
|
||||
void setImageBorderTop(int border);
|
||||
void setImageBorderRight(int border);
|
||||
void setImageBorderBottom(int border);
|
||||
void setImageBorderLeft(int border);
|
||||
|
||||
protected:
|
||||
TexturePtr m_imageTexture;
|
||||
Rect m_imageClipRect;
|
||||
Rect m_imageRect;
|
||||
Boolean<false> m_imageFixedRatio;
|
||||
Boolean<false> m_imageRepeated;
|
||||
Color m_imageColor;
|
||||
|
||||
// border image coords
|
||||
Rect m_leftBorderTexCoords;
|
||||
Rect m_rightBorderTexCoords;
|
||||
Rect m_topBorderTexCoords;
|
||||
Rect m_bottomBorderTexCoords;
|
||||
Rect m_topLeftCornerTexCoords;
|
||||
Rect m_topRightCornerTexCoords;
|
||||
Rect m_bottomLeftCornerTexCoords;
|
||||
Rect m_bottomRightCornerTexCoords;
|
||||
Rect m_centerTexCoords;
|
||||
Size m_bordersSize;
|
||||
};
|
||||
|
||||
#endif
|
@@ -183,14 +183,14 @@ protected:
|
||||
protected:
|
||||
std::string m_id;
|
||||
Fw::FocusReason m_lastFocusReason;
|
||||
boolean<true> m_enabled;
|
||||
boolean<true> m_visible;
|
||||
boolean<true> m_focusable;
|
||||
boolean<false> m_fixedSize;
|
||||
boolean<false> m_pressed;
|
||||
boolean<false> m_phantom;
|
||||
boolean<false> m_updateEventScheduled;
|
||||
boolean<true> m_firstOnStyle;
|
||||
Boolean<true> m_enabled;
|
||||
Boolean<true> m_visible;
|
||||
Boolean<true> m_focusable;
|
||||
Boolean<false> m_fixedSize;
|
||||
Boolean<false> m_pressed;
|
||||
Boolean<false> m_phantom;
|
||||
Boolean<false> m_updateEventScheduled;
|
||||
Boolean<true> m_firstOnStyle;
|
||||
Rect m_rect;
|
||||
UILayoutPtr m_layout;
|
||||
UIWidgetWeakPtr m_parent;
|
||||
|
@@ -44,8 +44,8 @@ typedef std::function<bool()> BooleanCallback;
|
||||
|
||||
// boolean with default value initializer
|
||||
template<bool def>
|
||||
struct boolean {
|
||||
boolean() : v(def) { }
|
||||
struct Boolean {
|
||||
Boolean() : v(def) { }
|
||||
operator bool &() { return v; }
|
||||
operator bool const &() const { return v; }
|
||||
bool& operator=(const bool& o) { v = o; return v; }
|
||||
|
Reference in New Issue
Block a user