PageRenderTime 43ms CodeModel.GetById 31ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/newview/llpaneltopinfobar.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 178 lines | 67 code | 34 blank | 77 comment | 1 complexity | fdd2e136e4cd0fbb35deb090ed1d4763 MD5 | raw file
  1/**
  2 * @file llpaneltopinfobar.h
  3 * @brief Coordinates and Parcel Settings information panel definition
  4 *
  5 * $LicenseInfo:firstyear=2010&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LLPANELTOPINFOBAR_H_
 28#define LLPANELTOPINFOBAR_H_
 29
 30#include "llpanel.h"
 31
 32class LLButton;
 33class LLTextBox;
 34class LLIconCtrl;
 35class LLParcelChangeObserver;
 36
 37class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>, private LLDestroyClass<LLPanelTopInfoBar>
 38{
 39	LOG_CLASS(LLPanelTopInfoBar);
 40
 41	friend class LLDestroyClass<LLPanelTopInfoBar>;
 42
 43public:
 44	typedef boost::signals2::signal<void ()> resize_signal_t;
 45
 46	LLPanelTopInfoBar();
 47	~LLPanelTopInfoBar();
 48
 49	/*virtual*/ BOOL postBuild();
 50	/*virtual*/ void draw();
 51
 52	/**
 53	 * Updates location and parcel icons on login complete
 54	 */
 55	void handleLoginComplete();
 56
 57	/**
 58	 * Called when the top info bar gets shown or hidden
 59	 */
 60	void onVisibilityChange(const LLSD& show);
 61
 62	boost::signals2::connection setResizeCallback( const resize_signal_t::slot_type& cb );
 63
 64private:
 65	class LLParcelChangeObserver;
 66
 67	friend class LLParcelChangeObserver;
 68
 69	enum EParcelIcon
 70	{
 71		VOICE_ICON = 0,
 72		FLY_ICON,			// 1
 73		PUSH_ICON,			// 2
 74		BUILD_ICON,			// 3
 75		SCRIPTS_ICON,		// 4
 76		DAMAGE_ICON,		// 5
 77		SEE_AVATARS_ICON,	// 6
 78		ICON_COUNT			// 7 total
 79	};
 80
 81	/**
 82	 * Initializes parcel icons controls. Called from the constructor.
 83	 */
 84	void initParcelIcons();
 85
 86	BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
 87
 88	/**
 89	 * Handles clicks on the parcel icons.
 90	 */
 91	void onParcelIconClick(EParcelIcon icon);
 92
 93	/**
 94	 * Handles clicks on the info buttons.
 95	 */
 96	void onInfoButtonClicked();
 97
 98	/**
 99	 * Called when agent changes the parcel.
100	 */
101	void onAgentParcelChange();
102
103	/**
104	 * Called when context menu item is clicked.
105	 */
106	void onContextMenuItemClicked(const LLSD::String& userdata);
107
108	/**
109	 * Called when user checks/unchecks Show Coordinates menu item.
110	 */
111	void onNavBarShowParcelPropertiesCtrlChanged();
112
113	/**
114	 * Shorthand to call updateParcelInfoText() and updateParcelIcons().
115	 */
116	void update();
117
118	/**
119	 * Updates parcel info text (mParcelInfoText).
120	 */
121	void updateParcelInfoText();
122
123	/**
124	 * Updates parcel icons (mParcelIcon[]).
125	 */
126	void updateParcelIcons();
127
128	/**
129	 * Updates health information (mDamageText).
130	 */
131	void updateHealth();
132
133	/**
134	 * Lays out all parcel icons starting from right edge of the mParcelInfoText + 11px
135	 * (see screenshots in EXT-5808 for details).
136	 */
137	void layoutParcelIcons();
138
139	/**
140	 * Lays out a widget. Widget's rect mLeft becomes equal to the 'left' argument.
141	 */
142	S32 layoutWidget(LLUICtrl* ctrl, S32 left);
143
144	/**
145	 * Generates location string and returns it in the loc_str parameter.
146	 */
147	void buildLocationString(std::string& loc_str, bool show_coords);
148
149	/**
150	 * Sets new value to the mParcelInfoText and updates the size of the top bar.
151	 */
152	void setParcelInfoText(const std::string& new_text);
153
154	/**
155	 *  Implementation of LLDestroyClass<T>
156	 */
157	static void destroyClass()
158	{
159		if (LLPanelTopInfoBar::instanceExists())
160		{
161			LLPanelTopInfoBar::getInstance()->setEnabled(FALSE);
162		}
163	}
164
165	LLButton* 				mInfoBtn;
166	LLTextBox* 				mParcelInfoText;
167	LLTextBox* 				mDamageText;
168	LLIconCtrl*				mParcelIcon[ICON_COUNT];
169	LLParcelChangeObserver*	mParcelChangedObserver;
170
171	boost::signals2::connection	mParcelPropsCtrlConnection;
172	boost::signals2::connection	mShowCoordsCtrlConnection;
173	boost::signals2::connection	mParcelMgrConnection;
174
175	resize_signal_t mResizeSignal;
176};
177
178#endif /* LLPANELTOPINFOBAR_H_ */