Browse Source

Renamed "Label Offset" attribute in Button to "Pressed Child Offset" to more accurately reflect what it does.

Lasse Öörni 12 years ago
parent
commit
9ff5b3d222

+ 2 - 2
Bin/Data/UI/DefaultStyle.xml

@@ -8,7 +8,7 @@
         <attribute name="Border" value="4 4 4 4" />
         <attribute name="Pressed Image Offset" value="16 0" />
         <attribute name="Hover Image Offset" value="0 16" />
-        <attribute name="Label Offset" value="-1 1" />
+        <attribute name="Pressed Child Offset" value="-1 1" />
     </element>
     <element type="CheckBox" style="BorderImage">
         <attribute name="Min Size" value="16 16" />
@@ -65,7 +65,7 @@
         <attribute name="Border" value="4 4 4 4" />
         <attribute name="Pressed Image Offset" value="16 0" />
         <attribute name="Hover Image Offset" value="0 16" />
-        <attribute name="Label Offset" value="-1 1" />
+        <attribute name="Pressed Child Offset" value="-1 1" />
         <attribute name="Layout Mode" value="Horizontal" />
         <attribute name="Layout Border" value="4 1 4 1" />
         <element internal="true">

+ 6 - 6
Docs/ScriptAPI.dox

@@ -3768,7 +3768,7 @@ Methods:<br>
 - void SetFullImageRect()
 - void SetHoverOffset(int, int)
 - void SetPressedOffset(int, int)
-- void SetLabelOffset(int, int)
+- void SetPressedChildOffset(int, int)
 - void SetRepeat(float, float)
 
 Properties:<br>
@@ -3843,7 +3843,7 @@ Properties:<br>
 - BlendMode blendMode
 - bool tiled
 - IntVector2 pressedOffset
-- IntVector2 labelOffset
+- IntVector2 pressedChildOffset
 - float repeatDelay
 - float repeatRate
 - bool pressed (readonly)
@@ -5077,7 +5077,7 @@ Methods:<br>
 - void SetFullImageRect()
 - void SetHoverOffset(int, int)
 - void SetPressedOffset(int, int)
-- void SetLabelOffset(int, int)
+- void SetPressedChildOffset(int, int)
 - void SetRepeat(float, float)
 - void SetPopupOffset(int, int)
 - void SetAccelerator(int, int)
@@ -5154,7 +5154,7 @@ Properties:<br>
 - BlendMode blendMode
 - bool tiled
 - IntVector2 pressedOffset
-- IntVector2 labelOffset
+- IntVector2 pressedChildOffset
 - float repeatDelay
 - float repeatRate
 - bool pressed (readonly)
@@ -5222,7 +5222,7 @@ Methods:<br>
 - void SetFullImageRect()
 - void SetHoverOffset(int, int)
 - void SetPressedOffset(int, int)
-- void SetLabelOffset(int, int)
+- void SetPressedChildOffset(int, int)
 - void SetRepeat(float, float)
 - void SetAccelerator(int, int)
 - void AddItem(UIElement@)
@@ -5305,7 +5305,7 @@ Properties:<br>
 - BlendMode blendMode
 - bool tiled
 - IntVector2 pressedOffset
-- IntVector2 labelOffset
+- IntVector2 pressedChildOffset
 - float repeatDelay
 - float repeatRate
 - bool pressed (readonly)

+ 3 - 3
Engine/Script/APITemplates.h

@@ -1037,12 +1037,12 @@ template <class T> void RegisterButton(asIScriptEngine* engine, const char* clas
 {
     RegisterBorderImage<T>(engine, className);
     engine->RegisterObjectMethod(className, "void SetPressedOffset(int, int)", asMETHODPR(T, SetPressedOffset, (int, int), void), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void SetLabelOffset(int, int)", asMETHODPR(T, SetLabelOffset, (int, int), void), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void SetPressedChildOffset(int, int)", asMETHODPR(T, SetPressedChildOffset, (int, int), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void SetRepeat(float, float)", asMETHOD(T, SetRepeat), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_pressedOffset(const IntVector2&in)", asMETHODPR(T, SetPressedOffset, (const IntVector2&), void), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "const IntVector2& get_pressedOffset() const", asMETHOD(T, GetPressedOffset), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void set_labelOffset(const IntVector2&in)", asMETHODPR(T, SetLabelOffset, (const IntVector2&), void), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "const IntVector2& get_labelOffset() const", asMETHOD(T, GetLabelOffset), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void set_pressedChildOffset(const IntVector2&in)", asMETHODPR(T, SetPressedChildOffset, (const IntVector2&), void), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "const IntVector2& get_pressedChildOffset() const", asMETHOD(T, GetPressedChildOffset), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_repeatDelay(float)", asMETHOD(T, SetRepeatDelay), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "float get_repeatDelay() const", asMETHOD(T, GetRepeatDelay), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_repeatRate(float)", asMETHOD(T, SetRepeatRate), asCALL_THISCALL);

+ 7 - 7
Engine/UI/Button.cpp

@@ -36,7 +36,7 @@ extern const char* UI_CATEGORY;
 Button::Button(Context* context) :
     BorderImage(context),
     pressedOffset_(IntVector2::ZERO),
-    labelOffset_(IntVector2::ZERO),
+    pressedChildOffset_(IntVector2::ZERO),
     repeatDelay_(1.0f),
     repeatRate_(0.0f),
     repeatTimer_(0.0f),
@@ -56,7 +56,7 @@ void Button::RegisterObject(Context* context)
     COPY_BASE_ATTRIBUTES(Button, BorderImage);
     UPDATE_ATTRIBUTE_DEFAULT_VALUE(Button, "Is Enabled", true);
     REF_ACCESSOR_ATTRIBUTE(Button, VAR_INTVECTOR2, "Pressed Image Offset", GetPressedOffset, SetPressedOffset, IntVector2, IntVector2::ZERO, AM_FILE);
-    REF_ACCESSOR_ATTRIBUTE(Button, VAR_INTVECTOR2, "Label Offset", GetLabelOffset, SetLabelOffset, IntVector2, IntVector2::ZERO, AM_FILE);
+    REF_ACCESSOR_ATTRIBUTE(Button, VAR_INTVECTOR2, "Pressed Child Offset", GetPressedChildOffset, SetPressedChildOffset, IntVector2, IntVector2::ZERO, AM_FILE);
     ACCESSOR_ATTRIBUTE(Button, VAR_FLOAT, "Repeat Delay", GetRepeatDelay, SetRepeatDelay, float, 1.0f, AM_FILE);
     ACCESSOR_ATTRIBUTE(Button, VAR_FLOAT, "Repeat Rate", GetRepeatRate, SetRepeatRate, float, 0.0f, AM_FILE);
 }
@@ -140,14 +140,14 @@ void Button::SetPressedOffset(int x, int y)
     pressedOffset_ = IntVector2(x, y);
 }
 
-void Button::SetLabelOffset(const IntVector2& offset)
+void Button::SetPressedChildOffset(const IntVector2& offset)
 {
-    labelOffset_ = offset;
+    pressedChildOffset_ = offset;
 }
 
-void Button::SetLabelOffset(int x, int y)
+void Button::SetPressedChildOffset(int x, int y)
 {
-    labelOffset_ = IntVector2(x, y);
+    pressedChildOffset_ = IntVector2(x, y);
 }
 
 void Button::SetRepeat(float delay, float rate)
@@ -169,7 +169,7 @@ void Button::SetRepeatRate(float rate)
 void Button::SetPressed(bool enable)
 {
     pressed_ = enable;
-    SetChildOffset(pressed_ ? labelOffset_ : IntVector2::ZERO);
+    SetChildOffset(pressed_ ? pressedChildOffset_ : IntVector2::ZERO);
 }
 
 }

+ 7 - 7
Engine/UI/Button.h

@@ -55,10 +55,10 @@ public:
     void SetPressedOffset(const IntVector2& offset);
     /// Set offset to image rectangle used when pressed.
     void SetPressedOffset(int x, int y);
-    /// Set pressed label offset.
-    void SetLabelOffset(const IntVector2& offset);
-    /// Set pressed label offset.
-    void SetLabelOffset(int x, int y);
+    /// Set offset of child elements when pressed.
+    void SetPressedChildOffset(const IntVector2& offset);
+    /// Set offset of child elements when pressed.
+    void SetPressedChildOffset(int x, int y);
     /// Set repeat properties. Rate 0 (default) disables repeat.
     void SetRepeat(float delay, float rate);
     /// Set repeat delay.
@@ -68,8 +68,8 @@ public:
     
     /// Return pressed image offset.
     const IntVector2& GetPressedOffset() const { return pressedOffset_; }
-    /// Return pressed label offset.
-    const IntVector2& GetLabelOffset() const { return labelOffset_; }
+    /// Return offset of child elements when pressed.
+    const IntVector2& GetPressedChildOffset() const { return pressedChildOffset_; }
     /// Return repeat delay.
     float GetRepeatDelay() const { return repeatDelay_; }
     /// Return repeat rate.
@@ -84,7 +84,7 @@ protected:
     /// Pressed image offset.
     IntVector2 pressedOffset_;
     /// Pressed label offset.
-    IntVector2 labelOffset_;
+    IntVector2 pressedChildOffset_;
     /// Repeat delay.
     float repeatDelay_;
     /// Repeat rate.

+ 4 - 4
Extras/LuaScript/pkgs/UI/Button.pkg

@@ -7,20 +7,20 @@ class Button : public BorderImage
     
     void SetPressedOffset(const IntVector2& offset);
     void SetPressedOffset(int x, int y);
-    void SetLabelOffset(const IntVector2& offset);
-    void SetLabelOffset(int x, int y);
+    void SetPressedChildOffset(const IntVector2& offset);
+    void SetPressedChildOffset(int x, int y);
     void SetRepeat(float delay, float rate);
     void SetRepeatDelay(float delay);
     void SetRepeatRate(float rate);
     
     const IntVector2& GetPressedOffset() const;
-    const IntVector2& GetLabelOffset() const;
+    const IntVector2& GetPressedChildOffset() const;
     float GetRepeatDelay() const;
     float GetRepeatRate() const;
     bool IsPressed() const;
     
     tolua_property__get_set IntVector2& pressedOffset;
-    tolua_property__get_set IntVector2& labelOffset;
+    tolua_property__get_set IntVector2& pressedChildOffset;
     tolua_property__get_set float repeatDelay;
     tolua_property__get_set float repeatRate;
     tolua_readonly tolua_property__is_set bool pressed;