LinkElement::LinkElement(const ref_ptr<Element>& parent) : Element(parent), state(LinkState::INACTIVE) { setRect(vector4f()); }
Rect& Rect::operator= (const Rect& other) { setRect(other.origin.x, other.origin.y, other.size.width, other.size.height); return *this; }
void Label::setLabel(const std::string &string) { setLabel(sf::String(string)); setRect(getVirtualRect()); m_text.setOrigin(sf::Vector2f(0, 0)); }
//--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- LLPanelLogin::LLPanelLogin(const LLRect &rect, BOOL show_server, void (*callback)(S32 option, void* user_data), void *cb_data) : LLPanel(std::string("panel_login"), LLRect(0,600,800,0), FALSE), // not bordered mLogoImage(), mCallback(callback), mCallbackData(cb_data), mHtmlAvailable( TRUE ) { setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); // instance management if (LLPanelLogin::sInstance) { llwarns << "Duplicate instance of login view deleted" << llendl; delete LLPanelLogin::sInstance; // Don't leave bad pointer in gFocusMgr gFocusMgr.setDefaultKeyboardFocus(NULL); } LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child gViewerWindow->getRootView()->addChildAtEnd(this); // Logo mLogoImage = LLUI::getUIImage("startup_logo.j2c"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); #if USE_VIEWER_AUTH //leave room for the login menu bar setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0)); #endif reshape(rect.getWidth(), rect.getHeight()); #if !USE_VIEWER_AUTH childSetPrevalidate("first_name_edit", LLLineEditor::prevalidatePrintableNoSpace); childSetPrevalidate("last_name_edit", LLLineEditor::prevalidatePrintableNoSpace); childSetCommitCallback("password_edit", mungePassword); childSetKeystrokeCallback("password_edit", onPassKey, this); childSetUserData("password_edit", this); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("channel_text")); sendChildToBack(getChildView("forgot_password_text")); LLLineEditor* edit = getChild<LLLineEditor>("password_edit"); if (edit) edit->setDrawAsterixes(TRUE); LLComboBox* combo = getChild<LLComboBox>("start_location_combo"); combo->setAllowTextEntry(TRUE, 128, FALSE); // The XML file loads the combo with the following labels: // 0 - "My Home" // 1 - "My Last Location" // 2 - "<Type region name>" BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); std::string sim_string = LLURLSimString::sInstance.mSimString; if (!sim_string.empty()) { // Replace "<Type region name>" with this region name combo->remove(2); combo->add( sim_string ); combo->setTextEntry(sim_string); combo->setCurrentByIndex( 2 ); } else if (login_last) { combo->setCurrentByIndex( 1 ); } else { combo->setCurrentByIndex( 0 ); } LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo"); server_choice_combo->setCommitCallback(onSelectServer); //server_choice_combo->setFocusLostCallback(onServerComboLostFocus); childSetAction("connect_btn", onClickConnect, this); childSetAction("grid_btn", onClickGrid, this); setDefaultBtn("connect_btn"); // childSetAction("quit_btn", onClickQuit, this); std::string imp_channel = gSavedSettings.getString("VersionChannelName"); std::string imp_version = llformat("%d.%d.%d %s", ViewerVersion::getImpMajorVersion(), ViewerVersion::getImpMinorVersion(), ViewerVersion::getImpPatchVersion(), ViewerVersion::getImpTestVersion().c_str() ); std::string ll_channel = ViewerVersion::getLLViewerName(); std::string ll_version = llformat("%d.%d.%d (%d)", ViewerVersion::getLLMajorVersion(), ViewerVersion::getLLMinorVersion(), ViewerVersion::getLLPatchVersion(), ViewerVersion::getLLBuildVersion() ); LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); channel_text->setTextArg("[CHANNEL]", imp_channel); channel_text->setTextArg("[VERSION]", imp_version); channel_text->setTextArg("[ALT_CHANNEL]", ll_channel); channel_text->setTextArg("[ALT_VERSION]", ll_version); channel_text->setClickedCallback(onClickVersion); channel_text->setCallbackUserData(this); LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); forgot_password_text->setClickedCallback(onClickForgotPassword); LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text"); create_new_account_text->setClickedCallback(onClickNewAccount); #endif // get the web browser control LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("login_html"); // Need to handle login secondlife:///app/ URLs web_browser->setTrusted( true ); // observe browser events web_browser->addObserver( this ); // don't make it a tab stop until SL-27594 is fixed web_browser->setTabStop(FALSE); web_browser->navigateToLocalPage( "loading", "loading.html" ); // make links open in external browser web_browser->setOpenInExternalBrowser( true ); // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) LLRect htmlRect = getRect(); #if USE_VIEWER_AUTH htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); #else htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); #endif web_browser->setRect( htmlRect ); web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); reshape( getRect().getWidth(), getRect().getHeight(), 1 ); // kick off a request to grab the url manually gResponsePtr = LLIamHereLogin::build( this ); std::string login_page = gSavedSettings.getString("LoginPage"); if (login_page.empty()) { login_page = getString( "real_url" ); } LLHTTPClient::head( login_page, gResponsePtr ); #if !USE_VIEWER_AUTH // Initialize visibility (and don't force visibility - use prefs) refreshLocation( false ); #endif LLFirstUse::useLoginScreen(); }
Rect::Rect(float x, float y, float width, float height) { setRect(x, y, width, height); }
void QElipseItem::SetTop(qreal nTop) //set the rect top { QRectF nrect=rect(); //get the current rect position nrect.setTop(nTop); setRect(nrect); }
void Rect::startDraw(QGraphicsSceneMouseEvent * event) { setRect(QRectF(event->scenePos(), QSizeF(0, 0))); }
void NodeItem::setRadius(qreal radius) { m_radius = radius; setRect(-m_radius, -m_radius, 2 * m_radius, 2 * m_radius); update(); }
void UBGraphicsTriangle::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if (!mResizing1 && !mResizing2 && !mRotating) { QGraphicsItem::mouseMoveEvent(event); } else { QPoint currPos = sceneTransform().inverted().map(event->screenPos()); if (mResizing1) { if (mOrientation == TopLeft || mOrientation == BottomLeft) { int deltaX = currPos.x() - lastPos.x(); if (lastRect.width() + deltaX < sMinWidth) deltaX = sMinWidth - lastRect.width(); setRect(QRectF(lastRect.left(), lastRect.top(), lastRect.width() + deltaX, lastRect.height()), mOrientation); } else { int deltaX = lastPos.x() - currPos.x(); if (lastRect.width() + deltaX < sMinWidth) deltaX = sMinWidth - lastRect.width(); setRect(QRectF(lastRect.left() - deltaX, lastRect.top(), lastRect.width() + deltaX, lastRect.height()), mOrientation); } } //-----------------------------------------------// if (mResizing2) { if (mOrientation == BottomRight || mOrientation == BottomLeft) { int deltaY = lastPos.y() - currPos.y(); if (lastRect.height() + deltaY < sMinHeight) deltaY = sMinHeight - lastRect.height(); setRect(QRectF(lastRect.left(), lastRect.top() - deltaY, lastRect.width(), lastRect.height() + deltaY), mOrientation); } else { int deltaY = currPos.y() - lastPos.y(); if (lastRect.height() + deltaY < sMinHeight) deltaY = sMinHeight - lastRect.height(); setRect(QRectF(lastRect.left(), lastRect.top(), lastRect.width(), lastRect.height() + deltaY), mOrientation); } } //-----------------------------------------------// if (mRotating) { QLineF currentLine(rotationCenter(), event->pos()); QLineF lastLine(rotationCenter(), event->lastPos()); rotateAroundCenter(currentLine.angleTo(lastLine)); } //-----------------------------------------------// event->accept(); } }
//--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- LLPanelLogin::LLPanelLogin(const LLRect &rect, void (*callback)(S32 option, void* user_data), void *cb_data) : LLPanel(std::string("panel_login"), LLRect(0,600,800,0), FALSE), // not bordered mLogoImage(), mCallback(callback), mCallbackData(cb_data), mHtmlAvailable( TRUE ) { setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); // instance management if (LLPanelLogin::sInstance) { llwarns << "Duplicate instance of login view deleted" << llendl; delete LLPanelLogin::sInstance; // Don't leave bad pointer in gFocusMgr gFocusMgr.setDefaultKeyboardFocus(NULL); } LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child gViewerWindow->getRootView()->addChildInBack(this); // Logo mLogoImage = LLUI::getUIImage("startup_logo.j2c"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); #if USE_VIEWER_AUTH //leave room for the login menu bar setRect(LLRect(0, rect.getHeight()-18, rect.getWidth(), 0)); #endif reshape(rect.getWidth(), rect.getHeight()); #if !USE_VIEWER_AUTH LLComboBox* name_combo = sInstance->getChild<LLComboBox>("name_combo"); name_combo->setCommitCallback(onSelectLoginEntry); name_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLoginComboLostFocus, this, name_combo)); name_combo->setPrevalidate(LLLineEditor::prevalidatePrintableNotPipe); name_combo->setSuppressTentative(true); name_combo->setSuppressAutoComplete(true); childSetCommitCallback("remember_name_check", onNameCheckChanged); childSetCommitCallback("password_edit", mungePassword); childSetKeystrokeCallback("password_edit", onPassKey, this); childSetUserData("password_edit", this); // change z sort of clickable text to be behind buttons sendChildToBack(getChildView("channel_text")); sendChildToBack(getChildView("forgot_password_text")); LLLineEditor* edit = getChild<LLLineEditor>("password_edit"); if (edit) edit->setDrawAsterixes(TRUE); //OGPX : This keeps the uris in a history file //OGPX TODO: should this be inside an OGP only check? LLComboBox* regioncombo = getChild<LLComboBox>("regionuri_edit"); regioncombo->setAllowTextEntry(TRUE, 256, FALSE); std::string current_regionuri = gSavedSettings.getString("CmdLineRegionURI"); // iterate on uri list adding to combobox (couldn't figure out how to add them all in one call) // ... and also append the command line value we might have gotten to the URLHistory LLSD regionuri_history = LLURLHistory::getURLHistory("regionuri"); LLSD::array_iterator iter_history = regionuri_history.beginArray(); LLSD::array_iterator iter_end = regionuri_history.endArray(); for (; iter_history != iter_end; ++iter_history) { regioncombo->addSimpleElement((*iter_history).asString()); } if ( LLURLHistory::appendToURLCollection("regionuri",current_regionuri)) { // since we are in login, another read of urlhistory file is going to happen // so we need to persist the new value we just added (or maybe we should do it in startup.cpp?) // since URL history only populated on create of sInstance, add to combo list directly regioncombo->addSimpleElement(current_regionuri); } // select which is displayed if we have a current URL. regioncombo->setSelectedByValue(LLSD(current_regionuri),TRUE); //llinfos << " url history: " << LLSDOStreamer<LLSDXMLFormatter>(LLURLHistory::getURLHistory("regionuri")) << llendl; LLComboBox* combo = getChild<LLComboBox>("start_location_combo"); combo->setAllowTextEntry(TRUE, 128, FALSE); // The XML file loads the combo with the following labels: // 0 - "My Home" // 1 - "My Last Location" // 2 - "<Type region name>" BOOL login_last = gSavedSettings.getBOOL("LoginLastLocation"); std::string sim_string = LLURLSimString::sInstance.mSimString; if (!sim_string.empty()) { // Replace "<Type region name>" with this region name combo->remove(2); combo->add( sim_string ); combo->setTextEntry(sim_string); combo->setCurrentByIndex( 2 ); } else if (login_last) { combo->setCurrentByIndex( 1 ); } else { combo->setCurrentByIndex( 0 ); } combo->setCommitCallback( &set_start_location ); childSetAction("connect_btn", onClickConnect, this); setDefaultBtn("connect_btn"); // childSetAction("quit_btn", onClickQuit, this); childSetAction("grids_btn", onClickGrids, this); childSetCommitCallback("grids_combo", onSelectGrid, this); std::string channel = gVersionChannel; std::string version = llformat("%d.%d.%d (%d)", gVersionMajor, gVersionMinor, gVersionPatch, LL_VIEWER_BUILD ); LLTextBox* channel_text = getChild<LLTextBox>("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); channel_text->setClickedCallback(onClickVersion); channel_text->setCallbackUserData(this); LLTextBox* forgot_password_text = getChild<LLTextBox>("forgot_password_text"); forgot_password_text->setClickedCallback(onClickForgotPassword); LLTextBox* create_new_account_text = getChild<LLTextBox>("create_new_account_text"); create_new_account_text->setClickedCallback(onClickNewAccount); #endif // get the web browser control LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html"); web_browser->addObserver(this); // Need to handle login secondlife:///app/ URLs web_browser->setTrusted( true ); // don't make it a tab stop until SL-27594 is fixed web_browser->setTabStop(FALSE); // web_browser->navigateToLocalPage( "loading", "loading.html" ); // make links open in external browser web_browser->setOpenInExternalBrowser( true ); // force the size to be correct (XML doesn't seem to be sufficient to do this) (with some padding so the other login screen doesn't show through) LLRect htmlRect = getRect(); #if USE_VIEWER_AUTH htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY(), getRect().getWidth() + 6, getRect().getHeight()); #else htmlRect.setCenterAndSize( getRect().getCenterX() - 2, getRect().getCenterY() + 40, getRect().getWidth() + 6, getRect().getHeight() - 78 ); #endif web_browser->setRect( htmlRect ); web_browser->reshape( htmlRect.getWidth(), htmlRect.getHeight(), TRUE ); reshape( getRect().getWidth(), getRect().getHeight(), 1 ); updateGridCombo(); childSetVisible("create_new_account_text", !gHippoGridManager->getConnectedGrid()->getRegisterUrl().empty()); childSetVisible("forgot_password_text", !gHippoGridManager->getConnectedGrid()->getPasswordUrl().empty()); loadLoginPage(); #if !USE_VIEWER_AUTH // Initialize visibility (and don't force visibility - use prefs) refreshLocation( false ); #endif //loadNewsBar(); }
Rect::Rect(int blX, int blY, int trX ,int trY): m_impl(new Implementation) { setRect(blX,blY,trX,trY); }
Power::Power(){ this->setBrush(QBrush(Qt::green, Qt::SolidPattern)); setRect(0,0,20,20); }
// Default constructor LLPreviewNotecard::LLPreviewNotecard(const std::string& name, const LLRect& rect, const std::string& title, const LLUUID& item_id, const LLUUID& object_id, const LLUUID& asset_id, BOOL show_keep_discard, LLPointer<LLViewerInventoryItem> inv_item) : LLPreview(name, rect, title, item_id, object_id, TRUE, PREVIEW_MIN_WIDTH, PREVIEW_MIN_HEIGHT, inv_item), mAssetID( asset_id ), mNotecardItemID(item_id), mObjectID(object_id) { LLRect curRect = rect; if (show_keep_discard) { LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard_keep_discard.xml"); childSetAction("Keep",onKeepBtn,this); childSetAction("Discard",onDiscardBtn,this); } else { LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_notecard.xml"); childSetAction("Save",onClickSave,this); if( mAssetID.isNull() ) { const LLInventoryItem* item = getItem(); if( item ) { mAssetID = item->getAssetUUID(); } } } // only assert shape if not hosted in a multifloater if (!getHost()) { reshape(curRect.getWidth(), curRect.getHeight(), TRUE); setRect(curRect); } childSetVisible("lock", FALSE); const LLInventoryItem* item = getItem(); childSetCommitCallback("desc", LLPreview::onText, this); if (item) childSetText("desc", item->getDescription()); childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); setTitle(title); LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor"); if (editor) { editor->setWordWrap(TRUE); editor->setSourceID(item_id); editor->setHandleEditKeysDirectly(TRUE); } gAgent.changeCameraToDefault(); }
//--------------------------------------------------------------------------- LLNotifyBox::LLNotifyBox(LLNotificationPtr notification, BOOL layout_script_dialog) : LLPanel(notification->getName(), LLRect(), BORDER_NO), LLEventTimer(notification->getExpiration() == LLDate() ? LLDate(LLDate::now().secondsSinceEpoch() + (F64)gSavedSettings.getF32("NotifyTipDuration")) : notification->getExpiration()), LLInstanceTracker<LLNotifyBox, LLUUID>(notification->getID()), mNotification(notification), mIsTip(notification->getType() == "notifytip"), mAnimating(TRUE), mNextBtn(NULL), mNumOptions(0), mNumButtons(0), mAddedDefaultBtn(FALSE), mLayoutScriptDialog(layout_script_dialog), mUserInputBox(NULL) { std::string edit_text_name; std::string edit_text_contents; // class init { sFont = LLFontGL::getFontSansSerif(); sFontSmall = LLFontGL::getFontSansSerifSmall(); } // setup paramaters mMessage = notification->getMessage(); // initialize setFocusRoot(!mIsTip); // caution flag can be set explicitly by specifying it in the // notification payload, or it can be set implicitly if the // notify xml template specifies that it is a caution // // tip-style notification handle 'caution' differently - // they display the tip in a different color mIsCaution = notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; // Only animate first window if( gNotifyBoxView->getChildCount() > 0 ) mAnimating = FALSE; else mAnimating = TRUE; LLNotificationFormPtr form(notification->getForm()); mNumOptions = form->getNumElements(); bool is_textbox = form->getElement("message").isDefined(); LLRect rect = mIsTip ? getNotifyTipRect(mMessage) : getNotifyRect(is_textbox ? 10 : mNumOptions, layout_script_dialog, mIsCaution); setRect(rect); setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT)); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); LLIconCtrl* icon; LLTextEditor* text; const S32 TOP = getRect().getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32); const S32 BOTTOM = (S32)sFont->getLineHeight(); S32 x = HPAD + HPAD; S32 y = TOP; if (mIsTip) { // use the tip notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_tip_icon.tga")); } else if (mIsCaution) { // use the caution notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_caution_icon.tga")); } else { // use the default notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + 32; // add a caution textbox at the top of a caution notification LLTextBox* caution_box = NULL; if (mIsCaution && !mIsTip) { S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD; caution_box = new LLTextBox( std::string("caution_box"), LLRect(x, y, getRect().getWidth() - 2, caution_height), LLStringUtil::null, sFont, FALSE); caution_box->setFontStyle(LLFontGL::BOLD); caution_box->setColor(gColors.getColor("NotifyCautionWarnColor")); caution_box->setBackgroundColor(gColors.getColor("NotifyCautionBoxColor")); caution_box->setBorderVisible(FALSE); caution_box->setWrappedText(notification->getMessage()); addChild(caution_box); // adjust the vertical position of the next control so that // it appears below the caution textbox y = y - caution_height; } else { const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD); // Tokenization on \n is handled by LLTextBox const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title. text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, mMessage, sFont, FALSE); text->setWordWrap(TRUE); text->setTabStop(FALSE); text->setMouseOpaque(FALSE); text->setBorderVisible(FALSE); text->setTakesNonScrollClicks(FALSE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually // rendered under the text box, therefore we want // the actual text box to be transparent text->setReadOnlyFgColor ( gColors.getColor("NotifyTextColor") ); text->setEnabled(FALSE); // makes it read-only text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard) addChild(text); } if (mIsTip) { // TODO: Make a separate archive for these. LLChat chat(mMessage); chat.mSourceType = CHAT_SOURCE_SYSTEM; // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0e) | Added: RLVa-0.2.0b if (rlv_handler_t::isEnabled()) { // Notices should already have their contents filtered where necessary chat.mRlvLocFiltered = chat.mRlvNamesFiltered = TRUE; } // [/RLVa:KB] if (!gSavedSettings.getBOOL("HideNotificationsInChat")) { LLFloaterChat::getInstance(LLSD())->addChatHistory(chat); } } else { LLButton* btn; btn = new LLButton(std::string("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, onClickNext, this, sFont); btn->setScaleImage(TRUE); btn->setToolTip(std::string("Next")); // *TODO: Translate addChild(btn); mNextBtn = btn; for (S32 i = 0; i < mNumOptions; i++) { LLSD form_element = form->getElement(i); std::string element_type = form_element["type"].asString(); if (element_type == "button") { addButton(form_element["name"].asString(), form_element["text"].asString(), TRUE, form_element["default"].asBoolean()); } else if (element_type == "input") { edit_text_contents = form_element["value"].asString(); edit_text_name = form_element["name"].asString(); } } if (is_textbox) { S32 button_rows = (layout_script_dialog) ? 2 : 1; LLRect input_rect; input_rect.setOriginAndSize(x, BOTTOM_PAD + button_rows * (BTN_HEIGHT + VPAD), 3 * 80 + 4 * HPAD, button_rows * (BTN_HEIGHT + VPAD) + BTN_HEIGHT); mUserInputBox = new LLTextEditor(edit_text_name, input_rect, 254, edit_text_contents, sFont, FALSE); mUserInputBox->setBorderVisible(TRUE); mUserInputBox->setTakesNonScrollClicks(TRUE); mUserInputBox->setHideScrollbarForShortDocs(TRUE); mUserInputBox->setWordWrap(TRUE); mUserInputBox->setTabsToNextField(FALSE); mUserInputBox->setCommitOnFocusLost(FALSE); mUserInputBox->setAcceptCallingCardNames(FALSE); mUserInputBox->setHandleEditKeysDirectly(TRUE); addChild(mUserInputBox, -1); } else { setIsChrome(TRUE); } if (mNumButtons == 0) { addButton("OK", "OK", FALSE, TRUE); mAddedDefaultBtn = TRUE; } sNotifyBoxCount++; if (sNotifyBoxCount <= 0) { llwarns << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << llendl; } // If this is the only notify box, don't show the next button if (sNotifyBoxCount == 1 && mNextBtn) { mNextBtn->setVisible(FALSE); } } }
RectDrawing::RectDrawing(const QRect &r) { _fm = 0; _dp = 0; setRect(r); }
void LLHoverView::draw() { if ( !isHovering() ) { return; } // To toggle off hover tips, you have to just suppress the draw. // The picking is still needed to do cursor changes over physical // and scripted objects. JC // if (!sShowHoverTips) // [RLVa:KB] - Checked: 2010-01-02 (RLVa-1.1.0l) | Modified: RLVa-1.1.0l #ifdef RLV_EXTENSION_CMD_INTERACT if ( (!sShowHoverTips) || (gRlvHandler.hasBehaviour(RLV_BHVR_INTERACT)) ) #else if (!sShowHoverTips) #endif // RLV_EXTENSION_CMD_INTERACT // [/RLVa:KB] { return; } const F32 MAX_HOVER_DISPLAY_SECS = 5.f; if (mHoverTimer.getElapsedTimeF32() > MAX_HOVER_DISPLAY_SECS) { return; } const F32 MAX_ALPHA = 0.9f; //const F32 STEADY_ALPHA = 0.3f; F32 alpha; if (mHoverActive) { alpha = 1.f; if (isHoveringObject()) { // look at object LLViewerObject *hover_object = getLastHoverObject(); if (hover_object->isAvatar()) { gAgent.setLookAt(LOOKAT_TARGET_HOVER, getLastHoverObject(), LLVector3::zero); } else { gAgent.setLookAt(LOOKAT_TARGET_HOVER, getLastHoverObject(), mHoverOffset); } } } else { alpha = llmax(0.f, MAX_ALPHA - mHoverTimer.getElapsedTimeF32()*2.f); } // Bail out if no text to display if (mText.empty()) { return; } // Don't draw if no alpha if (alpha <= 0.f) { return; } LLUIImagePtr box_imagep = LLUI::getUIImage("rounded_square.tga"); LLUIImagePtr shadow_imagep = LLUI::getUIImage("rounded_square_soft.tga"); const LLFontGL* fontp = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF_SMALL); // Render text. LLColor4 text_color = gColors.getColor("ToolTipTextColor"); // LLColor4 border_color = gColors.getColor("ToolTipBorderColor"); LLColor4 bg_color = gColors.getColor("ToolTipBgColor"); LLColor4 shadow_color = gColors.getColor("ColorDropShadow"); // Could decrease the alpha here. JC //text_color.mV[VALPHA] = alpha; //border_color.mV[VALPHA] = alpha; //bg_color.mV[VALPHA] = alpha; S32 max_width = 0; S32 num_lines = mText.size(); for (text_list_t::iterator iter = mText.begin(); iter != mText.end(); ++iter) { max_width = llmax(max_width, (S32)fontp->getWidth(*iter)); } S32 left = mHoverPos.mX + 10; S32 top = mHoverPos.mY - 16; S32 right = mHoverPos.mX + max_width + 30; S32 bottom = mHoverPos.mY - 24 - llfloor(num_lines*fontp->getLineHeight()); // Push down if there's a one-click icon if (mHoverActive && isHoveringObject() && mLastHoverObject->getClickAction() != CLICK_ACTION_NONE) { const S32 CLICK_OFFSET = 10; top -= CLICK_OFFSET; bottom -= CLICK_OFFSET; } // Make sure the rect is completely visible LLRect old_rect = getRect(); setRect( LLRect(left, top, right, bottom ) ); translateIntoRect( gViewerWindow->getVirtualWindowRect(), FALSE ); left = getRect().mLeft; top = getRect().mTop; right = getRect().mRight; bottom = getRect().mBottom; setRect(old_rect); LLGLSUIDefault gls_ui; shadow_color.mV[VALPHA] = 0.7f * alpha; S32 shadow_offset = gSavedSettings.getS32("DropShadowTooltip"); shadow_imagep->draw(LLRect(left + shadow_offset, top - shadow_offset, right + shadow_offset, bottom - shadow_offset), shadow_color); bg_color.mV[VALPHA] = alpha; box_imagep->draw(LLRect(left, top, right, bottom), bg_color); S32 cur_offset = top - 4; for (text_list_t::iterator iter = mText.begin(); iter != mText.end(); ++iter) { fontp->renderUTF8(*iter, 0, left + 10, cur_offset, text_color, LLFontGL::LEFT, LLFontGL::TOP); cur_offset -= llfloor(fontp->getLineHeight()); } }
void QElipseItem::SetLeft(qreal nLeft) //set the rect left { QRectF nrect=rect(); //get the current rect position nrect.setLeft(nLeft); setRect(nrect); }
void VideoRecordDialog::makeGUI() { pane()->addCheckBox("Record GUI (Surface2D)", &m_captureGUI); pane()->addLabel(GuiText("Video", shared_ptr<GFont>(), 12)); GuiPane* moviePane = pane()->addPane("", GuiTheme::ORNATE_PANE_STYLE); GuiLabel* label = NULL; GuiDropDownList* formatList = moviePane->addDropDownList("Format", m_formatList, &m_templateIndex); const float width = 300.0f; // Increase caption size to line up with the motion blur box const float captionSize = 90.0f; formatList->setWidth(width); formatList->setCaptionWidth(captionSize); moviePane->addNumberBox("Quality", &m_quality, "", GuiTheme::LOG_SLIDER, 0.1f, 25.0f); if (false) { // For future expansion GuiCheckBox* motionCheck = moviePane->addCheckBox("Motion Blur", &m_enableMotionBlur); m_framesBox = moviePane->addNumberBox("", &m_motionBlurFrames, "frames", GuiTheme::LINEAR_SLIDER, 2, 20); m_framesBox->setUnitsSize(46); m_framesBox->moveRightOf(motionCheck); m_framesBox->setWidth(210); } GuiNumberBox<float>* recordBox = moviePane->addNumberBox("Record as if", &m_recordFPS, "fps", GuiTheme::NO_SLIDER, 1.0f, 120.0f, 0.1f); recordBox->setCaptionWidth(captionSize); GuiNumberBox<float>* playbackBox = moviePane->addNumberBox("Playback at", &m_playbackFPS, "fps", GuiTheme::NO_SLIDER, 1.0f, 120.0f, 0.1f); playbackBox->setCaptionWidth(captionSize); const OSWindow* window = OSWindow::current(); int w = window->width() / 2; int h = window->height() / 2; moviePane->addCheckBox(format("Half-size (%d x %d)", w, h), &m_halfSize); if (false) { // For future expansion moviePane->addCheckBox("Show cursor", &m_showCursor); } label = moviePane->addLabel("Hot key:"); label->setWidth(captionSize); moviePane->addLabel(m_hotKeyString)->moveRightOf(label); // Add record on the same line as previous hotkey box m_recordButton = moviePane->addButton("Record Now (" + m_hotKeyString + ")"); m_recordButton->moveBy(moviePane->rect().width() - m_recordButton->rect().width() - 5, -27); moviePane->pack(); moviePane->setWidth(pane()->rect().width()); /////////////////////////////////////////////////////////////////////////////////// pane()->addLabel(GuiText("Screenshot", shared_ptr<GFont>(), 12)); GuiPane* ssPane = pane()->addPane("", GuiTheme::ORNATE_PANE_STYLE); m_ssFormatList.append("JPG", "PNG", "BMP", "TGA"); GuiDropDownList* ssFormatList = ssPane->addDropDownList("Format", m_ssFormatList, &m_ssFormatIndex); m_ssFormatIndex = 0; ssFormatList->setWidth(width); ssFormatList->setCaptionWidth(captionSize); label = ssPane->addLabel("Hot key:"); label->setWidth(captionSize); ssPane->addLabel(m_ssHotKeyString)->moveRightOf(label); ssPane->pack(); ssPane->setWidth(pane()->rect().width()); /////////////////////////////////////////////////////////////////////////////////// pack(); setRect(Rect2D::xywh(rect().x0(), rect().y0(), rect().width() + 5, rect().height() + 2)); }
Rect::Rect(const Vec2& pos, const Size& dimension) { setRect(pos.x, pos.y, dimension.width, dimension.height); }
RMRect::RMRect(const RMPoint &p1, const RMPoint &p2): _topLeft(_x1, _y1), _bottomRight(_x2, _y2) { setRect(p1, p2); }
void Rect::drawing(QGraphicsSceneMouseEvent * event) { QRectF r(rect().topLeft(), QSizeF(event->scenePos().x() - rect().topLeft().x(), event->scenePos().y() - rect().topLeft().y())); setRect(r); }
RMRect::RMRect(int X1, int Y1, int X2, int Y2): _topLeft(_x1, _y1), _bottomRight(_x2, _y2) { setRect(X1, Y1, X2, Y2); }
Rect::Rect(void) { setRect(0.0f, 0.0f, 0.0f, 0.0f); }
void RMRect::normalizeRect() { setRect(MIN(_x1, _x2), MIN(_y1, _y2), MAX(_x1, _x2), MAX(_y1, _y2)); }
Rect::Rect(const Rect& other) { setRect(other.origin.x, other.origin.y, other.size.width, other.size.height); }
void FormResizableProxy::handleMoved( const QPointF & delta, FormMoveHandle * handle ) { if( !d->m_handleMoved ) { d->m_subsidiaryRect = d->m_rect; d->m_handleMoved = true; } if( handle == d->m_handles->m_move.data() ) { d->m_rect.moveTop( d->m_rect.top() + delta.y() ); d->m_rect.moveRight( d->m_rect.right() + delta.x() ); setRect( d->m_rect ); d->m_object->moveResizable( delta ); } else if( handle == d->m_handles->m_topLeft.data() ) { const QRectF r = d->m_rect.adjusted( delta.x(), delta.y(), 0.0, 0.0 ); if( d->m_handles->checkConstraint( r.size() ) ) setRect( r ); } else if( handle == d->m_handles->m_top.data() ) { const QRectF r = d->m_rect.adjusted( 0.0, delta.y(), 0.0, 0.0 ); if( d->m_handles->checkConstraint( r.size() ) ) setRect( r ); } else if( handle == d->m_handles->m_topRight.data() ) { const QRectF r = d->m_rect.adjusted( 0.0, delta.y(), delta.x(), 0.0 ); if( d->m_handles->checkConstraint( r.size() ) ) setRect( r ); } else if( handle == d->m_handles->m_right.data() ) { const QRectF r = d->m_rect.adjusted( 0.0, 0.0, delta.x(), 0.0 ); if( d->m_handles->checkConstraint( r.size() ) ) setRect( r ); } else if( handle == d->m_handles->m_bottomRight.data() ) { const QRectF r = d->m_rect.adjusted( 0.0, 0.0, delta.x(), delta.y() ); if( d->m_handles->checkConstraint( r.size() ) ) setRect( r ); } else if( handle == d->m_handles->m_bottom.data() ) { const QRectF r = d->m_rect.adjusted( 0.0, 0.0, 0.0, delta.y() ); if( d->m_handles->checkConstraint( r.size() ) ) setRect( r ); } else if( handle == d->m_handles->m_bottomLeft.data() ) { const QRectF r = d->m_rect.adjusted( delta.x(), 0.0, 0.0, delta.y() ); if( d->m_handles->checkConstraint( r.size() ) ) setRect( r ); } else if( handle == d->m_handles->m_left.data() ) { const QRectF r = d->m_rect.adjusted( delta.x(), 0.0, 0.0, 0.0 ); if( d->m_handles->checkConstraint( r.size() ) ) setRect( r ); } }
void Label::setLabel(const sf::Text &string) { m_text = string; setRect(getVirtualRect()); m_text.setOrigin(sf::Vector2f(0, 0)); }
void Pipe::checkMessage(unsigned int width, unsigned int height) { if (!width || ! height) return; if (hSocket == INVALID_HANDLE_VALUE) { hSocket = CreateFileW(L"\\\\.\\pipe\\MumbleOverlayPipe", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (hSocket == INVALID_HANDLE_VALUE) { ods("Pipe: Connection failed"); return; } ods("Pipe: Connected"); uiWidth = 0; uiHeight = 0; // initially, instantiate and send an OverlayMessage with the current process id OverlayMsg om; om.omh.uiMagic = OVERLAY_MAGIC_NUMBER; om.omh.uiType = OVERLAY_MSGTYPE_PID; om.omh.iLength = sizeof(OverlayMsgPid); om.omp.pid = GetCurrentProcessId(); if (!sendMessage(om)) return; ods("Pipe: Process ID sent"); } // if the passed width and height do not match the current overlays uiWidth and uiHeight, re-initialize if ((uiWidth != width) || (uiHeight != height)) { release(); uiWidth = width; uiHeight = height; // instantiate and send an initialization-OverlayMessage OverlayMsg om; om.omh.uiMagic = OVERLAY_MAGIC_NUMBER; om.omh.uiType = OVERLAY_MSGTYPE_INIT; om.omh.iLength = sizeof(OverlayMsgInit); om.omi.uiWidth = uiWidth; om.omi.uiHeight = uiHeight; if (!sendMessage(om)) return; ods("Pipe: SentInitMsg with w h %d %d", uiWidth, uiHeight); } std::vector<RECT> blits; while (1) { DWORD dwBytesLeft; DWORD dwBytesRead; if (! PeekNamedPipe(hSocket, NULL, 0, NULL, &dwBytesLeft, NULL)) { ods("Pipe: Could not peek"); disconnect(); return; } if (! dwBytesLeft) break; if (omMsg.omh.iLength == -1) { if (! ReadFile(hSocket, reinterpret_cast<unsigned char *>(omMsg.headerbuffer) + dwAlreadyRead, sizeof(OverlayMsgHeader) - dwAlreadyRead, &dwBytesRead, NULL)) { ods("Pipe: Read header fail"); disconnect(); return; } dwBytesLeft -= dwBytesRead; dwAlreadyRead += dwBytesRead; if (dwAlreadyRead != sizeof(OverlayMsgHeader)) { break; } dwAlreadyRead = 0; if (omMsg.omh.uiMagic != OVERLAY_MAGIC_NUMBER) { ods("Pipe: Invalid magic number %x", omMsg.omh.uiMagic); disconnect(); return; } if (static_cast<int>(dwBytesLeft) < omMsg.omh.iLength) continue; } if (! ReadFile(hSocket, reinterpret_cast<unsigned char *>(omMsg.msgbuffer) + dwAlreadyRead, omMsg.omh.iLength - dwAlreadyRead, &dwBytesRead, NULL)) { ods("Pipe: Read data fail"); disconnect(); return; } dwAlreadyRead += dwBytesRead; if (static_cast<int>(dwBytesLeft) < omMsg.omh.iLength) continue; dwAlreadyRead = 0; switch (omMsg.omh.uiType) { case OVERLAY_MSGTYPE_SHMEM: { wchar_t memname[2048]; memname[0] = 0; MultiByteToWideChar(CP_UTF8, 0, omMsg.oms.a_cName, omMsg.omh.iLength, memname, 2048); release(); hMemory = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, uiWidth * uiHeight * 4, memname); if (GetLastError() != ERROR_ALREADY_EXISTS) { ods("Pipe: Memory %s(%d) => %ls doesn't exist", omMsg.oms.a_cName, omMsg.omh.iLength, memname); if (hMemory) { CloseHandle(hMemory); hMemory = NULL; break; } } if (! hMemory) { ods("Pipe: CreateFileMapping failed"); break; } a_ucTexture = reinterpret_cast<unsigned char *>(MapViewOfFile(hMemory, FILE_MAP_ALL_ACCESS, 0, 0, 0)); if (a_ucTexture == NULL) { ods("Pipe: Failed to map memory"); CloseHandle(hMemory); hMemory = NULL; break; } MEMORY_BASIC_INFORMATION mbi; memset(&mbi, 0, sizeof(mbi)); if ((VirtualQuery(a_ucTexture, &mbi, sizeof(mbi)) == 0) || (mbi.RegionSize < (uiHeight * uiWidth * 4))) { ods("Pipe: Memory too small"); UnmapViewOfFile(a_ucTexture); CloseHandle(hMemory); a_ucTexture = NULL; hMemory = NULL; break; } OverlayMsg om; om.omh.uiMagic = OVERLAY_MAGIC_NUMBER; om.omh.uiType = OVERLAY_MSGTYPE_SHMEM; om.omh.iLength = 0; if (!sendMessage(om)) return; newTexture(uiWidth, uiHeight); } break; case OVERLAY_MSGTYPE_BLIT: { RECT r = { static_cast<LONG>(omMsg.omb.x), static_cast<LONG>(omMsg.omb.y), static_cast<LONG>(omMsg.omb.x + omMsg.omb.w), static_cast<LONG>(omMsg.omb.y + omMsg.omb.h) }; std::vector<RECT>::iterator i = blits.begin(); while (i != blits.end()) { RECT is; if (::IntersectRect(&is, &r, & *i)) { ::UnionRect(&is, &r, & *i); r = is; blits.erase(i); i = blits.begin(); } else { ++i; } } blits.push_back(r); } break; case OVERLAY_MSGTYPE_ACTIVE: { uiLeft = omMsg.oma.x; uiTop = omMsg.oma.y; uiRight = omMsg.oma.x + omMsg.oma.w; uiBottom = omMsg.oma.y + omMsg.oma.h; if (a_ucTexture) { setRect(); blit(0, 0, uiWidth, uiHeight); } } break; default: break; } omMsg.omh.iLength = -1; } if (!a_ucTexture) return; for (std::vector<RECT>::iterator i = blits.begin(); i != blits.end(); ++i) blit((*i).left, (*i).top, (*i).right - (*i).left, (*i).bottom - (*i).top); }
void Label::rotate(float angle) { m_text.rotate(angle); setRect(m_text.getGlobalBounds()); }
void CornerHandler::doSetRect(const QRectF &newRect) { setFlag(QGraphicsItem::ItemIgnoresTransformations,false); setRect(mapFromParent(newRect).boundingRect()); }