comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:edfa01041183
1 --[[
2 CensusPlus for World of Warcraft(tm).
3
4 Copyright 2005 - 2006 Cooper Sellers and WarcraftRealms.com
5
6 License:
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program(see GLP.txt); if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 ]]
21
22
23 local init = false;
24
25 function CensusButton_OnClick()
26 CensusPlus_Toggle();
27 end
28
29 function CensusButton_Init()
30 if(CensusPlus_Database["Info"]["CensusButtonShown"] == 1 ) then
31 CensusButtonFrame:Show();
32 else
33 CensusButtonFrame:Hide();
34 end
35
36 init = true;
37 end
38
39 function CensusButton_Toggle()
40 if(CensusButtonFrame:IsVisible()) then
41 CensusButtonFrame:Hide();
42 CensusPlus_Database["Info"]["CensusButtonShown"] = false;
43 else
44 CensusButtonFrame:Show();
45 CensusPlus_Database["Info"]["CensusButtonShown"] = true;
46 end
47 end
48
49 function CensusButton_UpdatePosition()
50 CensusButtonFrame:SetPoint(
51 "TOPLEFT",
52 "Minimap",
53 "TOPLEFT",
54 54 - (78 * cos(CensusPlus_Database["Info"]["CensusButtonPosition"])),
55 (78 * sin(CensusPlus_Database["Info"]["CensusButtonPosition"])) - 55
56 );
57 end
58
59 function CensusButton_OnUpdate()
60 if( init ) then
61 CensusPlus_OnUpdate();
62 end
63 end
64
65 function CensusPlusButton_OnClick( arg1, arg2 )
66 if ( arg1 == "LeftButton" ) then
67 CensusButton_OnClick();
68 else
69 ToggleDropDownMenu( 1, nil, CP_ButtonDropDown, "CensusButtonFrame", 20, 20 );
70 end
71
72 end
73
74 function CensusPlus_ButtonDropDown_Initialize()
75
76 local info;
77
78 if (g_IsCensusPlusInProgress == true) then
79 if( g_CensusPlusManuallyPaused == true ) then
80 info = {
81 text = CENSUSPlus_UNPAUSE;
82 func = CensusPlus_Take_OnClick;
83 };
84 else
85 info = {
86 text = CENSUSPlus_PAUSE;
87 func = CensusPlus_Take_OnClick;
88 };
89 end
90 else
91 info = {
92 text = CENSUSPlus_TAKE;
93 func = CensusPlus_Take_OnClick;
94 };
95 end
96 UIDropDownMenu_AddButton(info, 1);
97
98 info = {
99 text = CENSUSPlus_STOP;
100 func = CensusPlus_StopCensus;
101 };
102 UIDropDownMenu_AddButton(info, 1);
103
104 info = {
105 text = CENSUSPlus_CANCEL;
106 func = CensusPlus_CloseDropDown;
107 };
108 UIDropDownMenu_AddButton(info, 1);
109
110 end
111
112
113 function CensusPlus_CloseDropDown()
114 CloseDropDownMenus();
115 end