pretty input box

This commit is contained in:
Manuel Simon Hirsig
2016-01-23 17:18:57 +01:00
parent b1641ad0b8
commit b310ab5558
5 changed files with 137 additions and 53 deletions
+2 -3
View File
@@ -366,10 +366,9 @@
<EdgeSize>
<AbsValue val="1.5"/>
</EdgeSize>
<Color r="0.09411764705882353" g="0.09411764705882353" b="0.09411764705882353" a="0.93"/>
<Color r="0.09411764705882353" g="0.09411764705882353" b="0.09411764705882353"/>
<!--24/255-->
<BorderColor r="0.11764705882352941" g="0.11764705882352941" b="0.11764705882352941"/>
<!--30/255-->
<BorderColor r="1" g="1" b="1" a="0.03"/>
</Backdrop>
<Frames>
<Button name="AuxCloseButton" inherits="UIPanelCloseButton">
+57 -9
View File
@@ -8,6 +8,7 @@ m.config = {
content_color = {42/255, 42/255, 42/255, 1},
content_border_color = {0, 0, 0, 0},
content_font = [[Fonts\ARIALN.TTF]],
normal_font_size = 15,
}
function m.button(parent, text_height, name)
@@ -86,12 +87,17 @@ do
image:SetAllPoints()
image:SetTexture(unpack(m.config.content_color))
tab.image = image
local bottom = tab:CreateTexture(nil, 'OVERLAY')
bottom:SetHeight(2)
bottom:SetPoint('BOTTOMLEFT', 1, -1)
bottom:SetPoint('BOTTOMRIGHT', -1, -1)
bottom:SetTexture(unpack(m.config.frame_color))
tab.bottom = bottom
local dock = tab:CreateTexture(nil, 'OVERLAY')
dock:SetHeight(2)
if position == 'TOP' then
dock:SetPoint('BOTTOMLEFT', 1, -1)
dock:SetPoint('BOTTOMRIGHT', -1, -1)
else
dock:SetPoint('TOPLEFT', 1, 1)
dock:SetPoint('TOPRIGHT', -1, 1)
end
dock:SetTexture(unpack(m.config.frame_color))
tab.dock = dock
local highlight = tab:CreateTexture(nil, 'HIGHLIGHT')
highlight:SetAllPoints()
highlight:SetTexture(1, 1, 1, .2)
@@ -149,20 +155,20 @@ do
-- TSMAPI.Design:SetWidgetLabelColor(tab.text, true)
-- tab:Disable()
-- tab.text = tab:GetText()
-- tab.bottom:Hide()
-- tab.dock:Hide()
if tab.group.selected == tab.id then
-- TSMAPI.Design:SetWidgetLabelColor(tab.text)
tab.text:SetTextColor(255/255, 254/255, 250/255) -- TODO
tab:Disable()
tab.image:SetTexture(unpack(m.config.frame_color))
tab.bottom:Show()
tab.dock:Show()
tab:SetHeight(29)
else
-- TSMAPI.Design:SetWidgetTextColor(tab.text)
tab.text:SetTextColor(255/255, 254/255, 250/255) -- TODO
tab:Enable()
tab.image:SetTexture(unpack(m.config.content_color))
tab.bottom:Hide()
tab.dock:Hide()
tab:SetHeight(24)
end
end
@@ -198,4 +204,46 @@ do
return self
end
end
do
local id = 0
function m.editbox(parent, name)
id = id + 1
-- local frame = CreateFrame('Frame', name, parent)
-- frame:Hide()
local editbox = CreateFrame('EditBox', name, parent)
editbox.selector = Aux.completion.selector(editbox)
editbox:SetAutoFocus(false)
-- editbox:SetScript("OnEnter", Control_OnEnter)
-- editbox:SetScript("OnLeave", Control_OnLeave)
-- editbox:SetScript("OnEscapePressed", EditBox_OnEscapePressed)
-- editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed)
-- editbox:SetScript("OnTextChanged", EditBox_OnTextChanged)
-- editbox:SetScript("OnReceiveDrag", EditBox_OnReceiveDrag)
-- editbox:SetScript("OnMouseDown", EditBox_OnReceiveDrag)
-- editbox:SetScript("OnEditFocusGained", EditBox_OnFocusGained)
-- editbox:SetScript("OnEditFocusLost", EditBox_OnFocusLost)
editbox:SetTextInsets(0, 0, 3, 3)
editbox:SetMaxLetters(256)
editbox:SetHeight(19)
editbox:SetFont(m.config.content_font, m.config.normal_font_size)
editbox:SetShadowColor(0, 0, 0, 0)
editbox:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size})
editbox:SetBackdropColor(unpack(m.config.content_color))
editbox:SetBackdropBorderColor(unpack(m.config.content_border_color))
-- local label = frame:CreateFontString(nil, 'OVERLAY')
-- label:SetPoint('TOPLEFT', 0, -2)
-- label:SetPoint('TOPRIGHT', 0, -2)
-- label:SetJustifyH('LEFT')
-- label:SetJustifyV('CENTER')
-- label:SetHeight(18)
-- label:SetFont(m.config.content_font, m.config.normal_font_size)
-- label:SetShadowColor(0, 0, 0, 0)
return editbox
end
end
+36
View File
@@ -497,6 +497,42 @@ function public.on_load()
tab_group.on_select = Aux.item_search_frame.set_view
tab_group:set_tab(aux_view)
end
do
local editbox = Aux.gui.editbox(AuxItemSearchFrameItem, '$parentItemInputBox')
editbox.selector = Aux.completion.selector(editbox)
editbox:SetPoint('TOP', 0, -28)
editbox:SetWidth(185)
editbox:SetScript('OnTextChanged', function()
this.selector.suggest()
end)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
this.selector.previous()
else
this.selector.next()
end
end)
editbox:SetScript('OnEnterPressed', function()
if this.selector.selected_value() then
this:ClearFocus()
end
end)
editbox:SetScript('OnEditFocusLost', function()
this.selector.close()
if this.selector.selected_value() then
Aux.item_search_frame.set_item(this.selector.selected_value())
end
if Aux.item_search_frame.item_set() then
this:Hide()
this.selector.clear()
Aux.item_search_frame.update_item()
end
end)
editbox:SetScript('OnEscapePressed', function()
this.selector.clear()
this:ClearFocus()
end)
end
end
function public.dialog_cancel()
+39 -39
View File
@@ -36,45 +36,45 @@
</scripts>
</Button>
<EditBox name="$parentItemInputBox" autoFocus="false" inherits="AuxInputBoxTemplate">
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="2" y="-28"/></Offset></Anchor></Anchors>
<Scripts>
<OnLoad>
this.selector = Aux.completion.selector(this)
this:SetWidth(185)
</OnLoad>
<OnTextChanged>
this.selector.suggest()
</OnTextChanged>
<OnTabPressed>
if IsShiftKeyDown() then
this.selector.previous()
else
this.selector.next()
end
</OnTabPressed>
<OnEnterPressed>
if this.selector.selected_value() then
this:ClearFocus()
end
</OnEnterPressed>
<OnEditFocusLost>
this.selector.close()
if this.selector.selected_value() then
Aux.item_search_frame.set_item(this.selector.selected_value())
end
if Aux.item_search_frame.item_set() then
this:Hide()
this.selector.clear()
Aux.item_search_frame.update_item()
end
</OnEditFocusLost>
<OnEscapePressed>
this.selector.clear()
this:ClearFocus()
</OnEscapePressed>
</Scripts>
</EditBox>
<!--<EditBox name="$parentItemInputBox" autoFocus="false" inherits="AuxInputBoxTemplate">-->
<!--<Anchors><Anchor point="TOP"><Offset><AbsDimension x="2" y="-28"/></Offset></Anchor></Anchors>-->
<!--<Scripts>-->
<!--<OnLoad>-->
<!--this.selector = Aux.completion.selector(this)-->
<!--this:SetWidth(185)-->
<!--</OnLoad>-->
<!--<OnTextChanged>-->
<!--this.selector.suggest()-->
<!--</OnTextChanged>-->
<!--<OnTabPressed>-->
<!--if IsShiftKeyDown() then-->
<!--this.selector.previous()-->
<!--else-->
<!--this.selector.next()-->
<!--end-->
<!--</OnTabPressed>-->
<!--<OnEnterPressed>-->
<!--if this.selector.selected_value() then-->
<!--this:ClearFocus()-->
<!--end-->
<!--</OnEnterPressed>-->
<!--<OnEditFocusLost>-->
<!--this.selector.close()-->
<!--if this.selector.selected_value() then-->
<!--Aux.item_search_frame.set_item(this.selector.selected_value())-->
<!--end-->
<!--if Aux.item_search_frame.item_set() then-->
<!--this:Hide()-->
<!--this.selector.clear()-->
<!--Aux.item_search_frame.update_item()-->
<!--end-->
<!--</OnEditFocusLost>-->
<!--<OnEscapePressed>-->
<!--this.selector.clear()-->
<!--this:ClearFocus()-->
<!--</OnEscapePressed>-->
<!--</Scripts>-->
<!--</EditBox>-->
<!--<Button name="$parentRefreshButton" inherits="UIPanelButtonTemplate" text="Refresh" disabled="true">-->
<!--<Size><AbsDimension x="90" y="26"/></Size>-->
+3 -2
View File
@@ -82,11 +82,12 @@ function public.create(params)
local scrollbar = getglobal(scroll_frame:GetName()..'ScrollBar')
scrollbar:SetPoint('TOPLEFT', scroll_frame, 'TOPRIGHT', 6, -4)
scrollbar:SetPoint('BOTTOMLEFT', scroll_frame, 'BOTTOMRIGHT', 6, 4)
scrollbar:SetWidth(12)
local thumbTex = scrollbar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0)
thumbTex:SetTexture(42/255, 42/255, 42/255, 1)
thumbTex:SetHeight(params.frame:GetHeight() * .4)
thumbTex:SetWidth(scrollbar:GetWidth())
thumbTex:SetHeight(50)
thumbTex:SetWidth(12)
local scrollbg = scrollbar:CreateTexture(nil, 'BACKGROUND')
scrollbg:SetAllPoints(scrollbar)
scrollbg:SetTexture(24/255, 24/255, 24/255, 1)