Mercurial > wow > reaction
comparison Overlay.lua @ 77:da8ba8783924
- added revision updater to each code file
- Changed button/bar class mechanic to metatable-based
- Changed buttons to live within a sub-frame, to play nicely between show-empty-buttons and hidestates
- bar frame is now available only via accessor
- Changed some semantics with AddButton/PlaceButton
- Cleaned up action buttons options, fixed hide-when-empty option
- moved show-action-ID-label as a button method
- converted drag overlay from nested-frame to :Raise()
- fixed ReAction:SetConfigMode() to not call event when mode doesn't change
- Fixed ordering for dynamic state tab (always last)
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Mon, 23 Jun 2008 22:27:50 +0000 |
| parents | 06cd74bdc7da |
| children | 42ec2938d65a |
comparison
equal
deleted
inserted
replaced
| 76:c8c8610fd864 | 77:da8ba8783924 |
|---|---|
| 4 local InCombatLockdown = InCombatLockdown | 4 local InCombatLockdown = InCombatLockdown |
| 5 local floor = math.floor | 5 local floor = math.floor |
| 6 local min = math.min | 6 local min = math.min |
| 7 local format = string.format | 7 local format = string.format |
| 8 local GameTooltip = GameTooltip | 8 local GameTooltip = GameTooltip |
| 9 | |
| 10 ReAction:UpdateRevision("$Revision: 103 $") | |
| 9 | 11 |
| 10 -- Looking for a lightweight AceConfig3-struct-compatible | 12 -- Looking for a lightweight AceConfig3-struct-compatible |
| 11 -- replacement for Dewdrop (e.g. forthcoming AceConfigDropdown-3.0?). | 13 -- replacement for Dewdrop (e.g. forthcoming AceConfigDropdown-3.0?). |
| 12 -- Considering Blizzard's EasyMenu/UIDropDownMenu, but that's | 14 -- Considering Blizzard's EasyMenu/UIDropDownMenu, but that's |
| 13 -- a bit tricky to convert from AceConfig3-struct | 15 -- a bit tricky to convert from AceConfig3-struct |
| 53 | 55 |
| 54 -- | 56 -- |
| 55 -- Bar config overlay | 57 -- Bar config overlay |
| 56 -- | 58 -- |
| 57 -- localize some of these for small OnUpdate performance boost | 59 -- localize some of these for small OnUpdate performance boost |
| 58 local Bar = ReAction.Bar.prototype | 60 local Bar = ReAction.Bar |
| 59 local GetSize = Bar.GetSize | 61 local GetSize = Bar.GetSize |
| 60 local GetButtonSize = Bar.GetButtonSize | 62 local GetButtonSize = Bar.GetButtonSize |
| 61 local GetButtonGrid = Bar.GetButtonGrid | 63 local GetButtonGrid = Bar.GetButtonGrid |
| 62 local SetSize = Bar.SetSize | 64 local SetSize = Bar.SetSize |
| 63 local SetButtonSize = Bar.SetButtonSize | 65 local SetButtonSize = Bar.SetButtonSize |
| 411 | 413 |
| 412 f:SetMovable(true) | 414 f:SetMovable(true) |
| 413 f:SetResizable(true) | 415 f:SetResizable(true) |
| 414 f:SetClampedToScreen(true) | 416 f:SetClampedToScreen(true) |
| 415 | 417 |
| 416 -- buttons on the bar should be direct children of the bar frame. | 418 local control = CreateFrame("Button", nil, f) |
| 417 -- The control elements need to float on top of this, which we could | |
| 418 -- do with SetFrameLevel() or Raise(), but it's more reliable to do it | |
| 419 -- via frame nesting, hence good old foo's appearance here. | |
| 420 local foo = CreateFrame("Frame",nil,f) | |
| 421 foo:SetAllPoints() | |
| 422 foo:SetClampedToScreen(true) | |
| 423 | |
| 424 local control = CreateFrame("Button", nil, foo) | |
| 425 control:EnableMouse(true) | 419 control:EnableMouse(true) |
| 426 control:SetToplevel(true) | 420 control:SetToplevel(true) |
| 427 control:SetPoint("TOPLEFT", -4, 4) | 421 control:SetPoint("TOPLEFT", -4, 4) |
| 428 control:SetPoint("BOTTOMRIGHT", 4, -4) | 422 control:SetPoint("BOTTOMRIGHT", 4, -4) |
| 429 control:SetBackdrop({ | 423 control:SetBackdrop({ |
| 431 tile = true, | 425 tile = true, |
| 432 tileSize = 16, | 426 tileSize = 16, |
| 433 edgeSize = 16, | 427 edgeSize = 16, |
| 434 insets = { left = 0, right = 0, top = 0, bottom = 0 }, | 428 insets = { left = 0, right = 0, top = 0, bottom = 0 }, |
| 435 }) | 429 }) |
| 430 control:SetClampedToScreen(true) | |
| 436 | 431 |
| 437 -- textures | 432 -- textures |
| 438 local bgTex = control:CreateTexture(nil,"BACKGROUND") | 433 local bgTex = control:CreateTexture(nil,"BACKGROUND") |
| 439 bgTex:SetTexture(0.7,0.7,1.0,0.2) | 434 bgTex:SetTexture(0.7,0.7,1.0,0.2) |
| 440 bgTex:SetPoint("TOPLEFT",4,-4) | 435 bgTex:SetPoint("TOPLEFT",4,-4) |
| 507 ) | 502 ) |
| 508 edge:SetScript("OnLeave", HideGameTooltip) | 503 edge:SetScript("OnLeave", HideGameTooltip) |
| 509 edge:Show() | 504 edge:Show() |
| 510 end | 505 end |
| 511 | 506 |
| 512 -- corner drag handles, again nested in an anonymous frame so that they are on top | 507 -- corner drag handles, nested in an anonymous frame so that they are on top |
| 513 local foo2 = CreateFrame("Frame",nil,control) | 508 local foo = CreateFrame("Frame",nil,control) |
| 514 foo2:SetAllPoints(true) | 509 foo:SetAllPoints(true) |
| 515 for _, point in pairs({"BOTTOMLEFT","TOPLEFT","BOTTOMRIGHT","TOPRIGHT"}) do | 510 for _, point in pairs({"BOTTOMLEFT","TOPLEFT","BOTTOMRIGHT","TOPRIGHT"}) do |
| 516 local corner = CreateFrame("Frame",nil,foo2) | 511 local corner = CreateFrame("Frame",nil,foo) |
| 517 corner:EnableMouse(true) | 512 corner:EnableMouse(true) |
| 518 corner:SetWidth(12) | 513 corner:SetWidth(12) |
| 519 corner:SetHeight(12) | 514 corner:SetHeight(12) |
| 520 corner:SetPoint(point) | 515 corner:SetPoint(point) |
| 521 local tex = corner:CreateTexture(nil,"HIGHLIGHT") | 516 local tex = corner:CreateTexture(nil,"HIGHLIGHT") |
| 667 if show then | 662 if show then |
| 668 if not self.controlFrame then | 663 if not self.controlFrame then |
| 669 self.controlFrame = CreateControls(self) | 664 self.controlFrame = CreateControls(self) |
| 670 end | 665 end |
| 671 self.controlFrame:Show() | 666 self.controlFrame:Show() |
| 667 self.controlFrame:Raise() | |
| 672 elseif self.controlFrame then | 668 elseif self.controlFrame then |
| 673 CloseMenu(self.controlFrame) | 669 CloseMenu(self.controlFrame) |
| 674 self.controlFrame:Hide() | 670 self.controlFrame:Hide() |
| 675 end | 671 end |
| 676 end | 672 end |
