diff CensusButton.lua @ 0:edfa01041183

Census+ Mod : - TLJ guild search - searchstart at Level 1 for community events
author EmFor <EmFor.hg@mroe.de>
date Tue, 30 Mar 2010 13:42:05 +0200
parents
children 10c85be19b56
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CensusButton.lua	Tue Mar 30 13:42:05 2010 +0200
@@ -0,0 +1,115 @@
+--[[
+	CensusPlus for World of Warcraft(tm).
+	
+	Copyright 2005 - 2006 Cooper Sellers and WarcraftRealms.com
+
+	License:
+		This program is free software; you can redistribute it and/or
+		modify it under the terms of the GNU General Public License
+		as published by the Free Software Foundation; either version 2
+		of the License, or (at your option) any later version.
+
+		This program is distributed in the hope that it will be useful,
+		but WITHOUT ANY WARRANTY; without even the implied warranty of
+		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+		GNU General Public License for more details.
+
+		You should have received a copy of the GNU General Public License
+		along with this program(see GLP.txt); if not, write to the Free Software
+		Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+]]
+
+
+local init = false;
+
+function CensusButton_OnClick()
+	CensusPlus_Toggle();
+end
+
+function CensusButton_Init()
+	if(CensusPlus_Database["Info"]["CensusButtonShown"] == 1 ) then
+		CensusButtonFrame:Show();
+	else
+		CensusButtonFrame:Hide();
+	end
+	
+	init = true;	
+end
+
+function CensusButton_Toggle()
+	if(CensusButtonFrame:IsVisible()) then
+		CensusButtonFrame:Hide();
+		CensusPlus_Database["Info"]["CensusButtonShown"] = false;
+	else
+		CensusButtonFrame:Show();
+		CensusPlus_Database["Info"]["CensusButtonShown"] = true;
+	end
+end
+
+function CensusButton_UpdatePosition()
+	CensusButtonFrame:SetPoint(
+		"TOPLEFT",
+		"Minimap",
+		"TOPLEFT",
+		54 - (78 * cos(CensusPlus_Database["Info"]["CensusButtonPosition"])),
+		(78 * sin(CensusPlus_Database["Info"]["CensusButtonPosition"])) - 55
+	);
+end
+
+function CensusButton_OnUpdate()
+	if( init ) then
+		CensusPlus_OnUpdate();
+	end
+end
+
+function CensusPlusButton_OnClick( arg1, arg2 )
+	if ( arg1 == "LeftButton" ) then
+		CensusButton_OnClick();
+	else
+  ToggleDropDownMenu( 1, nil, CP_ButtonDropDown, "CensusButtonFrame", 20, 20 );
+	end
+
+end
+
+function CensusPlus_ButtonDropDown_Initialize()
+		
+		local info;
+
+		if (g_IsCensusPlusInProgress == true) then
+			if( g_CensusPlusManuallyPaused == true ) then
+				info = {
+					text = CENSUSPlus_UNPAUSE;
+					func = CensusPlus_Take_OnClick;
+				};
+			else
+				info = {
+					text = CENSUSPlus_PAUSE;
+					func = CensusPlus_Take_OnClick;
+				};
+			end
+		else
+			info = {
+				text = CENSUSPlus_TAKE;
+				func = CensusPlus_Take_OnClick;
+			};
+		end
+		UIDropDownMenu_AddButton(info, 1);
+
+		info = {
+			text = CENSUSPlus_STOP;
+			func = CensusPlus_StopCensus;
+		};
+		UIDropDownMenu_AddButton(info, 1);
+		
+		info = {
+			text = CENSUSPlus_CANCEL;
+			func = CensusPlus_CloseDropDown;
+		};
+		UIDropDownMenu_AddButton(info, 1);		
+		
+end
+
+
+function CensusPlus_CloseDropDown()
+	CloseDropDownMenus();
+end
\ No newline at end of file