lotrointerface.com
Search Downloads

LoTROInterface SVN Calendar

[/] [trunk/] [FrostyPlugins/] [CustomPluginsManager/] [TooltipWindow.lua] - Rev 2

Compare with Previous | Blame | View Log

import "Turbine";
import "Turbine.Gameplay";
import "Turbine.UI";
import "Turbine.UI.Extensions";
import "Turbine.UI.Lotro";
import "Turbine.Utils";
import "FrostyPlugins.CustomPluginsManager.PluginSlot"

-- -----------------------------------------------------------------------
-- TooltipWindow is a popup window owned by the CustomPluginsManager to
-- display various information about a plugin while the mouse cursor is
-- over the individual PluginSlots
-- -----------------------------------------------------------------------

TooltipWindow = class( Turbine.UI.Window);

-- --------------------------------------------------------------
-- Constructor
--
-- Description: this is where the window is laid out, the fields
-- are created, and events are trapped.
-- --------------------------------------------------------------
function TooltipWindow:Constructor()
        Turbine.UI.Window.Constructor( self );

  -- --------------------------------------------
  -- window layout
  -- --------------------------------------------
  
        -- set window properties
  self:SetBackground( "FrostyPlugins/CustomPluginsManager/Resources/TooltipBackground.tga" );
  self:SetBackColorBlendMode( Turbine.UI.BlendMode.Overlay );
        self:SetSize( 300, 88 );
        self:SetOpacity( 1 );
        self:SetAllowDrop( false );
        self:SetMouseVisible( false );

  -- create various labels
  self.pluginNameLabel = Turbine.UI.Label();
  self.pluginNameLabel:SetForeColor( Turbine.UI.Color( 0.75, 0.75, 0 ) );
  self.pluginNameLabel:SetMultiline( false );
        self.pluginNameLabel:SetParent( self );
  self.pluginNameLabel:SetPosition( 5, 5 );
  self.pluginNameLabel:SetSize( 35, 13 );
  self.pluginNameLabel:SetText( "Name: " );
  
  self.pluginAuthorLabel = Turbine.UI.Label();
  self.pluginAuthorLabel:SetForeColor( Turbine.UI.Color( 0.75, 0.75, 0 ) );
  self.pluginAuthorLabel:SetMultiline( false );
        self.pluginAuthorLabel:SetParent( self );
  self.pluginAuthorLabel:SetPosition( 5, 18 );
  self.pluginAuthorLabel:SetSize( 49, 13 );
  self.pluginAuthorLabel:SetText( "Author: " );

  self.pluginPackageLabel = Turbine.UI.Label();
  self.pluginPackageLabel:SetForeColor( Turbine.UI.Color( 0.75, 0.75, 0 ) );
  self.pluginPackageLabel:SetMultiline( false );
        self.pluginPackageLabel:SetParent( self );
  self.pluginPackageLabel:SetPosition( 5, 31 );
  self.pluginPackageLabel:SetSize( 56, 13 );
  self.pluginPackageLabel:SetText( "Package: " );

  self.pluginScriptStateLabel = Turbine.UI.Label();
  self.pluginScriptStateLabel:SetForeColor( Turbine.UI.Color( 0.75, 0.75, 0 ) );
  self.pluginScriptStateLabel:SetMultiline( false );
        self.pluginScriptStateLabel:SetParent( self );
  self.pluginScriptStateLabel:SetPosition( 5, 44 );
  self.pluginScriptStateLabel:SetSize( 91, 13 );
  self.pluginScriptStateLabel:SetText( "Script State: " );

  self.pluginDirectoryLabel = Turbine.UI.Label();
  self.pluginDirectoryLabel:SetForeColor( Turbine.UI.Color( 0.75, 0.75, 0 ) );
  self.pluginDirectoryLabel:SetMultiline( false );
        self.pluginDirectoryLabel:SetParent( self );
  self.pluginDirectoryLabel:SetPosition( 5, 57 );
  self.pluginDirectoryLabel:SetSize( 70, 13 );
  self.pluginDirectoryLabel:SetText( "Directory: " );

  self.pluginIconLabel = Turbine.UI.Label();
  self.pluginIconLabel:SetForeColor( Turbine.UI.Color( 0.75, 0.75, 0 ) );
  self.pluginIconLabel:SetMultiline( false );
        self.pluginIconLabel:SetParent( self );
  self.pluginIconLabel:SetPosition( 5, 70 );
  self.pluginIconLabel:SetSize( 35, 13 );
  self.pluginIconLabel:SetText( "Icon: " );

  -- create the text fields
  self.pluginName = Turbine.UI.Label();
  self.pluginName:SetMultiline( false );
        self.pluginName:SetParent( self );
  self.pluginName:SetPosition( 65, 5 );
  self.pluginName:SetSize( 235, 13 );
 
  self.pluginAuthor = Turbine.UI.Label();
  self.pluginAuthor:SetMultiline( false );
        self.pluginAuthor:SetParent( self );
  self.pluginAuthor:SetPosition( 65, 18 );
  self.pluginAuthor:SetSize( 235, 13 );

  self.pluginPackage = Turbine.UI.Label();
  self.pluginPackage:SetMultiline( false );
        self.pluginPackage:SetParent( self );
  self.pluginPackage:SetPosition( 65, 31 );
  self.pluginPackage:SetSize( 235, 13 );

  self.pluginScriptState = Turbine.UI.Label();
  self.pluginScriptState:SetMultiline( false );
        self.pluginScriptState:SetParent( self );
  self.pluginScriptState:SetPosition( 100, 44 );
  self.pluginScriptState:SetSize( 200, 13 );

  self.pluginDirectory = Turbine.UI.Label();
  self.pluginDirectory:SetMultiline( false );
        self.pluginDirectory:SetParent( self );
  self.pluginDirectory:SetPosition( 80, 57 );
  self.pluginDirectory:SetSize( 220, 13 );

  self.pluginIcon = Turbine.UI.Label();
  self.pluginIcon:SetMultiline( false );
        self.pluginIcon:SetParent( self );
  self.pluginIcon:SetPosition( 50, 70 );
  self.pluginIcon:SetSize( 250, 13 );

  -- --------------------------------------------
  -- event handling
  -- --------------------------------------------
        -- make sure we listen for key presses
        self:SetWantsKeyEvents( true );

  --
  -- if the escape key is pressed, hide the window
  --
        self.KeyDown = function( sender, args )
                -- do this if the escape key is pressed
                if ( args.Action == Turbine.UI.Lotro.Action.Escape ) then
                        sender:SetVisible( false )
                end
        end
end


-- --------------------------------------------------------------
-- Initialize
--
-- Description: Initialize the window with information from the
-- plugin slot and show the window
-- --------------------------------------------------------------
function TooltipWindow:Initialize( pluginSlot )
  self.pluginName:SetText( pluginSlot.PluginName .. " " .. pluginSlot.PluginVersion );
  self.pluginAuthor:SetText( pluginSlot.PluginAuthor );
  self.pluginPackage:SetText( pluginSlot.PluginPackage );
  self.pluginScriptState:SetText( pluginSlot.PluginScriptState );
  self.pluginDirectory:SetText( pluginSlot.PluginDirectory );
  if( "" == pluginSlot.PluginIcon ) then
    self.pluginIcon:SetText( "None" );
  else
    self.pluginIcon:SetText( pluginSlot.PluginIcon );
  end

  self:SetVisible( true );
end

-- --------------------------------------------------------------
-- Shutdown
--
-- Description: Hide the window
-- --------------------------------------------------------------
function TooltipWindow:Shutdown()
  self:SetVisible( false );
end

Compare with Previous | Blame


All times are GMT -5. The time now is 06:36 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui