Added LLInitParam. Not yet plugged into xml parsing.
This commit is contained in:
@@ -5,22 +5,26 @@ project(llui)
|
||||
include(00-Common)
|
||||
include(LLCommon)
|
||||
include(LLImage)
|
||||
include(LLInventory)
|
||||
include(LLMath)
|
||||
include(LLMessage)
|
||||
include(LLRender)
|
||||
include(LLWindow)
|
||||
include(LLVFS)
|
||||
include(LLXML)
|
||||
include(LLXUIXML)
|
||||
|
||||
include_directories(
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
${LLIMAGE_INCLUDE_DIRS}
|
||||
${LLINVENTORY_INCLUDE_DIRS}
|
||||
${LLMATH_INCLUDE_DIRS}
|
||||
${LLMESSAGE_INCLUDE_DIRS}
|
||||
${LLRENDER_INCLUDE_DIRS}
|
||||
${LLWINDOW_INCLUDE_DIRS}
|
||||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
${LLXUIXML_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(llui_SOURCE_FILES
|
||||
@@ -159,6 +163,7 @@ target_link_libraries(llui
|
||||
llwindow
|
||||
llimage
|
||||
llvfs # ugh, just for LLDir
|
||||
llxuixml
|
||||
llxml
|
||||
llcommon # must be after llimage, llwindow, llrender
|
||||
llmath
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "llcallbackmap.h"
|
||||
#include "llfloater.h"
|
||||
#include "llinitparam.h"
|
||||
|
||||
class LLView;
|
||||
class LLPanel;
|
||||
|
||||
@@ -83,76 +83,94 @@ S32 LLView::sLastBottomXML = S32_MIN;
|
||||
BOOL LLView::sIsDrawing = FALSE;
|
||||
#endif
|
||||
|
||||
LLView::LLView()
|
||||
: mVisible(TRUE),
|
||||
mInDraw(false),
|
||||
mParentView(NULL),
|
||||
mReshapeFlags(FOLLOWS_NONE),
|
||||
mDefaultTabGroup(0),
|
||||
mEnabled(TRUE),
|
||||
mMouseOpaque(TRUE),
|
||||
mSoundFlags(MOUSE_UP), // default to only make sound on mouse up
|
||||
mSaveToXML(TRUE),
|
||||
mIsFocusRoot(FALSE),
|
||||
mLastVisible(TRUE),
|
||||
mUseBoundingRect(FALSE),
|
||||
mNextInsertionOrdinal(0),
|
||||
mHoverCursor(UI_CURSOR_ARROW),
|
||||
mLastTabGroup(0),
|
||||
// <edit>
|
||||
mDelayedDelete(FALSE)
|
||||
// </edit>
|
||||
LLView::Follows::Follows()
|
||||
: string(""),
|
||||
flags("flags", FOLLOWS_NONE)
|
||||
{}
|
||||
|
||||
LLView::Params::Params()
|
||||
: name("name", std::string("unnamed")),
|
||||
enabled("enabled", true),
|
||||
visible("visible", true),
|
||||
mouse_opaque("mouse_opaque", true),
|
||||
follows("follows"),
|
||||
hover_cursor("hover_cursor", "UI_CURSOR_ARROW"),
|
||||
use_bounding_rect("use_bounding_rect", false),
|
||||
tab_group("tab_group", 0),
|
||||
default_tab_group("default_tab_group"),
|
||||
//tool_tip("tool_tip"),
|
||||
sound_flags("sound_flags", MOUSE_UP),
|
||||
layout("layout"),
|
||||
rect("rect"),
|
||||
bottom_delta("bottom_delta", S32_MAX),
|
||||
top_pad("top_pad"),
|
||||
top_delta("top_delta", S32_MAX),
|
||||
left_pad("left_pad"),
|
||||
left_delta("left_delta", S32_MAX),
|
||||
from_xui("from_xui", true),
|
||||
focus_root("focus_root", false),
|
||||
needs_translate("translate"),
|
||||
xmlns("xmlns"),
|
||||
xmlns_xsi("xmlns:xsi"),
|
||||
xsi_schemaLocation("xsi:schemaLocation"),
|
||||
xsi_type("xsi:type")
|
||||
|
||||
{
|
||||
addSynonym(rect, "");
|
||||
}
|
||||
|
||||
LLView::LLView(const LLView::Params& p)
|
||||
{
|
||||
init(p);
|
||||
}
|
||||
|
||||
void LLView::init(const LLView::Params& p)
|
||||
{
|
||||
mVisible = p.visible;
|
||||
mInDraw = false;
|
||||
mName = p.name;
|
||||
mParentView = NULL;
|
||||
mReshapeFlags = FOLLOWS_NONE;
|
||||
mSaveToXML = p.from_xui;
|
||||
mIsFocusRoot = p.focus_root;
|
||||
mLastVisible = FALSE;
|
||||
mNextInsertionOrdinal = 0;
|
||||
mHoverCursor = getCursorFromString(p.hover_cursor);
|
||||
mEnabled = p.enabled;
|
||||
mMouseOpaque = p.mouse_opaque;
|
||||
mSoundFlags = p.sound_flags;
|
||||
mUseBoundingRect = p.use_bounding_rect;
|
||||
mDefaultTabGroup = p.default_tab_group;
|
||||
mLastTabGroup = 0;
|
||||
//mToolTipMsg((LLStringExplicit)p.tool_tip()),
|
||||
//mDefaultWidgets(NULL)
|
||||
|
||||
// create rect first, as this will supply initial follows flags
|
||||
setShape(p.rect);
|
||||
mReshapeFlags = p.follows.flags;
|
||||
}
|
||||
|
||||
LLView::LLView()
|
||||
{
|
||||
init(LLView::Params());
|
||||
}
|
||||
|
||||
LLView::LLView(const std::string& name, BOOL mouse_opaque)
|
||||
: mVisible(TRUE),
|
||||
mInDraw(false),
|
||||
mName(name),
|
||||
mParentView(NULL),
|
||||
mReshapeFlags(FOLLOWS_NONE),
|
||||
mDefaultTabGroup(0),
|
||||
mEnabled(TRUE),
|
||||
mMouseOpaque(mouse_opaque),
|
||||
mSoundFlags(MOUSE_UP), // default to only make sound on mouse up
|
||||
mSaveToXML(TRUE),
|
||||
mIsFocusRoot(FALSE),
|
||||
mLastVisible(TRUE),
|
||||
mUseBoundingRect(FALSE),
|
||||
mNextInsertionOrdinal(0),
|
||||
mHoverCursor(UI_CURSOR_ARROW),
|
||||
mLastTabGroup(0),
|
||||
// <edit>
|
||||
mDelayedDelete(FALSE)
|
||||
// </edit>
|
||||
{
|
||||
LLView::Params p;
|
||||
p.name = name;
|
||||
p.mouse_opaque = mouse_opaque;
|
||||
init(p);
|
||||
}
|
||||
|
||||
|
||||
LLView::LLView(
|
||||
const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 reshape)
|
||||
: mVisible(TRUE),
|
||||
mInDraw(false),
|
||||
mName(name),
|
||||
mParentView(NULL),
|
||||
mRect(rect),
|
||||
mBoundingRect(rect),
|
||||
mReshapeFlags(reshape),
|
||||
mDefaultTabGroup(0),
|
||||
mEnabled(TRUE),
|
||||
mMouseOpaque(mouse_opaque),
|
||||
mSoundFlags(MOUSE_UP), // default to only make sound on mouse up
|
||||
mSaveToXML(TRUE),
|
||||
mIsFocusRoot(FALSE),
|
||||
mLastVisible(TRUE),
|
||||
mUseBoundingRect(FALSE),
|
||||
mNextInsertionOrdinal(0),
|
||||
mHoverCursor(UI_CURSOR_ARROW),
|
||||
mLastTabGroup(0),
|
||||
// <edit>
|
||||
mDelayedDelete(FALSE)
|
||||
// </edit>
|
||||
LLView::LLView( const std::string& name, const LLRect& rect, BOOL mouse_opaque, U32 reshape)
|
||||
{
|
||||
LLView::Params p;
|
||||
p.name = name;
|
||||
p.mouse_opaque = mouse_opaque;
|
||||
p.rect = rect;
|
||||
p.follows.flags = reshape;
|
||||
init(p);
|
||||
}
|
||||
|
||||
|
||||
@@ -160,15 +178,10 @@ LLView::~LLView()
|
||||
{
|
||||
//llinfos << "Deleting view " << mName << ":" << (void*) this << llendl;
|
||||
// llassert(LLView::sIsDrawing == FALSE);
|
||||
if( gFocusMgr.getKeyboardFocus() == this )
|
||||
{
|
||||
llwarns << "View holding keyboard focus deleted: " << getName() << ". Keyboard focus removed." << llendl;
|
||||
gFocusMgr.removeKeyboardFocusWithoutCallback( this );
|
||||
}
|
||||
|
||||
if( hasMouseCapture() )
|
||||
{
|
||||
llwarns << "View holding mouse capture deleted: " << getName() << ". Mouse capture removed." << llendl;
|
||||
//llwarns << "View holding mouse capture deleted: " << getName() << ". Mouse capture removed." << llendl;
|
||||
gFocusMgr.removeMouseCaptureWithoutCallback( this );
|
||||
}
|
||||
|
||||
@@ -616,11 +629,6 @@ void LLView::setVisible(BOOL visible)
|
||||
{
|
||||
if ( mVisible != visible )
|
||||
{
|
||||
if( !visible && (gFocusMgr.getTopCtrl() == this) )
|
||||
{
|
||||
gFocusMgr.setTopCtrl( NULL );
|
||||
}
|
||||
|
||||
mVisible = visible;
|
||||
|
||||
// notify children of visibility change if root, or part of visible hierarchy
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "stdenums.h"
|
||||
#include "lluistring.h"
|
||||
#include "llcursortypes.h"
|
||||
#include "llinitparam.h"
|
||||
#include "llfocusmgr.h"
|
||||
|
||||
const U32 FOLLOWS_NONE = 0x00;
|
||||
@@ -68,88 +69,6 @@ const BOOL NOT_MOUSE_OPAQUE = FALSE;
|
||||
|
||||
const U32 GL_NAME_UI_RESERVED = 2;
|
||||
|
||||
/*
|
||||
// virtual functions defined in LLView:
|
||||
|
||||
virtual BOOL isCtrl() const;
|
||||
LLUICtrl
|
||||
virtual BOOL isPanel();
|
||||
LLPanel
|
||||
virtual void setRect(const LLRect &rect);
|
||||
LLLineEditor
|
||||
virtual void addCtrl( LLUICtrl* ctrl, S32 tab_group);
|
||||
virtual void addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group);
|
||||
virtual void removeCtrl( LLUICtrl* ctrl);
|
||||
LLPanel
|
||||
virtual BOOL canFocusChildren() const { return TRUE; }
|
||||
LLFolderView
|
||||
virtual void deleteAllChildren();
|
||||
LLFolderView, LLPanelObjectInventory
|
||||
virtual void setTentative(BOOL b) {}
|
||||
LLUICtrl, LLSliderCtrl, LLSpinCtrl
|
||||
virtual BOOL getTentative() const { return FALSE; }
|
||||
LLUICtrl, LLCheckBoxCtrl
|
||||
virtual void setVisible(BOOL visible);
|
||||
LLFloater, LLAlertDialog, LLMenuItemGL, LLModalDialog
|
||||
virtual void setEnabled(BOOL enabled) { mEnabled = enabled; }
|
||||
LLCheckBoxCtrl, LLComboBox, LLLineEditor, LLMenuGL, LLRadioGroup, etc
|
||||
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ) { return FALSE; }
|
||||
LLUICtrl, LLButton, LLCheckBoxCtrl, LLLineEditor, LLMenuGL, LLSliderCtrl
|
||||
virtual void handleVisibilityChange ( BOOL curVisibilityIn );
|
||||
LLMenuGL
|
||||
virtual LLRect getSnapRect() const { return mRect; } *TODO: Make non virtual
|
||||
LLFloater
|
||||
virtual LLRect getRequiredRect() { return mRect; }
|
||||
LLScrolllistCtrl
|
||||
virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
|
||||
LLUICtrl, et. al.
|
||||
virtual void translate( S32 x, S32 y );
|
||||
LLMenuGL
|
||||
virtual void handleReshape(const LLRect& new_rect, bool by_user = false);
|
||||
LLFloater, LLScrollLIstVtrl
|
||||
virtual LLView* findSnapRect(LLRect& new_rect, const LLCoordGL& mouse_dir, LLView::ESnapType snap_type, S32 threshold, S32 padding = 0);
|
||||
virtual LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding = 0);
|
||||
LLScrollListCtrl
|
||||
virtual BOOL canSnapTo(const LLView* other_view) { return other_view != this && other_view->getVisible(); }
|
||||
LLFloater
|
||||
virtual void setSnappedTo(const LLView* snap_view) {}
|
||||
LLFloater
|
||||
virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
|
||||
*
|
||||
virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
|
||||
*
|
||||
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,EDragAndDropType cargo_type,void* cargo_data,EAcceptance* accept,std::string& tooltip_msg);
|
||||
*
|
||||
virtual void draw();
|
||||
*
|
||||
|
||||
*
|
||||
virtual LLXMLNodePtr getXML(bool save_children = true) const;
|
||||
*
|
||||
virtual void initFromXML(LLXMLNodePtr node, LLView* parent);
|
||||
*
|
||||
virtual void onFocusLost() {}
|
||||
LLUICtrl, LLScrollListCtrl, LLMenuGL, LLLineEditor, LLComboBox
|
||||
virtual void onFocusReceived() {}
|
||||
LLUICtrl, LLTextEditor, LLScrollListVtrl, LLMenuGL, LLLineEditor
|
||||
virtual LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const;
|
||||
LLTabContainer, LLPanel, LLMenuGL
|
||||
virtual void setControlName(const std::string& control, LLView *context);
|
||||
LLSliderCtrl, LLCheckBoxCtrl
|
||||
virtual std::string getControlName() const { return mControlName; }
|
||||
LLSliderCtrl, LLCheckBoxCtrl
|
||||
virtual bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
|
||||
LLMenuItem
|
||||
virtual void setValue(const LLSD& value);
|
||||
*
|
||||
|
||||
protected:
|
||||
virtual BOOL handleKeyHere(KEY key, MASK mask);
|
||||
*
|
||||
virtual BOOL handleUnicodeCharHere(llwchar uni_char);
|
||||
*
|
||||
*/
|
||||
|
||||
class LLUICtrlFactory;
|
||||
|
||||
// maps xml strings to widget classes
|
||||
@@ -209,9 +128,73 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement
|
||||
class LLView
|
||||
: public LLMouseHandler, // handles mouse events
|
||||
public LLFocusableElement, // handles keyboard events
|
||||
public LLMortician // lazy deletion
|
||||
//public LLHandleProvider<LLView> // passes out weak references to self
|
||||
{
|
||||
public:
|
||||
struct Follows : public LLInitParam::ChoiceBlock<Follows>
|
||||
{
|
||||
Alternative<std::string> string;
|
||||
Alternative<U32> flags;
|
||||
|
||||
Follows();
|
||||
};
|
||||
|
||||
struct Params : public LLInitParam::Block<Params>
|
||||
{
|
||||
Mandatory<std::string> name;
|
||||
|
||||
Optional<bool> enabled,
|
||||
visible,
|
||||
mouse_opaque,
|
||||
use_bounding_rect,
|
||||
from_xui,
|
||||
focus_root;
|
||||
|
||||
Optional<S32> tab_group,
|
||||
default_tab_group;
|
||||
Optional<std::string> tool_tip;
|
||||
|
||||
Optional<S32> sound_flags;
|
||||
Optional<Follows> follows;
|
||||
Optional<std::string> hover_cursor;
|
||||
|
||||
Optional<std::string> layout;
|
||||
Optional<LLRect> rect;
|
||||
|
||||
// Historical bottom-left layout used bottom_delta and left_delta
|
||||
// for relative positioning. New layout "topleft" prefers specifying
|
||||
// based on top edge.
|
||||
Optional<S32> bottom_delta, // from last bottom to my bottom
|
||||
top_pad, // from last bottom to my top
|
||||
top_delta, // from last top to my top
|
||||
left_pad, // from last right to my left
|
||||
left_delta; // from last left to my left
|
||||
|
||||
//FIXME: get parent context involved in parsing traversal
|
||||
Ignored needs_translate, // cue for translation tools
|
||||
xmlns, // xml namespace
|
||||
xmlns_xsi, // xml namespace
|
||||
xsi_schemaLocation, // xml schema
|
||||
xsi_type; // xml schema type
|
||||
|
||||
Params();
|
||||
};
|
||||
|
||||
void initFromParams(const LLView::Params&);
|
||||
|
||||
protected:
|
||||
LLView(const LLView::Params&);
|
||||
//friend class LLUICtrlFactory;
|
||||
private:
|
||||
void init(const LLView::Params&);
|
||||
|
||||
private:
|
||||
// widgets in general are not copyable
|
||||
LLView(const LLView& other) {};
|
||||
public:
|
||||
#if LL_DEBUG
|
||||
static BOOL sIsDrawing;
|
||||
@@ -663,15 +646,9 @@ private:
|
||||
LLRootHandle<LLView> mHandle;
|
||||
BOOL mLastVisible;
|
||||
|
||||
|
||||
|
||||
S32 mNextInsertionOrdinal;
|
||||
|
||||
bool mInDraw;
|
||||
// <edit>
|
||||
public:
|
||||
BOOL mDelayedDelete;
|
||||
// </edit>
|
||||
private:
|
||||
|
||||
static LLWindow* sWindow; // All root views must know about their window.
|
||||
|
||||
Reference in New Issue
Block a user