Add Show/Hide Title bar option.

This commit is contained in:
Xinhuan
2008-10-30 12:09:51 +08:00
parent b05e63e6f9
commit 8ff091dcbf
7 changed files with 48 additions and 3 deletions
+36 -3
View File
@@ -90,6 +90,7 @@ local defaults = {
FontOutline = "",
FontColor = {r = 1, g = 1, b = 1, a = 1,},
FontSize = 10,
ShowTitleBar = true,
},
Bar = {
Texture = "Blizzard",
@@ -645,7 +646,9 @@ function Omen:UpdateBackdrop()
local h = db.Background.EdgeSize * 2
self.Anchor:SetMinResize(90, h)
self.Title:SetMinResize(90, h)
if h > db.TitleBar.Height then
if not db.TitleBar.ShowTitleBar then
self.Title:SetHeight(0.0000000001) -- See comment in Omen:UpdateTitleBar()
elseif h > db.TitleBar.Height then
self.Title:SetHeight(h)
else
self.Title:SetHeight(db.TitleBar.Height)
@@ -654,6 +657,12 @@ function Omen:UpdateBackdrop()
--self.FocusButton:SetPoint("TOPRIGHT", -inset, -inset)
self.BarList:ClearAllPoints() -- See comment in Omen:UpdateTitleBar()
self.BarList:SetPoint("TOPLEFT", self.Title, "BOTTOMLEFT")
self.BarList:SetPoint("TOPRIGHT", self.Title, "BOTTOMRIGHT")
self.BarList:SetPoint("BOTTOMLEFT", self.Anchor, "BOTTOMLEFT")
self.BarList:SetPoint("BOTTOMRIGHT", self.Anchor, "BOTTOMRIGHT")
self:ResizeBars()
self:ReAnchorBars()
self:UpdateBars()
@@ -666,11 +675,24 @@ function Omen:UpdateTitleBar()
local color = db.TitleBar.FontColor
self.TitleText:SetFont(font, size, flags)
self.TitleText:SetTextColor(color.r, color.g, color.b, color.a)
if db.Background.EdgeSize * 2 > db.TitleBar.Height then
if not db.TitleBar.ShowTitleBar then
-- Yes, its a hack, since it can't be set to 0
self.Title:SetHeight(0.0000000001)
self.Title:Hide()
elseif db.Background.EdgeSize * 2 > db.TitleBar.Height then
self.Title:SetHeight(db.Background.EdgeSize * 2)
self.Title:Show()
else
self.Title:SetHeight(db.TitleBar.Height)
self.Title:Show()
end
-- This forces the UI to redraw it, I couldn't find a better way. Although it is
-- anchored to the Title, it doesn't update automatically on the height change.
self.BarList:ClearAllPoints()
self.BarList:SetPoint("TOPLEFT", self.Title, "BOTTOMLEFT")
self.BarList:SetPoint("TOPRIGHT", self.Title, "BOTTOMRIGHT")
self.BarList:SetPoint("BOTTOMLEFT", self.Anchor, "BOTTOMLEFT")
self.BarList:SetPoint("BOTTOMRIGHT", self.Anchor, "BOTTOMRIGHT")
end
function Omen:UpdateFuBarSettings()
@@ -1868,6 +1890,7 @@ local options = {
set = function(info, value)
db.TitleBar[ info[#info] ] = value
Omen:UpdateTitleBar()
Omen:UpdateBars()
end,
args = {
intro = {
@@ -1875,9 +1898,15 @@ local options = {
type = "description",
name = L["Configure title bar settings."],
},
ShowTitleBar = {
type = "toggle",
order = 2,
name = L["Show Title Bar"],
desc = L["Show the Omen Title Bar"],
},
Height = {
type = "range",
order = 2,
order = 5,
name = L["Title Bar Height"],
desc = L["Height of the title bar. The minimum height allowed is twice the background border thickness."],
min = 2, max = 32, step = 1,
@@ -1887,6 +1916,10 @@ local options = {
name = L["Title Text Options"],
guiInline = true,
order = 20,
set = function(info, value)
db.TitleBar[ info[#info] ] = value
Omen:UpdateTitleBar()
end,
args = {
Font = {
type = "select", dialogControl = 'LSM30_Font',