本文整理汇总了C++中LLPanel::getRect方法的典型用法代码示例。如果您正苦于以下问题:C++ LLPanel::getRect方法的具体用法?C++ LLPanel::getRect怎么用?C++ LLPanel::getRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLPanel
的用法示例。
在下文中一共展示了LLPanel::getRect方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onTabChange
void LLPanelMarketplaceListings::onTabChange()
{
// Find active panel
LLInventoryPanel* panel = (LLInventoryPanel*)getChild<LLTabContainer>("marketplace_filter_tabs")->getCurrentPanel();
if (panel)
{
// If the panel doesn't allow drop on root, it doesn't allow the creation of new folder on root either
LLButton* add_btn = getChild<LLButton>("add_btn");
add_btn->setEnabled(panel->getAllowDropOnRoot());
// Set filter string on active panel
panel->setFilterSubString(mFilterSubString);
// Show/hide the drop zone and resize the inventory tabs panel accordingly
LLPanel* drop_zone = (LLPanel*)getChild<LLPanel>("marketplace_drop_zone");
bool drop_zone_visible = drop_zone->getVisible();
bool allow_drop_on_root = panel->getAllowDropOnRoot() && gSavedSettings.getBOOL("LiruEnableWIPUI");
if (drop_zone_visible != allow_drop_on_root)
{
LLPanel* tabs = (LLPanel*)getChild<LLPanel>("tab_container_panel");
S32 delta_height = drop_zone->getRect().getHeight();
delta_height = (drop_zone_visible ? delta_height : -delta_height);
tabs->reshape(tabs->getRect().getWidth(),tabs->getRect().getHeight() + delta_height);
tabs->translate(0,-delta_height);
}
drop_zone->setVisible(allow_drop_on_root);
}
}
示例2: fromXML
LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *factory)
{
std::string name("panel");
node->getAttributeString("name", name);
LLPanel* panelp = factory->createFactoryPanel(name);
LLFastTimer _(FTM_PANEL_CONSTRUCTION);
// Fall back on a default panel, if there was no special factory.
if (!panelp)
{
LLRect rect;
createRect(node, rect, parent, LLRect());
// create a new panel without a border, by default
panelp = new LLPanel(name, rect, FALSE);
// for local registry callbacks; define in constructor, referenced in XUI or postBuild
panelp->mCommitCallbackRegistrar.pushScope();
panelp->mEnableCallbackRegistrar.pushScope();
panelp->initPanelXML(node, parent, factory);
panelp->mCommitCallbackRegistrar.popScope();
panelp->mEnableCallbackRegistrar.popScope();
// preserve panel's width and height, but override the location
const LLRect& panelrect = panelp->getRect();
S32 w = panelrect.getWidth();
S32 h = panelrect.getHeight();
rect.setLeftTopAndSize(rect.mLeft, rect.mTop, w, h);
panelp->setRect(rect);
}
else
{
if(!factory->builtPanel(panelp))
{
// for local registry callbacks; define in constructor, referenced in XUI or postBuild
panelp->mCommitCallbackRegistrar.pushScope();
panelp->mEnableCallbackRegistrar.pushScope();
panelp->initPanelXML(node, parent, factory);
panelp->mCommitCallbackRegistrar.popScope();
panelp->mEnableCallbackRegistrar.popScope();
}
else
{
LLRect new_rect = panelp->getRect();
// override rectangle with embedding parameters as provided
panelp->createRect(node, new_rect, parent);
panelp->setOrigin(new_rect.mLeft, new_rect.mBottom);
panelp->setShape(new_rect);
// optionally override follows flags from including nodes
panelp->parseFollowsFlags(node);
}
}
return panelp;
}
示例3: fromXML
LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *factory)
{
std::string name("panel");
node->getAttributeString("name", name);
LLPanel* panelp = factory->createFactoryPanel(name);
// Fall back on a default panel, if there was no special factory.
if (!panelp)
{
LLRect rect;
createRect(node, rect, parent, LLRect());
// create a new panel without a border, by default
panelp = new LLPanel(name, rect, FALSE);
panelp->initPanelXML(node, parent, factory);
// preserve panel's width and height, but override the location
const LLRect& panelrect = panelp->getRect();
S32 w = panelrect.getWidth();
S32 h = panelrect.getHeight();
rect.setLeftTopAndSize(rect.mLeft, rect.mTop, w, h);
panelp->setRect(rect);
}
else
{
panelp->initPanelXML(node, parent, factory);
}
return panelp;
}
示例4: onOpen
// virtual
void LLInspectToast::onOpen(const LLSD& notification_id)
{
LLInspect::onOpen(notification_id);
LLToast* toast = mScreenChannel->getToastByNotificationID(notification_id);
if (toast == NULL)
{
llwarns << "Could not get requested toast from screen channel." << llendl;
return;
}
mConnection = toast->setOnToastDestroyedCallback(boost::bind(&LLInspectToast::onToastDestroy, this, _1));
LLPanel * panel = toast->getPanel();
panel->setVisible(TRUE);
panel->setMouseOpaque(FALSE);
if(mPanel != NULL && mPanel->getParent() == this)
{
removeChild(mPanel);
}
addChild(panel);
panel->setFocus(TRUE);
mPanel = panel;
LLRect panel_rect;
panel_rect = panel->getRect();
reshape(panel_rect.getWidth(), panel_rect.getHeight());
LLUI::positionViewNearMouse(this);
}
示例5: notifyChildren
bool LLPanelMe::notifyChildren(const LLSD& info)
{
if (info.has("task-panel-action") && info["task-panel-action"].asString() == "handle-tri-state")
{
// Implement task panel tri-state behavior.
//
// When the button of an active open task panel is clicked, side tray
// calls notifyChildren() on the panel, passing task-panel-action=>handle-tri-state as an argument.
// The task panel is supposed to handle this by reverting to the default view,
// i.e. closing any dependent panels like "pick info" or "profile edit".
bool on_default_view = true;
const LLRect& task_panel_rect = getRect();
for (LLView* child = getFirstChild(); child; child = findNextSibling(child))
{
LLPanel* panel = dynamic_cast<LLPanel*>(child);
if (!panel)
continue;
// *HACK: implement panel stack instead (e.g. me->pick_info->pick_edit).
if (panel->getRect().getWidth() == task_panel_rect.getWidth() &&
panel->getRect().getHeight() == task_panel_rect.getHeight() &&
panel->getVisible())
{
panel->setVisible(FALSE);
on_default_view = false;
}
}
if (on_default_view)
LLSideTray::getInstance()->collapseSideBar();
return true; // this notification is only supposed to be handled by task panels
}
return LLPanel::notifyChildren(info);
}
示例6: reshapeToPanel
void LLToast::reshapeToPanel()
{
LLPanel* panel = getPanel();
if(!panel)
return;
LLRect panel_rect = panel->getRect();
panel_rect.setLeftTopAndSize(0, panel_rect.getHeight(), panel_rect.getWidth(), panel_rect.getHeight());
panel->setShape(panel_rect);
LLRect toast_rect = getRect();
toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop,
panel_rect.getWidth() + getRightPad(), panel_rect.getHeight() + getTopPad());
setShape(toast_rect);
}
示例7: updateLayout
void LLLayoutStack::updateLayout(BOOL force_resize)
{
LLFastTimer ft(FTM_UPDATE_LAYOUT);
static LLUICachedControl<S32> resize_bar_overlap ("UIResizeBarOverlap", 0);
calcMinExtents();
createResizeBars();
// calculate current extents
S32 total_width = 0;
S32 total_height = 0;
e_panel_list_t::iterator panel_it;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
LLPanel* panelp = (*panel_it);
if (panelp->getVisible())
{
if (mAnimate)
{
if (!mAnimatedThisFrame)
{
(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant));
if ((*panel_it)->mVisibleAmt > 0.99f)
{
(*panel_it)->mVisibleAmt = 1.f;
}
}
}
else
{
(*panel_it)->mVisibleAmt = 1.f;
}
}
else // not visible
{
if (mAnimate)
{
if (!mAnimatedThisFrame)
{
(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
if ((*panel_it)->mVisibleAmt < 0.001f)
{
(*panel_it)->mVisibleAmt = 0.f;
}
}
}
else
{
(*panel_it)->mVisibleAmt = 0.f;
}
}
if ((*panel_it)->mCollapsed)
{
(*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 1.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
}
else
{
(*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
}
if (mOrientation == HORIZONTAL)
{
// enforce minimize size constraint by default
if (panelp->getRect().getWidth() < (*panel_it)->mMinDim)
{
panelp->reshape((*panel_it)->mMinDim, panelp->getRect().getHeight());
}
total_width += llround(panelp->getRect().getWidth() * (*panel_it)->getCollapseFactor(mOrientation));
// want n-1 panel gaps for n panels
if (panel_it != mPanels.begin())
{
total_width += mPanelSpacing;
}
}
else //VERTICAL
{
// enforce minimize size constraint by default
if (panelp->getRect().getHeight() < (*panel_it)->mMinDim)
{
panelp->reshape(panelp->getRect().getWidth(), (*panel_it)->mMinDim);
}
total_height += llround(panelp->getRect().getHeight() * (*panel_it)->getCollapseFactor(mOrientation));
if (panel_it != mPanels.begin())
{
total_height += mPanelSpacing;
}
}
}
S32 num_resizable_panels = 0;
S32 shrink_headroom_available = 0;
S32 shrink_headroom_total = 0;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
// panels that are not fully visible do not count towards shrink headroom
if ((*panel_it)->getCollapseFactor(mOrientation) < 1.f)
{
continue;
}
//.........这里部分代码省略.........
示例8: postBuild
BOOL LLPanelGroupNotices::postBuild()
{
bool recurse = true;
mNoticesList = getChild<LLScrollListCtrl>("notice_list",recurse);
mNoticesList->setCommitOnSelectionChange(TRUE);
mNoticesList->setCommitCallback(onSelectNotice);
mNoticesList->setCallbackUserData(this);
mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse);
mBtnNewMessage->setClickedCallback(onClickNewMessage);
mBtnNewMessage->setCallbackUserData(this);
mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND));
mBtnGetPastNotices = getChild<LLButton>("refresh_notices",recurse);
mBtnGetPastNotices->setClickedCallback(onClickRefreshNotices);
mBtnGetPastNotices->setCallbackUserData(this);
// Create
mCreateSubject = getChild<LLLineEditor>("create_subject",recurse);
mCreateMessage = getChild<LLTextEditor>("create_message",recurse);
mCreateInventoryName = getChild<LLLineEditor>("create_inventory_name",recurse);
mCreateInventoryName->setTabStop(FALSE);
mCreateInventoryName->setEnabled(FALSE);
mCreateInventoryIcon = getChild<LLIconCtrl>("create_inv_icon",recurse);
mCreateInventoryIcon->setVisible(FALSE);
mBtnSendMessage = getChild<LLButton>("send_notice",recurse);
mBtnSendMessage->setClickedCallback(onClickSendMessage);
mBtnSendMessage->setCallbackUserData(this);
mBtnRemoveAttachment = getChild<LLButton>("remove_attachment",recurse);
mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment);
mBtnRemoveAttachment->setCallbackUserData(this);
mBtnRemoveAttachment->setEnabled(FALSE);
// View
mViewSubject = getChild<LLLineEditor>("view_subject",recurse);
mViewMessage = getChild<LLTextEditor>("view_message",recurse);
mViewInventoryName = getChild<LLLineEditor>("view_inventory_name",recurse);
mViewInventoryName->setTabStop(FALSE);
mViewInventoryName->setEnabled(FALSE);
mViewInventoryIcon = getChild<LLIconCtrl>("view_inv_icon",recurse);
mViewInventoryIcon->setVisible(FALSE);
mBtnOpenAttachment = getChild<LLButton>("open_attachment",recurse);
mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment);
mBtnOpenAttachment->setCallbackUserData(this);
mNoNoticesStr = getString("no_notices_text");
mPanelCreateNotice = getChild<LLPanel>("panel_create_new_notice",recurse);
mPanelViewNotice = getChild<LLPanel>("panel_view_past_notice",recurse);
// Must be in front of all other UI elements.
LLPanel* dtv = getChild<LLPanel>("drop_target",recurse);
LLGroupDropTarget* target = new LLGroupDropTarget("drop_target",
dtv->getRect(),
this, mGroupID);
target->setEnabled(TRUE);
target->setToolTip(dtv->getToolTip());
mPanelCreateNotice->addChild(target);
mPanelCreateNotice->removeChild(dtv, TRUE);
arrangeNoticeView(VIEW_PAST_NOTICE);
return LLPanelGroupTab::postBuild();
}
示例9: rearrangeItems
void LLFlatListView::rearrangeItems()
{
static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
setNoItemsCommentVisible(mItemPairs.empty());
if (mItemPairs.empty()) return;
//calculating required height - assuming items can be of different height
//list should accommodate all its items
S32 height = 0;
S32 invisible_children_count = 0;
pairs_iterator_t it = mItemPairs.begin();
for (; it != mItemPairs.end(); ++it)
{
LLPanel* item = (*it)->first;
// skip invisible child
if (!item->getVisible())
{
++invisible_children_count;
continue;
}
height += item->getRect().getHeight();
}
// add paddings between items, excluding invisible ones
height += mItemPad * (mItemPairs.size() - invisible_children_count - 1);
LLRect rc = mItemsPanel->getRect();
S32 width = mItemsNoScrollWidth;
// update width to avoid horizontal scrollbar
if (height > getRect().getHeight() - 2 * mBorderThickness)
width -= scrollbar_size;
//changes the bottom, end of the list goes down in the scroll container
rc.setLeftTopAndSize(rc.mLeft, rc.mTop, width, height);
mItemsPanel->setRect(rc);
//reshaping items
S32 item_new_top = height;
pairs_iterator_t it2, first_it = mItemPairs.begin();
for (it2 = first_it; it2 != mItemPairs.end(); ++it2)
{
LLPanel* item = (*it2)->first;
// skip invisible child
if (!item->getVisible())
continue;
LLRect rc = item->getRect();
rc.setLeftTopAndSize(rc.mLeft, item_new_top, width, rc.getHeight());
item->reshape(rc.getWidth(), rc.getHeight());
item->setRect(rc);
// move top for next item in list
item_new_top -= (rc.getHeight() + mItemPad);
}
// Stretch selected item rect to ensure it won't be clipped
mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1));
}
示例10: LLRect
LLFloaterTestImpl::LLFloaterTestImpl()
: LLFloater(std::string("test"), LLRect(0, 500, 700, 0), std::string("Test UI"))
{
const S32 HPAD = 5;
const S32 VPAD = 5;
const S32 LEFT = HPAD;
const S32 RIGHT = getRect().getWidth() - HPAD;
const S32 TOP = getRect().getHeight() - LLFLOATER_HEADER_SIZE - VPAD;
const S32 BOTTOM = VPAD;
const S32 LINE = 15;
//S32 x = LEFT;
S32 y = TOP;
LLTextBox* text = NULL;
LLButton* btn = NULL;
LLTabContainer* tab = NULL;
LLPanel* panel = NULL;
LLCheckBoxCtrl* check = NULL;
LLComboBox* combo = NULL;
btn = new LLButton(std::string("can't click"),
LLRect(LEFT+150, y, LEFT+150+100, y-LINE),
LLStringUtil::null,
boost::bind(&LLFloaterTestImpl::onClickButton));
btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP);
btn->setFont(LLFontGL::getFontSansSerifSmall());
addChild(btn);
text = new LLTextBox(std::string("simple_text"),
std::string("simple sans-serif text that is mouse opaque opaque opaque"),
50, // max_width
LLFontGL::getFontSansSerifSmall(),
TRUE); // mouse_opaque
text->setClickedCallback(boost::bind(&onClickText));
text->setRect(LLRect(LEFT, y, RIGHT, y-LINE));
addChild(text);
y -= VPAD + LINE;
btn = new LLButton(std::string("can click"),
LLRect(LEFT+150, y, LEFT+150+100, y-LINE),
LLStringUtil::null,
boost::bind(&LLFloaterTestImpl::onClickButton));
btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP);
btn->setFont(LLFontGL::getFontSansSerifSmall());
addChild(btn);
text = new LLTextBox(std::string("simple2_text"),
LLRect(LEFT, y, RIGHT, y-LINE),
std::string("monospaced, non-opaque text with tooltip, non-opaque non-opaque"),
LLFontGL::getFontMonospace(),
FALSE); // mouse_opaque
text->setToolTip(std::string("I'm a tooltip"));
addChild(text);
y -= VPAD + LINE;
tab = new LLTabContainer(std::string("test_tab"),
LLRect(LEFT, y, RIGHT, BOTTOM),
LLTabContainer::TOP,
TRUE, // bordered
FALSE); // horizontal
addChild(tab);
mTab = tab;
tab->setCommitCallback(boost::bind(&LLFloaterTestImpl::onClickTab));
//-----------------------------------------------------------------------
// First tab container panel
//-----------------------------------------------------------------------
panel = new LLPanel(std::string("first_tab_panel"),
LLRect(0, 400, 400, 0), // dummy rect
TRUE); // bordered
tab->addTabPanel(panel, std::string("First"),
TRUE); // select
y = panel->getRect().getHeight() - VPAD;
text = new LLTextBox(std::string("unicode_text"),
LLRect(LEFT, y, RIGHT, y-LINE),
std::string("File"),
LLFontGL::getFontSansSerif(),
TRUE); // mouse_opaque
text->setToolTip(std::string("This should be Unicode text"));
panel->addChild(text);
y -= VPAD + LINE;
btn = new LLButton(std::string("unicode_btn"), LLRect(LEFT, y, LEFT+100, y-20));
btn->setLabel(std::string("unicode"));
panel->addChild(btn);
y -= VPAD + 20;
btn = new LLButton(std::string("image_btn"),
LLRect(LEFT, y, LEFT+32, y-32),
std::string("tool_zoom.tga"),
std::string("tool_zoom_active.tga"),
LLStringUtil::null,
//.........这里部分代码省略.........