aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterassetbrowser.h
blob: 76eb3ba77247a310dceac42226b9e18f25790cdf (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
/** 
 * @file llfloaterassetbrowser.h
 * @brief LLFloaterAssetBrowser class implementation
 * Phox wuz hurr
 */

#ifndef LL_LLFLOATERASSETBROWSERVIEW_H
#define LL_LLFLOATERASSETBROWSERVIEW_H

#include "llfloater.h"
#include "llinventorymodel.h"
#include "llview.h"
#include "llviewerimage.h"

class LLInventoryPanel;

struct LLAssetSelection
{
	LLUUID						mUUID;
	LLUUID						mAssetUUID; 
	std::string					mName;
	std::string					mAssetInfo;
	S32							mWidth;
	S32							mHeight;
	LLTextBox*					mAssetInfoTextBox;
	LLPointer<LLViewerImage>	mTexturep;
	LLRect						mAssetRect;
};

class LLFloaterAssetBrowser : public LLFloater
{
public:
    LLFloaterAssetBrowser();

    virtual ~LLFloaterAssetBrowser();

    static void show(void*);
	
	virtual BOOL handleHover(S32 x, S32 y, MASK mask);
	virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
	virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
	virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
	virtual void draw();

	static LLFloaterAssetBrowser* getInstance(){ return sInstance; }

private:
	void initialize();
	void createThumbnails();
	void clearAssetInfoTexts();
	void clearNoAssetsText();

	static void onClickNext(void *userdata);
	static void onClickPrevious(void *userdata);
	static void onClickRefresh(void *userdata);

	static LLFloaterAssetBrowser* sInstance;

protected:
	LLInventoryPanel*				mInventoryPanel;
	LLUUID							mImageAssetID; 
	LLUUID							mMouseOverUUID;
	LLUUID							mMouseOverAssetUUID;
	LLPointer<LLViewerImage>		mTexturep;
	std::vector<LLAssetSelection>	mTextureAssets;
	std::vector<LLTextBox*>			mAssetInfoLabelList;
	U32								mLastIndex;
	U32								mMaxIndex;
	U32								mFirstIndex;
	U32								mAssetInfoIndex;
	S32								mFloaterHeight;
	S32								mFloaterWidth;
	S32								mMouseOverIndex;
	LLTextBox*						mNoAssetsLabel;
	LLTextBox*						mAssetInfoLabel;
	std::string mFloaterTitle;
};

static const S32 HPAD = 4;
static const S32 BORDER_PAD = HPAD;
static const U32 ITEMS_PER_PAGE = 16;
static const S32 START_POS = 250;

#endif