PageRenderTime 19ms CodeModel.GetById 1ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llwindow/llwindowcallbacks.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 94 lines | 57 code | 9 blank | 28 comment | 0 complexity | c701c9447daeca8e3a8e305a5c4ccb80 MD5 | raw file
 1/** 
 2 * @file llwindowcallbacks.h
 3 * @brief OS event callback class
 4 *
 5 * $LicenseInfo:firstyear=2001&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#ifndef LLWINDOWCALLBACKS_H
27#define LLWINDOWCALLBACKS_H
28
29class LLCoordGL;
30class LLWindow;
31
32class LLWindowCallbacks
33{
34public:
35	virtual ~LLWindowCallbacks() {}
36	virtual BOOL handleTranslatedKeyDown(KEY key,  MASK mask, BOOL repeated);
37	virtual BOOL handleTranslatedKeyUp(KEY key,  MASK mask);
38	virtual void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
39	virtual BOOL handleUnicodeChar(llwchar uni_char, MASK mask);
40
41	virtual BOOL handleMouseDown(LLWindow *window,  LLCoordGL pos, MASK mask);
42	virtual BOOL handleMouseUp(LLWindow *window,  LLCoordGL pos, MASK mask);
43	virtual void handleMouseLeave(LLWindow *window);
44	// return TRUE to allow window to close, which will then cause handleQuit to be called
45	virtual BOOL handleCloseRequest(LLWindow *window);
46	// window is about to be destroyed, clean up your business
47	virtual void handleQuit(LLWindow *window);
48	virtual BOOL handleRightMouseDown(LLWindow *window,  LLCoordGL pos, MASK mask);
49	virtual BOOL handleRightMouseUp(LLWindow *window,  LLCoordGL pos, MASK mask);
50	virtual BOOL handleMiddleMouseDown(LLWindow *window,  LLCoordGL pos, MASK mask);
51	virtual BOOL handleMiddleMouseUp(LLWindow *window,  LLCoordGL pos, MASK mask);
52	virtual BOOL handleActivate(LLWindow *window, BOOL activated);
53	virtual BOOL handleActivateApp(LLWindow *window, BOOL activating);
54	virtual void handleMouseMove(LLWindow *window,  LLCoordGL pos, MASK mask);
55	virtual void handleScrollWheel(LLWindow *window,  S32 clicks);
56	virtual void handleResize(LLWindow *window,  S32 width,  S32 height);
57	virtual void handleFocus(LLWindow *window);
58	virtual void handleFocusLost(LLWindow *window);
59	virtual void handleMenuSelect(LLWindow *window,  S32 menu_item);
60	virtual BOOL handlePaint(LLWindow *window,  S32 x,  S32 y,  S32 width,  S32 height);
61	virtual BOOL handleDoubleClick(LLWindow *window,  LLCoordGL pos, MASK mask);			// double-click of left mouse button
62	virtual void handleWindowBlock(LLWindow *window);							// window is taking over CPU for a while
63	virtual void handleWindowUnblock(LLWindow *window);							// window coming back after taking over CPU for a while
64	virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data);
65	virtual BOOL handleTimerEvent(LLWindow *window);
66	virtual BOOL handleDeviceChange(LLWindow *window);
67
68	enum DragNDropAction {
69		DNDA_START_TRACKING = 0,// Start tracking an incoming drag
70		DNDA_TRACK,				// User is dragging an incoming drag around the window
71		DNDA_STOP_TRACKING,		// User is no longer dragging an incoming drag around the window (may have either cancelled or dropped on the window)
72		DNDA_DROPPED			// User dropped an incoming drag on the window (this is the "commit" event)
73	};
74	
75	enum DragNDropResult {
76		DND_NONE = 0,	// No drop allowed
77		DND_MOVE,		// Drop accepted would result in a "move" operation
78		DND_COPY,		// Drop accepted would result in a "copy" operation
79		DND_LINK		// Drop accepted would result in a "link" operation
80	};
81	virtual DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, DragNDropAction action, std::string data);
82	
83	virtual void handlePingWatchdog(LLWindow *window, const char * msg);
84	virtual void handlePauseWatchdog(LLWindow *window);
85	virtual void handleResumeWatchdog(LLWindow *window);
86
87    // Look up a localized string, usually for an error message
88    virtual std::string translateString(const char* tag);
89	virtual std::string translateString(const char* tag,
90		const std::map<std::string, std::string>& args);
91};
92
93
94#endif