added status bar
This commit is contained in:
@@ -9,6 +9,9 @@ m.config = {
|
||||
content_border_color = {0, 0, 0, 0},
|
||||
content_font = [[Fonts\ARIALN.TTF]],
|
||||
normal_font_size = 15,
|
||||
text_color = { enabled = { 255, 254, 250, 1 }, disabled = { 147, 151, 139, 1 } },
|
||||
label_color = { enabled = { 216, 225, 211, 1 }, disabled = { 150, 148, 140, 1 } },
|
||||
|
||||
}
|
||||
|
||||
function m.button(parent, text_height, name)
|
||||
@@ -88,7 +91,7 @@ do
|
||||
image:SetTexture(unpack(m.config.content_color))
|
||||
tab.image = image
|
||||
local dock = tab:CreateTexture(nil, 'OVERLAY')
|
||||
dock:SetHeight(2)
|
||||
dock:SetHeight(3)
|
||||
if position == 'TOP' then
|
||||
dock:SetPoint('BOTTOMLEFT', 1, -1)
|
||||
dock:SetPoint('BOTTOMRIGHT', -1, -1)
|
||||
@@ -158,7 +161,7 @@ do
|
||||
-- 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.text:SetTextColor(216/255, 225/255, 211/255) -- TODO
|
||||
tab:Disable()
|
||||
tab.image:SetTexture(unpack(m.config.frame_color))
|
||||
tab.dock:Show()
|
||||
@@ -206,34 +209,22 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local id = 0
|
||||
function m.editbox(parent, name)
|
||||
id = id + 1
|
||||
function m.editbox(parent, name)
|
||||
|
||||
-- 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 editbox = CreateFrame('EditBox', name, parent)
|
||||
editbox.selector = Aux.completion.selector(editbox)
|
||||
editbox:SetAutoFocus(false)
|
||||
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)
|
||||
@@ -244,6 +235,119 @@ do
|
||||
-- label:SetFont(m.config.content_font, m.config.normal_font_size)
|
||||
-- label:SetShadowColor(0, 0, 0, 0)
|
||||
|
||||
return editbox
|
||||
return editbox
|
||||
end
|
||||
|
||||
function m.status_bar(parent, base_name)
|
||||
local self = CreateFrame('Frame', nil, parent)
|
||||
|
||||
local level = parent:GetFrameLevel()
|
||||
|
||||
self:SetFrameLevel(level + 1)
|
||||
|
||||
do
|
||||
-- minor status bar (gray one)
|
||||
local status_bar = CreateFrame('STATUSBAR', base_name..'_minor', self, 'TextStatusBar')
|
||||
status_bar:SetOrientation('HORIZONTAL')
|
||||
status_bar:SetMinMaxValues(0, 100)
|
||||
status_bar:SetAllPoints()
|
||||
status_bar:SetStatusBarTexture('[[Interface\Buttons\WHITE8X8]]')
|
||||
status_bar:SetStatusBarColor(.42, .42, .42, .7)
|
||||
status_bar:SetFrameLevel(level + 2)
|
||||
-- local ag = status_bar:CreateAnimationGroup()
|
||||
-- local alpha = ag:CreateAnimation('Alpha')
|
||||
-- alpha:SetDuration(1)
|
||||
-- alpha:SetChange(-.5)
|
||||
-- ag:SetLooping('Bounce')
|
||||
-- status_bar.ag = ag
|
||||
self.minor_status_bar = status_bar
|
||||
end
|
||||
|
||||
do
|
||||
-- major status bar (main blue one)
|
||||
local status_bar = CreateFrame('STATUSBAR', base_name..'_major', self, 'TextStatusBar')
|
||||
status_bar:SetOrientation('HORIZONTAL')
|
||||
status_bar:SetMinMaxValues(0, 100)
|
||||
status_bar:SetAllPoints()
|
||||
status_bar:SetStatusBarTexture([[Interface\Buttons\WHITE8X8]])
|
||||
status_bar:SetStatusBarColor(.19, .22, .33, .9)
|
||||
status_bar:SetFrameLevel(level + 3)
|
||||
-- local ag = status_bar:CreateAnimationGroup()
|
||||
-- local alpha = ag:CreateAnimation('Alpha')
|
||||
-- alpha:SetDuration(1)
|
||||
-- alpha:SetChange(-.5)
|
||||
-- ag:SetLooping('Bounce')
|
||||
-- status_bar.ag = ag
|
||||
self.major_status_bar = status_bar
|
||||
end
|
||||
|
||||
do
|
||||
local text_frame = CreateFrame('Frame', nil, self)
|
||||
text_frame:SetFrameLevel(level + 4)
|
||||
text_frame:SetAllPoints(self)
|
||||
local text = m.create_label(text_frame)
|
||||
text:SetTextColor(unpack(m.config.text_color.enabled))
|
||||
text:SetPoint('CENTER', 0, 0)
|
||||
self.text = text
|
||||
end
|
||||
|
||||
function self:update_status(major_status, minor_status)
|
||||
if major_status then
|
||||
self.major_status_bar:SetValue(major_status)
|
||||
-- if major_status == 100 then
|
||||
-- self.major_status_bar.ag:Stop()
|
||||
-- elseif not self.major_status_bar.ag:IsPlaying() then
|
||||
-- self.major_status_bar.ag:Play()
|
||||
-- end
|
||||
end
|
||||
if minor_status then
|
||||
self.minor_status_bar:SetValue(minor_status)
|
||||
-- if minor_status == 100 then
|
||||
-- self.minor_status_bar.ag:Stop()
|
||||
-- elseif not self.minor_status_bar.ag:IsPlaying() then
|
||||
-- self.minor_status_bar.ag:Play()
|
||||
-- end
|
||||
end
|
||||
end
|
||||
|
||||
function self:set_text(text)
|
||||
self.text:SetText(text)
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function m.create_label(parent, size)
|
||||
local label = parent:CreateFontString()
|
||||
label:SetFont(m.config.content_font, size or m.config.normal_font_size)
|
||||
label:SetTextColor(unpack(m.config.label_color.enabled))
|
||||
return label
|
||||
end
|
||||
|
||||
function m.CreateHorizontalLine(parent, ofsy, relativeFrame, invertedColor)
|
||||
relativeFrame = relativeFrame or parent
|
||||
local barTex = parent:CreateTexture()
|
||||
barTex:SetPoint("TOPLEFT", relativeFrame, "TOPLEFT", 2, ofsy)
|
||||
barTex:SetPoint("TOPRIGHT", relativeFrame, "TOPRIGHT", -2, ofsy)
|
||||
barTex:SetHeight(2)
|
||||
if invertedColor then
|
||||
TSMAPI.Design:SetFrameColor(barTex)
|
||||
else
|
||||
TSMAPI.Design:SetContentColor(barTex)
|
||||
end
|
||||
return barTex
|
||||
end
|
||||
|
||||
function m.CreateVerticalLine(parent, ofsx, relativeFrame, invertedColor)
|
||||
relativeFrame = relativeFrame or parent
|
||||
local barTex = parent:CreateTexture()
|
||||
barTex:SetPoint("TOPLEFT", relativeFrame, "TOPLEFT", ofsx, -2)
|
||||
barTex:SetPoint("BOTTOMLEFT", relativeFrame, "BOTTOMLEFT", ofsx, 2)
|
||||
barTex:SetWidth(2)
|
||||
if invertedColor then
|
||||
TSMAPI.Design:SetFrameColor(barTex)
|
||||
else
|
||||
TSMAPI.Design:SetContentColor(barTex)
|
||||
end
|
||||
return barTex
|
||||
end
|
||||
Reference in New Issue
Block a user