mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Added UIGridLayout.
Also some fixes for the UI layouts and ScrollView. --HG-- branch : dev
This commit is contained in:
@@ -122,7 +122,10 @@ class EE_API TextureFactory : protected Mutex {
|
||||
void setCurrentTexture( const int& TexId, const Uint32& TextureUnit );
|
||||
|
||||
/** Returns the number of textures loaded */
|
||||
Uint32 getNumTextures() const { return (Uint32)mTextures.size(); }
|
||||
Uint32 getTextureCount() const { return (Uint32)mTextures.size(); }
|
||||
|
||||
/** @return All the active textures */
|
||||
std::vector<Texture*> getTextures();
|
||||
|
||||
/** Set the texture enviroment
|
||||
* @param Param The texture param
|
||||
|
||||
@@ -225,7 +225,7 @@ class EE_API Color : public tColor<Uint8>
|
||||
/** Blend a source color to destination color */
|
||||
static Color blend( Color src, Color dst );
|
||||
|
||||
static Color colorFromPointer( void *ptr );
|
||||
static Color fromPointer( void *ptr );
|
||||
|
||||
static Color fromString( const char * str );
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <eepp/ui/uirelativelayout.hpp>
|
||||
#include <eepp/ui/uiloader.hpp>
|
||||
#include <eepp/ui/uiscrollview.hpp>
|
||||
#include <eepp/ui/uigridlayout.hpp>
|
||||
#include <eepp/ui/tools/textureatlaseditor.hpp>
|
||||
|
||||
#include <eepp/ui/uithemedefault.hpp>
|
||||
|
||||
@@ -219,7 +219,7 @@ class EE_API UIControl {
|
||||
|
||||
Sizei getSkinSize();
|
||||
|
||||
UIControl * getNextComplexControl();
|
||||
UIControl * getNextWidget();
|
||||
|
||||
void applyDefaultTheme();
|
||||
|
||||
|
||||
82
include/eepp/ui/uigridlayout.hpp
Normal file
82
include/eepp/ui/uigridlayout.hpp
Normal file
@@ -0,0 +1,82 @@
|
||||
#ifndef EE_UI_UIGRIDLAYOUT
|
||||
#define EE_UI_UIGRIDLAYOUT
|
||||
|
||||
#include <eepp/ui/uiwidget.hpp>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
class EE_API UIGridLayout : public UIWidget {
|
||||
public:
|
||||
enum ElementMode
|
||||
{
|
||||
Size,
|
||||
Weight
|
||||
};
|
||||
|
||||
static UIGridLayout * New();
|
||||
|
||||
UIGridLayout();
|
||||
|
||||
virtual Uint32 getType() const;
|
||||
|
||||
virtual bool isType( const Uint32& type ) const;
|
||||
|
||||
Sizei getSpan() const;
|
||||
|
||||
UIGridLayout * setSpan(const Sizei& span);
|
||||
|
||||
ElementMode getColumnMode() const;
|
||||
|
||||
UIGridLayout * setColumnMode( const ElementMode& mode );
|
||||
|
||||
ElementMode getRowMode() const;
|
||||
|
||||
UIGridLayout * setRowMode( const ElementMode& mode );
|
||||
|
||||
Float getColumnWeight() const;
|
||||
|
||||
UIGridLayout * setColumnWeight(const Float & columnWeight);
|
||||
|
||||
int getColumnWidth() const;
|
||||
|
||||
UIGridLayout * setColumnWidth(int columnWidth);
|
||||
|
||||
int getRowHeight() const;
|
||||
|
||||
UIGridLayout * setRowHeight(int rowHeight);
|
||||
|
||||
Float getRowWeight() const;
|
||||
|
||||
UIGridLayout * setRowWeight(const Float & rowWeight);
|
||||
|
||||
Rect getPadding() const;
|
||||
|
||||
void setPadding(const Rect & padding);
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
Rect mPadding;
|
||||
Sizei mSpan;
|
||||
ElementMode mColumnMode;
|
||||
ElementMode mRowMode;
|
||||
Float mColumnWeight;
|
||||
int mColumnWidth;
|
||||
Float mRowWeight;
|
||||
int mRowHeight;
|
||||
|
||||
virtual void onSizeChange();
|
||||
|
||||
virtual void onChildCountChange();
|
||||
|
||||
virtual void onParentSizeChange( const Vector2i& SizeChange );
|
||||
|
||||
virtual Uint32 onMessage( const UIMessage * Msg );
|
||||
|
||||
Sizei getTargetElementSize();
|
||||
|
||||
void pack();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -106,6 +106,7 @@ enum UI_CONTROL_TYPES {
|
||||
UI_TYPE_LINEAR_LAYOUT,
|
||||
UI_TYPE_RELATIVE_LAYOUT,
|
||||
UI_TYPE_TOUCH_DRAGABLE_WIDGET,
|
||||
UI_TYPE_GRID_LAYOUT,
|
||||
UI_TYPE_USER = 10000
|
||||
};
|
||||
|
||||
|
||||
@@ -23,15 +23,11 @@ class EE_API UIImage : public UIWidget {
|
||||
|
||||
Drawable * getDrawable() const;
|
||||
|
||||
void setDrawable( Drawable * drawable );
|
||||
UIImage * setDrawable( Drawable * drawable );
|
||||
|
||||
const Color& getColor() const;
|
||||
|
||||
void setColor( const Color& col );
|
||||
|
||||
const EE_RENDER_MODE& getRenderMode() const;
|
||||
|
||||
void setRenderMode( const EE_RENDER_MODE& render );
|
||||
UIImage * setColor( const Color& col );
|
||||
|
||||
const Vector2i& getAlignOffset() const;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ class EE_API UILinearLayout : public UIWidget {
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
UI_ORIENTATION mOrientation;
|
||||
bool mAttrChangeReceive;
|
||||
|
||||
virtual Uint32 onMessage( const UIMessage * Msg );
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ class EE_API UIScrollView : public UITouchDragableWidget {
|
||||
UIScrollBar * mHScroll;
|
||||
UIControlAnim * mContainer;
|
||||
UIControl * mScrollView;
|
||||
Uint32 mSizeChangeCb;
|
||||
|
||||
virtual void onSizeChange();
|
||||
|
||||
@@ -58,6 +59,8 @@ class EE_API UIScrollView : public UITouchDragableWidget {
|
||||
|
||||
void onValueChangeCb( const UIEvent * Event );
|
||||
|
||||
void onScrollViewSizeChange( const UIEvent * Event );
|
||||
|
||||
void containerUpdate();
|
||||
|
||||
void updateScroll();
|
||||
|
||||
@@ -28,6 +28,8 @@ class EE_API UITouchDragableWidget : public UIWidget {
|
||||
Vector2f getTouchDragDeceleration() const;
|
||||
|
||||
UITouchDragableWidget * setTouchDragDeceleration( const Vector2f& touchDragDeceleration );
|
||||
|
||||
virtual void loadFromXmlNode( const pugi::xml_node& node );
|
||||
protected:
|
||||
Vector2f mTouchDragPoint;
|
||||
Vector2f mTouchDragAcceleration;
|
||||
|
||||
Reference in New Issue
Block a user