diff --git a/Controls/Frame.moon b/Controls/Frame.moon index 0426a07..50e8d8f 100644 --- a/Controls/Frame.moon +++ b/Controls/Frame.moon @@ -38,7 +38,7 @@ class Frame extends Content @toolBarColor = t.frame.toolBarColor @toolBarColorUnfocused = t.frame.toolBarColorUnfocused @backgroundColor = t.frame.contentBackground - + @toolBarTitleColor = t.frame.toolBarTitleColor @closeBtn = Button "Box" with @closeBtn @@ -61,6 +61,8 @@ class Frame extends Content @setDrag true @setMakeTopWhenClicked true + @setToolBarTitle label, math.ceil(@toolBarHeight/2) + onDraw: => drawToolBar @ @@ -68,6 +70,9 @@ class Frame extends Content r, g, b, a = Graphics.getColor! boxW, boxH = box\getWidth!, box\getHeight! + Graphics.setColor @toolBarTitleColor + Graphics.draw @toolBarTitle, box.x + @titleOffSet, box.y + @titleOffSet + Graphics.setColor @backgroundColor Graphics.rectangle "fill", box.x, box.y + @toolBarHeight, boxW, boxH - @toolBarHeight, @rx, @ry @@ -107,12 +112,11 @@ class Frame extends Content manager\setFocus @ @onFocus! -<<<<<<< HEAD onClick: => manager\setFocus @ @onFocus! - setToolBarTitle: (text = @text, size, font) => + setToolBarTitle: (text = @text, size = 15, font) => if size and font if type(font) == "number" then @font = Graphics.newFont font if type(font) == "string" then @font = Graphics.newFont font, size @@ -123,7 +127,5 @@ class Frame extends Content @titleOffSet = math.floor ((@toolBarHeight-1) / 2) - (size/2) -======= ->>>>>>> parent of 36c498a (Frame toolbar title.) Frame \ No newline at end of file diff --git a/Controls/themes/blues.moon b/Controls/themes/blues.moon index 716599d..514ca7e 100644 --- a/Controls/themes/blues.moon +++ b/Controls/themes/blues.moon @@ -25,6 +25,7 @@ Default = toolBarColor: {0.161, 0.29, 0.478} toolBarColorUnfocused: {0.62, 0.62, 0.576} contentBackground: {0.082, 0.086, 0.09} + toolBarTitleColor: {1, 1, 1} button: width: 100 diff --git a/src/Core/Control.moon b/src/Core/Control.moon index a26fae0..523095a 100644 --- a/src/Core/Control.moon +++ b/src/Core/Control.moon @@ -190,8 +190,7 @@ class Control if @childrenEnabled for i = #@children, 1, -1 - control = @children[i] - hitControl = control\hitTest x, y + hitControl = @children[i]\hitTest x, y if hitControl then return hitControl if @enabled @@ -449,6 +448,7 @@ class Control @children[i]\setParent nil Tremove @children, i child.events\dispatch child.events\getEvent "UI_ON_REMOVE" + child = nil break --- drops the control children.