diff --git a/objects/base.lua b/objects/base.lua index f044ece..b6dd7c5 100644 --- a/objects/base.lua +++ b/objects/base.lua @@ -479,36 +479,55 @@ function newobject:CenterWithinArea(x, y, width, height) end --[[--------------------------------------------------------- - - func: SetSize(width, height) + - func: SetSize(width, height, r1, r2) - desc: sets the object's size --]]--------------------------------------------------------- -function newobject:SetSize(width, height) +function newobject:SetSize(width, height, r1, r2) - self.width = width - self.height = height + if r1 then + self.width = self.parent.width * width + else + self.width = width + end + + if r2 then + self.height = self.parent.height * height + else + self.height = height + end return self end --[[--------------------------------------------------------- - - func: SetWidth(width) + - func: SetWidth(width, relative) - desc: sets the object's width --]]--------------------------------------------------------- -function newobject:SetWidth(width) +function newobject:SetWidth(width, relative) - self.width = width + if relative then + self.width = self.parent.width * width + else + self.width = width + end + return self end --[[--------------------------------------------------------- - - func: SetHeight(height) + - func: SetHeight(height, relative) - desc: sets the object's height --]]--------------------------------------------------------- -function newobject:SetHeight(height) +function newobject:SetHeight(height, relative) - self.height = height + if relative then + self.height = self.parent.height * height + else + self.height = height + end + return self end diff --git a/objects/checkbox.lua b/objects/checkbox.lua index 0534171..9c51590 100644 --- a/objects/checkbox.lua +++ b/objects/checkbox.lua @@ -291,36 +291,55 @@ function newobject:GetText() end --[[--------------------------------------------------------- - - func: SetSize(width, height) + - func: SetSize(width, height, r1, r2) - desc: sets the object's size --]]--------------------------------------------------------- -function newobject:SetSize(width, height) +function newobject:SetSize(width, height, r1, r2) - self.boxwidth = width - self.boxheight = height + if r1 then + self.boxwidth = self.parent.width * width + else + self.boxwidth = width + end + + if r2 then + self.boxheight = self.parent.height * height + else + self.boxheight = height + end return self end --[[--------------------------------------------------------- - - func: SetWidth(width) + - func: SetWidth(width, relative) - desc: sets the object's width --]]--------------------------------------------------------- -function newobject:SetWidth(width) +function newobject:SetWidth(width, relative) - self.boxwidth = width + if relative then + self.boxwidth = self.parent.width * width + else + self.boxwidth = width + end + return self end --[[--------------------------------------------------------- - - func: SetHeight(height) + - func: SetHeight(height, relative) - desc: sets the object's height --]]--------------------------------------------------------- -function newobject:SetHeight(height) +function newobject:SetHeight(height, relative) - self.boxheight = height + if relative then + self.boxheight = self.parent.height * height + else + self.boxheight = height + end + return self end diff --git a/objects/collapsiblecategory.lua b/objects/collapsiblecategory.lua index 9508f23..4b08844 100644 --- a/objects/collapsiblecategory.lua +++ b/objects/collapsiblecategory.lua @@ -273,12 +273,17 @@ function newobject:GetObject() end --[[--------------------------------------------------------- - - func: SetSize(width, height) + - func: SetSize(width, height, relative) - desc: sets the object's size --]]--------------------------------------------------------- -function newobject:SetSize(width, height) +function newobject:SetSize(width, height, relative) - self.width = width + if relative then + self.width = self.parent.width * width + else + self.width = width + end + return self end diff --git a/objects/columnlist.lua b/objects/columnlist.lua index 81ecf27..b5fc1ea 100644 --- a/objects/columnlist.lua +++ b/objects/columnlist.lua @@ -296,16 +296,26 @@ function newobject:GetColumnSize() end --[[--------------------------------------------------------- - - func: SetSize(width, height) + - func: SetSize(width, height, r1, r2) - desc: sets the object's size --]]--------------------------------------------------------- -function newobject:SetSize(width, height) +function newobject:SetSize(width, height, r1, r2) local internals = self.internals local list = internals[1] - self.width = width - self.height = height + if r1 then + self.width = self.parent.width * width + else + self.width = width + end + + if r2 then + self.height = self.parent.height * height + else + self.height = height + end + self:AdjustColumns() list:SetSize(width, height) @@ -318,15 +328,20 @@ function newobject:SetSize(width, height) end --[[--------------------------------------------------------- - - func: SetWidth(width) + - func: SetWidth(width, relative) - desc: sets the object's width --]]--------------------------------------------------------- -function newobject:SetWidth(width) +function newobject:SetWidth(width, relative) local internals = self.internals local list = internals[1] - self.width = width + if relative then + self.width = self.parent.width * width + else + self.width = width + end + self:AdjustColumns() list:SetSize(width) @@ -339,15 +354,20 @@ function newobject:SetWidth(width) end --[[--------------------------------------------------------- - - func: SetHeight(height) + - func: SetHeight(height, relative) - desc: sets the object's height --]]--------------------------------------------------------- -function newobject:SetHeight(height) +function newobject:SetHeight(height, relative) local internals = self.internals local list = internals[1] - self.height = height + if relative then + self.height = self.parent.height * height + else + self.height = height + end + self:AdjustColumns() list:SetSize(height) diff --git a/objects/list.lua b/objects/list.lua index 93baef9..8cea958 100644 --- a/objects/list.lua +++ b/objects/list.lua @@ -589,12 +589,17 @@ function newobject:Clear() end --[[--------------------------------------------------------- - - func: SetWidth(width) + - func: SetWidth(width, relative) - desc: sets the object's width --]]--------------------------------------------------------- -function newobject:SetWidth(width) +function newobject:SetWidth(width, relative) - self.width = width + if relative then + self.width = self.parent.width * width + else + self.width = width + end + self:CalculateSize() self:RedoLayout() @@ -603,12 +608,17 @@ function newobject:SetWidth(width) end --[[--------------------------------------------------------- - - func: SetHeight(height) + - func: SetHeight(height, relative) - desc: sets the object's height --]]--------------------------------------------------------- -function newobject:SetHeight(height) +function newobject:SetHeight(height, relative) - self.height = height + if relative then + self.height = self.parent.height * height + else + self.height = height + end + self:CalculateSize() self:RedoLayout() @@ -617,13 +627,23 @@ function newobject:SetHeight(height) end --[[--------------------------------------------------------- - - func: GetSize() - - desc: gets the object's size + - func: SetSize(width, height, r1, r2) + - desc: sets the object's size --]]--------------------------------------------------------- -function newobject:SetSize(width, height) +function newobject:SetSize(width, height, r1, r2) - self.width = width - self.height = height + if r1 then + self.width = self.parent.width * width + else + self.width = width + end + + if r2 then + self.height = self.parent.height * height + else + self.height = height + end + self:CalculateSize() self:RedoLayout() diff --git a/objects/text.lua b/objects/text.lua index bd1b652..8462d35 100644 --- a/objects/text.lua +++ b/objects/text.lua @@ -590,12 +590,17 @@ function newobject:GetMaxWidth() end --[[--------------------------------------------------------- - - func: SetWidth(width) + - func: SetWidth(width, relative) - desc: sets the object's width --]]--------------------------------------------------------- -function newobject:SetWidth(width) +function newobject:SetWidth(width, relative) - self:SetMaxWidth(width) + if relative then + self:SetMaxWidth(self.parent.width * width) + else + self:SetMaxWidth(width) + end + return self end @@ -611,12 +616,17 @@ function newobject:SetHeight(height) end --[[--------------------------------------------------------- - - func: SetSize() + - func: SetSize(width, height, relative) - desc: sets the object's size --]]--------------------------------------------------------- -function newobject:SetSize(width, height) +function newobject:SetSize(width, height, relative) - self:SetMaxWidth(width) + if relative then + self:SetMaxWidth(self.parent.width * width) + else + self:SetMaxWidth(width) + end + return self end