summaryrefslogtreecommitdiff
path: root/indra/newview/llnameeditor.h
blob: b5e811fba480a3dd9a39aed59083c9179de87864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/** 
 * @file llnameeditor.h
 * @brief display and refresh a name from the name cache
 *
 * Copyright (c) 2003-$CurrentYear$, Linden Research, Inc.
 * $License$
 */

#ifndef LL_LLNAMEEDITOR_H
#define LL_LLNAMEEDITOR_H

#include <set>

#include "llview.h"
#include "v4color.h"
#include "llstring.h"
#include "llfontgl.h"
#include "linked_lists.h"
#include "lllineeditor.h"


class LLNameEditor
:	public LLLineEditor
{
public:
	LLNameEditor(const std::string& name, const LLRect& rect,
		const LLUUID& name_id = LLUUID::null,
		BOOL is_group = FALSE,
		const LLFontGL* glfont = NULL,
		S32 max_text_length = 254,
		void (*commit_callback)(LLUICtrl* caller, void* user_data) = NULL,
		void (*keystroke_callback)(LLLineEditor* caller, void* user_data) = NULL,
		void (*focus_lost_callback)(LLLineEditor* caller, void* user_data) = NULL,
		void* userdata = NULL,
		LLLinePrevalidateFunc prevalidate_func = NULL,
		LLViewBorder::EBevel border_bevel = LLViewBorder::BEVEL_IN,
		LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE,
		S32 border_thickness = 1);
		// By default, follows top and left and is mouse-opaque.
		// If no text, text = name.
		// If no font, uses default system font.

	virtual ~LLNameEditor();

	static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);

	void setNameID(const LLUUID& name_id, BOOL is_group);

	void refresh(const LLUUID& id, const char* first, const char* last,
				 BOOL is_group);

	static void refreshAll(const LLUUID& id, const char* firstname,
						   const char* lastname, BOOL is_group);

	virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_NAME_EDITOR; }
	virtual LLString getWidgetTag() const { return LL_NAME_EDITOR_TAG; }

	// Take/return agent UUIDs
	virtual void	setValue( LLSD value );
	virtual LLSD	getValue() const;

private:
	static std::set<LLNameEditor*> sInstances;

private:
	LLUUID mNameID;

};

#endif