diff classes/ReBound.xml @ 5:27aeec452e7f

(none)
author Flick <flickerstreak@gmail.com>
date Tue, 20 Mar 2007 21:20:05 +0000
parents classes/ReBinder.xml@dfd829db3ad0
children f920db5fc6b1
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/classes/ReBound.xml	Tue Mar 20 21:20:05 2007 +0000
@@ -0,0 +1,242 @@
+<Ui xmlns="http://www.blizzard.com/wow/ui/" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
+
+
+  <Button name="ReBinderClickBindingTemplate" virtual="true" hidden="true" toplevel="true" setAllPoints="true">
+		<HighlightTexture alphaMode="ADD" file="Interface\Buttons\ButtonHilight-Square"/>
+    <Layers>
+      <Layer level="BACKGROUND">
+        <Texture>
+          <Color r="0" g="0" b="0" a="0"/>
+        </Texture>
+      </Layer>
+    </Layers>
+    <Scripts>
+      <OnLoad>
+        this:RegisterForClicks("LeftButtonUp","RightButtonUp")
+      </OnLoad>
+      <OnClick>
+        local mouseBtn = arg1
+        if mouseBtn == "LeftButton" then
+          ReBinder:BindSelectedKeyTo(this.keybindTarget)
+        elseif mouseBtn == "RightButton" then
+          ReBinder:ClearBinding(this.keybindTarget)
+        end
+      </OnClick>
+      <PostClick>
+        this:SetButtonState("NORMAL")
+      </PostClick>
+      <OnEnter>
+        ReBinder:UpdateCurrentTarget(this.keybindTarget)
+      </OnEnter>
+      <OnLeave>
+        ReBinder:UpdateCurrentTarget(nil)
+      </OnLeave>
+    </Scripts>
+  </Button>
+
+
+  <!-- this frame covers the entire UIParent. It is visible but empty and in the background, so all it does is consume key presses and unhandled mouse clicks -->
+  <Button name="ReBinderFrame" frameStrata="BACKGROUND" movable="false" enableMouse="true" enableKeyboard="true" parent="UIParent" hidden="true" setAllPoints="true">
+    <Frames>
+      <!-- this is a dialog frame that appears to provide user feedback for the outer frame -->
+      <Button name="$parentDialog" frameStrata="DIALOG" movable="true" enableMouse="true">
+        <Size>
+          <AbsDimension x="330" y="350"/>
+        </Size>
+        <Anchors>
+          <Anchor point="CENTER"/>
+        </Anchors>
+        <TitleRegion>
+          <Size>
+            <AbsDimension x="350" y="30"/>
+          </Size>
+          <Anchors>
+            <Anchor point="TOP">
+              <Offset>
+                <AbsDimension x="0" y="-10"/>
+              </Offset>
+            </Anchor>
+          </Anchors>
+        </TitleRegion>
+        <Backdrop edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
+          <EdgeSize>
+            <AbsValue val="16"/>
+          </EdgeSize>
+          <TileSize>
+            <AbsValue val="16"/>
+          </TileSize>
+          <BackgroundInsets>
+            <AbsInset left="4" right="4" top="4" bottom="4"/>
+          </BackgroundInsets>
+        </Backdrop>
+        <Layers>
+          <Layer level="BACKGROUND">
+            <Texture>
+              <Color r="0" g="0" b="0" a="0.7"/>
+            </Texture>
+          </Layer>
+          <Layer level="ARTWORK">
+            <FontString inherits="GameFontNormalLarge" text="Key Binding Setup" justifyH="CENTER">
+              <Size>
+                <AbsDimension x="200" y="30"/>
+              </Size>
+              <Anchors>
+                <Anchor point="TOP">
+                  <Offset>
+                    <AbsDimension x="0" y="-10"/>
+                  </Offset>
+                </Anchor>
+              </Anchors>
+            </FontString>
+            <FontString inherits="GameFontNormal" text="Press a key to ready it for assignment, then click a button to assign the key.|nRight-click a button to clear its binding." justifyH="CENTER">
+              <Size>
+                <AbsDimension x="240" y="70"/>
+              </Size>
+              <Anchors>
+                <Anchor point="TOP">
+                  <Offset>
+                    <AbsDimension x="0" y="-55"/>
+                  </Offset>
+                </Anchor>
+              </Anchors>
+              <Color r="1.0" g="1.0" b="1.0"/>
+            </FontString>
+            <FontString inherits="GameFontNormal" text="Selected Key:" justifyH="RIGHT">
+              <Size>
+                <AbsDimension x="175" y="25"/>
+              </Size>
+              <Anchors>
+                <Anchor point="RIGHT" relativePoint="TOP">
+                  <Offset>
+                    <AbsDimension x="-25" y="-160"/>
+                  </Offset>
+                </Anchor>
+              </Anchors>
+            </FontString>
+            <FontString inherits="GameFontNormal" text="Current Binding:" justifyH="RIGHT">
+              <Size>
+                <AbsDimension x="175" y="25"/>
+              </Size>
+              <Anchors>
+                <Anchor point="RIGHT" relativePoint="TOP">
+                  <Offset>
+                    <AbsDimension x="-25" y="-205"/>
+                  </Offset>
+                </Anchor>
+              </Anchors>
+            </FontString>
+            <FontString name="$parentCurrentActionText" inherits="GameFontNormal" text="(none)" justifyH="CENTER">
+              <Size>
+                <AbsDimension x="140" y="50"/>
+              </Size>
+              <Anchors>
+                <Anchor point="CENTER" relativePoint="TOP">
+                  <Offset>
+                    <AbsDimension x="75" y="-205"/>
+                  </Offset>
+                </Anchor>
+              </Anchors>
+              <Color r="0" g="1" b="0" a="1"/>
+            </FontString>
+            <FontString name="$parentStatusMsg" inherits="GameFontNormal" text="" justifyH="CENTER">
+              <Size>
+                <AbsDimension x="200" y="50"/>
+              </Size>
+              <Anchors>
+                <Anchor point="TOP">
+                  <Offset>
+                    <AbsDimension x="0" y="-230"/>
+                  </Offset>
+                </Anchor>
+              </Anchors>
+              <Color r="0.1" g="1.0" b="0.1"/>
+            </FontString>
+          </Layer>
+        </Layers>
+        <Frames>
+          <Button name="$parentSelectedKey" inherits="UIPanelButtonTemplate2" text="(none)">
+            <Size>
+              <AbsDimension x="140" y="28"/>
+            </Size>
+            <Anchors>
+              <Anchor point="CENTER" relativePoint="TOP">
+                <Offset>
+                  <AbsDimension x="75" y="-160"/>
+                </Offset>
+              </Anchor>
+            </Anchors>
+          </Button>
+          <Button inherits="GameMenuButtonTemplate" text="Done">
+            <Size>
+              <AbsDimension x="112" y="28"/>
+            </Size>
+            <Anchors>
+              <Anchor point="BOTTOM">
+                <Offset>
+                  <AbsDimension x="0" y="10"/>
+                </Offset>
+              </Anchor>
+            </Anchors>
+            <Scripts>
+              <OnClick>
+                this:GetParent():GetParent():Hide()
+              </OnClick>
+            </Scripts>
+          </Button>
+        </Frames>
+        <Scripts>
+          <!-- the dialog frame needs to handle clicks (close button, drag title) so we have to
+            re-implement the behavior of capturing alternate mouse buttons -->
+          <OnLoad>
+            this.selectedKey   = getglobal(this:GetName().."SelectedKeyText")
+            this.currentAction = getglobal(this:GetName().."CurrentActionText")
+            this:RegisterForClicks("MiddleButtonUp","Button4Up","Button5Up")
+          </OnLoad>
+          <OnClick>
+            local k, a = ReBinder:HandleKeyPressed(arg1)
+            if k then
+              this.selectedKey:SetText(k)
+              this.currentAction:SetText(a or "(none)")
+            end
+          </OnClick>
+        </Scripts>
+      </Button>
+    </Frames>
+    <Scripts>
+      <OnLoad>
+        this.selectedKey   = getglobal(this:GetName().."DialogSelectedKeyText")
+        this.currentAction = getglobal(this:GetName().."DialogCurrentActionText")
+        this.statusMsg     = getglobal(this:GetName().."DialogStatusMsg")
+        tinsert(UISpecialFrames,this:GetName())
+        this:RegisterForClicks("MiddleButtonUp","Button4Up","Button5Up")
+      </OnLoad>
+      <OnShow>
+        this.selectedKey:SetText("(none)")
+        this.currentAction:SetText("(none)")
+        this.statusMsg:SetText("")
+        ReBinder:ShowClickBindingButtons()
+      </OnShow>
+      <OnHide>
+        ReBinder:HideClickBindingButtons()
+        ReBinder:ClearSelectedKey()
+      </OnHide>
+      <OnKeyDown>
+        local k, a = ReBinder:HandleKeyPressed(arg1)
+        if k then
+          this.selectedKey:SetText(k)
+          this.currentAction:SetText(a or "(none)")
+        end
+      </OnKeyDown>
+      <OnClick>
+        local k, a = ReBinder:HandleKeyPressed(arg1)
+        if k then
+          this.selectedKey:SetText(k)
+          this.currentAction:SetText(a or "(none)")
+        end
+      </OnClick>
+    </Scripts>
+  </Button>
+
+</Ui>