aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpaneldirbrowser.h
blob: bd0f309e3dd8985a0d235976d4a5ab4b091f8036 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/** 
 * @file llpaneldirbrowser.h
 * @brief LLPanelDirBrowser class definition
 *
 * Copyright (c) 2001-2007, Linden Research, Inc.
 * 
 * Second Life Viewer Source Code
 * The source code in this file ("Source Code") is provided by Linden Lab
 * to you under the terms of the GNU General Public License, version 2.0
 * ("GPL"), unless you have obtained a separate licensing agreement
 * ("Other License"), formally executed by you and Linden Lab.  Terms of
 * the GPL can be found in doc/GPL-license.txt in this distribution, or
 * online at http://secondlife.com/developers/opensource/gplv2
 * 
 * There are special exceptions to the terms and conditions of the GPL as
 * it is applied to this Source Code. View the full text of the exception
 * in the file doc/FLOSS-exception.txt in this software distribution, or
 * online at http://secondlife.com/developers/opensource/flossexception
 * 
 * By copying, modifying or distributing this software, you acknowledge
 * that you have read and understood your obligations described above,
 * and agree to abide by those obligations.
 * 
 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
 * COMPLETENESS OR PERFORMANCE.
 */

// Base class for the various search panels/results browsers
// in the Find floater.  For example, Find > Popular Places
// is derived from this.

#ifndef LL_LLPANELDIRBROWSER_H
#define LL_LLPANELDIRBROWSER_H

#include "llpanel.h"

#include "llmemory.h"	// LLPointer
#include "lluuid.h"
#include "llframetimer.h"
#include "llviewerimage.h"
#include "llmap.h"

class LLMessageSystem;
class LLFloaterDirectory;

class LLPanelDirBrowser: public LLPanel
{
public:
	LLPanelDirBrowser(const std::string& name, LLFloaterDirectory* floater);
	virtual ~LLPanelDirBrowser();

	virtual BOOL postBuild();

	// Use to get periodic updates.
	virtual void draw();

	virtual void onVisibilityChange(BOOL curVisibilityIn);

	// Redo your search for the prev/next page of results
	virtual void prevPage();
	virtual void nextPage();
	void resetSearchStart();
	// Do the current query (used by prevPage/nextPage)
	virtual void performQuery() {};

	const LLUUID& getSearchID() const { return mSearchID; }

	// Select the line in the scroll list control with this ID,
	// either now or when data arrives from the server.
	void selectByUUID(const LLUUID& id);

	void selectEventByID(S32 event_id);

	U32 getSelectedEventID() const;
	void getSelectedInfo(LLUUID* id, S32 *type);

	// from llpaneldirbase
	void setupNewSearch();

	// default handler for clicking the search button resets the
	// next/prev state and performs the query.
	// Expects a pointer to an LLPanelDirBrowser object.
	static void onClickSearchCore(void* userdata);

	// query_start indicates the first result row to
	// return, usually 0 or 100 or 200 because the searches
	// return a max of 100 rows
	static void sendDirFindQuery(
		LLMessageSystem* msg,
		const LLUUID& query_id,
		const LLString& text,
		U32 flags,
		S32 query_start);

	// Put an item in the first line of the results list.
	void addHelpText(const char* text);

	void newClassified();

	void showEvent(const U32 event_id);

	void renameClassified(const LLUUID& classified_id, const char* name);

	// Prev/Next page buttons
	static void onClickNext(void* data);
	static void onClickPrev(void* data);

	static void onCommitList(LLUICtrl* ctrl, void* data);

	static void processDirPeopleReply(LLMessageSystem* msg, void**);
	static void processDirPlacesReply(LLMessageSystem* msg, void**);
	static void processDirEventsReply(LLMessageSystem* msg, void**);
	static void processDirGroupsReply(LLMessageSystem* msg, void**);
	static void processDirClassifiedReply(LLMessageSystem* msg, void**);
	static void processDirPopularReply(LLMessageSystem* msg, void**);
	static void processDirLandReply(LLMessageSystem *msg, void**);

protected:
	void updateResultCount();

	void addClassified(LLCtrlListInterface *list, const LLUUID& classified_id, const char* name, const U32 creation_date, const S32 price_for_listing);
	LLSD createLandSale(const LLUUID& parcel_id, BOOL is_auction, BOOL is_for_sale, const LLString& name, S32 *type);

	static void onKeystrokeName(LLLineEditor* line, void* data);

	// If this is a search for a panel like "people_panel" (and not the "all" panel)
	// optionally show the "Next" button.  Return the actual number of
	// rows to display.
	S32 showNextButton(S32 rows);

protected:
	LLUUID			mSearchID;		// Unique ID for a pending search
	LLUUID			mWantSelectID;	// scroll item to select on arrival
	LLString        mCurrentSortColumn;
	BOOL            mCurrentSortAscending;
	// Some searches return a max of 100 items per page, so we can
	// start the search from the 100th item rather than the 0th, etc.
	S32				mSearchStart;
	// Places is 100 per page, events is 200 per page
	S32				mResultsPerPage;
	S32				mResultsReceived;

	U32				mMinSearchChars;

	LLSD			mResultsContents;

	BOOL			mHaveSearchResults;
	BOOL			mDidAutoSelect;
	LLFrameTimer	mLastResultTimer;

	LLFloaterDirectory* mFloaterDirectory;
};

// Codes used for sorting by type.
const S32 EVENT_CODE = 0;
const S32 PLACE_CODE = 1;
const S32 ONLINE_CODE = 2;
const S32 OFFLINE_CODE = 3;
const S32 GROUP_CODE = 4;
const S32 CLASSIFIED_CODE = 5;	
const S32 FOR_SALE_CODE = 6;	// for sale place
const S32 AUCTION_CODE = 7;		// for auction place
const S32 POPULAR_CODE = 8;		// popular by dwell

extern LLMap< const LLUUID, LLPanelDirBrowser* > gDirBrowserInstances;

#endif // LL_LLPANELDIRBROWSER_H