void rspfAnnotationMultiEllipseObject::draw(rspfRgbImage& anImage)const { anImage.setDrawColor(theRed, theGreen, theBlue); anImage.setThickness(theThickness); rspfDrect imageRect = anImage.getImageData()->getImageRectangle(); if(theBoundingRect.intersects(imageRect)) { int i; int upper = (int)thePointList.size(); if(theFillFlag) { for(i = 0; i < upper; ++i) { rspfDpt tempPoint = thePointList[i]; rspfDrect tempRect(rspfDpt(tempPoint.x - theWidthHeight.x, tempPoint.y - theWidthHeight.y), rspfDpt(tempPoint.x + theWidthHeight.x, tempPoint.y + theWidthHeight.y)); if(tempRect.intersects(imageRect)) { anImage.drawFilledArc(rspf::round<int>(tempPoint.x), rspf::round<int>(tempPoint.y), rspf::round<int>(theWidthHeight.x), rspf::round<int>(theWidthHeight.y), 0, 360); } } } else { for(i = 0; i < upper; ++i) { rspfDpt tempPoint = thePointList[i]; rspfDrect tempRect(rspfDpt(tempPoint.x - theWidthHeight.x, tempPoint.y - theWidthHeight.y), rspfDpt(tempPoint.x + theWidthHeight.x, tempPoint.y + theWidthHeight.y)); if(tempRect.intersects(imageRect)) { anImage.drawArc(rspf::round<int>(tempPoint.x), rspf::round<int>(tempPoint.y), rspf::round<int>(theWidthHeight.x), rspf::round<int>(theWidthHeight.y), 0, 360); } } } } }
void GfxDialog::draw() { Rect tempRect(_bounds); // Make a backup copy of the area the dialog will occupy _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds); // Set the palette for use in the dialog setPalette(); _gfxManager.activate(); // Fill in the contents of the entire dialog _gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); drawFrame(); // Reset the dialog's graphics manager to only draw within the dialog boundaries tempRect.translate(_globals->_gfxEdgeAdjust * 2, _globals->_gfxEdgeAdjust * 2); _gfxManager._bounds = tempRect; // Draw each element in the dialog in order GfxElementList::iterator i; for (i = _elements.begin(); i != _elements.end(); ++i) { (*i)->draw(); } // If there's a default button, then draw it if (_defaultButton) { _defaultButton->_flags |= GFXFLAG_THICK_FRAME; _defaultButton->draw(); } _gfxManager.deactivate(); }
void rspfAnnotationMultiEllipseObject::computeBoundingRect() { theBoundingRect.makeNan(); int i; int upper = (int)thePointList.size(); for(i = 0; i < upper; ++i) { rspfDpt tempPoint = thePointList[i]; if(!tempPoint.hasNans()) { rspfDrect tempRect(rspfDpt(tempPoint.x - theWidthHeight.x, tempPoint.y - theWidthHeight.y), rspfDpt(tempPoint.x + theWidthHeight.x, tempPoint.y + theWidthHeight.y)); if(!theBoundingRect.hasNans()) { theBoundingRect.combine(tempRect); } else { theBoundingRect = tempRect; } } } }
ofRectangle CheckBox::getLabelBoundingBox(void) { ofRectangle tempRect(_labelLocation.x, _labelLocation.y, 0, 0); if (_label != "") { tempRect = getStringBoundingBox(_label, _labelLocation.x, _labelLocation.y); } return tempRect; }
EXPORT_C void CEikScrollBarFrame::Tile(TEikScrollBarModel* aVModel, TRect& aVScrollBarRect) { Tile(aVModel); TRect tempRect(aVScrollBarRect); if(aVScrollBarRect.Height() < 0 ) { aVScrollBarRect.iTl.iY = aVScrollBarRect.iBr.iY; aVScrollBarRect.iBr.iY = tempRect.iTl.iY; } if(aVScrollBarRect.Width() < 0 ) { aVScrollBarRect.iTl.iX = aVScrollBarRect.iBr.iX; aVScrollBarRect.iBr.iX = tempRect.iTl.iX; } if (iV.iBar && TypeOfVScrollBar() == EDoubleSpan && iV.iExternalScrollBarAttached==EFalse ) { CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*> (iV.iBar); // check if fixed layout has been set if (scrollbar->FixedLayoutRect().Size() == TSize(0,0)) { if (aVScrollBarRect != TRect(iV.iBar->Position(), iV.iBar->Size())) { iV.iBar->SetRect(aVScrollBarRect); } } } }
void GfxButton::draw() { // Get a lock on the surface and save the active font GfxFontBackup font; GfxManager &gfxManager = _globals->gfxManager(); gfxManager.lockSurface(); // Draw a basic frame for the button drawFrame(); // Set the font and color gfxManager._font.setFontNumber(_fontNumber); // gfxManager._font._colors.foreground = this->_color1; gfxManager._font._colors2.background = this->_color2; gfxManager._font._colors2.foreground = this->_color3; // Display the button's text Rect tempRect(_bounds); tempRect.collapse(_globals->_gfxEdgeAdjust, _globals->_gfxEdgeAdjust); if (_vm->getFeatures() & GF_CD) ++tempRect.top; gfxManager._font.writeLines(_message.c_str(), tempRect, ALIGN_CENTER); gfxManager.unlockSurface(); }
void UICollection::erase() { if (_clearScreen) { Rect tempRect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT); GLOBALS._screen.fillRect(tempRect, 0); GLOBALS._sceneManager._scene->_backSurface.fillRect(tempRect, 0); _clearScreen = false; } }
/*************************************************** OnLClicked - overloaded CUGCellType::OnLClicked The handling of the OnLClicked event in the check box cell type is the most important for this cell type. Here is where the desired user actions are evaluated and if necessary the check state is updated. This function determines if the user clicked the left mouse button over the check area on the cell if he did, than the state of the check is changed. **See CUGCellType::OnLClicked for more details about this function Params: col - column that was clicked in row - row that was clicked in rect - rectangle of the cell that was clicked in point - point where the mouse was clicked Return: TRUE - if the event was processed FALSE - if the event was not ***************************************************/ BOOL CUGCheckBoxType::OnLClicked(int col,long row,int updn,RECT *rect,POINT *point) { int top, checkSize; CRect tempRect(0,0,0,0); m_ctrl->GetCellIndirect( col, row, &m_cell ); int style = 0; bool isDisabled = false; if( m_cell.IsPropertySet( UGCELL_CELLTYPEEX_SET )) { style = m_cell.GetCellTypeEx(); isDisabled = (style & UGCT_CHECKBOXDISABLED) > 0; } // If the cell is read only, user should not be // allowed to change the state of the check. if ( m_cell.GetReadOnly() || isDisabled) { return FALSE; } if( updn ) { // calculate height of the cell, based on // given rect parameter. checkSize = rect->bottom - rect->top - (UGCT_CHECKSIZE / 2); // the check box will never be smaller than // UGCT_CHECKSIZE if( checkSize > UGCT_CHECKSIZE ) checkSize = UGCT_CHECKSIZE; top = (rect->bottom - rect->top - checkSize) / 2; tempRect = *rect; AdjustRect ( &tempRect, m_cell.GetAlignment(), m_cell.GetCellTypeEx(), top, checkSize ); // determine if the user clicked within the check box area if(!tempRect.PtInRect ( *point )) return FALSE; int style = 0; if(m_cell.IsPropertySet(UGCELL_CELLTYPEEX_SET)) style = m_cell.GetCellTypeEx(); int val; val = (int)m_cell.GetNumber(); m_cell.SetNumber((val + 1) % ((style & UGCT_CHECKBOX3STATE) ? 3 : 2)); // set the new check state to the data source m_ctrl->SetCell(col,row,&m_cell); // notify the CUGCtrl derived class that the check state was changed OnCellTypeNotify(m_ID,col,row,UGCT_CHECKBOXSET,(long)m_cell.GetNumber()); // redraw the cell to reflect the changes. m_ctrl->RedrawCell(col,row); return TRUE; } return FALSE; }
void CGameManager::playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *newRoom) { if (oldRoom != newRoom || newRoom != _movieRoom || !_movie) roomTransition(oldRoom, newRoom); if (clip && clip->_startFrame != clip->_endFrame && _movie) { // Clip details specifying a sub-section of movie to play Rect tempRect(20, 10, SCREEN_WIDTH - 20, 350); lockInputHandler(); CScreenManager::_screenManagerPtr->_mouseCursor->hide(); _movie->playCutscene(tempRect, clip->_startFrame, clip->_endFrame); CScreenManager::_screenManagerPtr->_mouseCursor->show(); unlockInputHandler(); } }
bool CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetGlyph::setup(petControl, owner); Rect tempRect(0, 0, 280, 16); tempRect.moveTo(322, 407); _text.setBounds(tempRect); _text.resize(3); _text.setHasBorder(false); _text.setup(); Rect btnRect(0, 0, 68, 52); btnRect.moveTo(496, 388); _btnYes.setBounds(btnRect); return true; }
bool RightClickDialog::process(Event &event) { switch (event.eventType) { case EVENT_MOUSE_MOVE: { // Check whether a button is highlighted int buttonIndex; for (buttonIndex = 5; buttonIndex >= 0; --buttonIndex) { Rect tempRect(0, 0, 28, 29); tempRect.moveTo(_btnList[buttonIndex].x, _btnList[buttonIndex].y); if (tempRect.contains(event.mousePos)) break; } // If selection has changed, handle it if (buttonIndex != _highlightedAction) { if (_highlightedAction != -1) { // Another button was previously selected, so restore dialog _gfxManager.copyFrom(_surface, 0, 0); } if (buttonIndex != -1) { // Draw newly selected button GfxSurface btn = _btnImages.getFrame(buttonIndex + 1); _gfxManager.copyFrom(btn, _btnList[buttonIndex].x, _btnList[buttonIndex].y); } _highlightedAction = buttonIndex; } event.handled = true; return true; } case EVENT_BUTTON_DOWN: // Specify the selected action _selectedAction = (_highlightedAction == -1) ? 999 : _highlightedAction; event.handled = true; return true; default: break; } return false; }
/** * Highlights the specified graphics element */ void GfxElement::highlight() { // Get a lock on the surface GfxManager &gfxManager = _globals->gfxManager(); Graphics::Surface surface = gfxManager.lockSurface(); // Scan through the contents of the element, switching any occurances of the foreground // color with the background color and vice versa Rect tempRect(_bounds); tempRect.collapse(_globals->_gfxEdgeAdjust - 1, _globals->_gfxEdgeAdjust - 1); for (int yp = tempRect.top; yp < tempRect.bottom; ++yp) { byte *lineP = (byte *)surface.getBasePtr(tempRect.left, yp); for (int xp = tempRect.left; xp < tempRect.right; ++xp, ++lineP) { if (*lineP == _colors.background) *lineP = _colors.foreground; else if (*lineP == _colors.foreground) *lineP = _colors.background; } } // Release the surface gfxManager.unlockSurface(); }
bool CPetInventory::setPetControl(CPetControl *petControl) { if (!petControl) return false; _petControl = petControl; _items.setup(7, this); _items.setFlags(28); Rect tempRect(0, 0, 52, 52); for (uint idx = 0; idx < TOTAL_ITEMS; ++idx) { if (!g_vm->_itemNames[idx].empty()) { CString name = "3Pet" + g_vm->_itemNames[idx]; _itemBackgrounds[idx] = petControl->getHiddenObject(name); } } tempRect = Rect(0, 0, 580, 15); tempRect.translate(32, 445); _text.setBounds(tempRect); _text.setHasBorder(false); return true; }
void GfxManager::fillArea(int xp, int yp, int color) { _surface.setBounds(_bounds); Rect tempRect(xp, yp, xp + _font._edgeSize.x, yp + _font._edgeSize.y); _surface.fillRect(tempRect, color); }
void CommandTimerView::AttachedToWindow() { BRect tempRect(25, 15, 265, 25); commandTextControl = new BTextControl(tempRect, "commandTextControl", "Command:", NULL, new BMessage('CMND'), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); commandTextControl->SetDivider(60); commandTextControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); AddChild(commandTextControl); tempRect.Set(25, 45, 265, 55); pathTextControl = new BTextControl(tempRect, "pathTextControl", "Use Path:", NULL, new BMessage('CMND'), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); pathTextControl->SetDivider(60); pathTextControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); pathTextControl->SetText("/boot/home"); pathTextControl->SetEnabled(false); AddChild(pathTextControl); tempRect.Set(60, 78, 82, 90); hoursTextControl = new BTextControl(tempRect, "hoursTextControl", NULL, "00", NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); AddChild(hoursTextControl); tempRect.Set(85, 78, 107, 90); minsTextControl = new BTextControl(tempRect, "minsTextControl", NULL, "00", NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); AddChild(minsTextControl); tempRect.Set(110, 78, 132, 90); secsTextControl = new BTextControl(tempRect, "minsTextControl", NULL, "00", NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); AddChild(secsTextControl); tempRect.Set(175, 75, 225, 85); startStopButton = new BButton(tempRect, "startStopButton", "Start", new BMessage('CLOK')); AddChild(startStopButton); tempRect.Set(30, 105, 100, 115); repeatCheckBox = new BCheckBox(tempRect, "repeatCheckBox", "Repeat", new BMessage('REPT'), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); AddChild(repeatCheckBox); tempRect.Set(120, 105, 190, 115); alarmCheckBox = new BCheckBox(tempRect, "alarmCheckBox", "Alarm", new BMessage('BEEP'), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); AddChild(alarmCheckBox); tempRect.Set(200, 105, 290, 115); trackerCheckBox = new BCheckBox(tempRect, "trackerCheckBox", "Use Tracker", new BMessage('TRAK'), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); AddChild(trackerCheckBox); tempRect.Set(270, 45, 300, 55); pathCheckBox = new BCheckBox(tempRect, "pathCheckBox", NULL, new BMessage('PATH'), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); AddChild(pathCheckBox); isRunning = false; alarm = false; repeat = false; tracker = false; path = false; runner = new BMessageRunner(BMessenger(this), new BMessage('PULS'), 1000000); }
/** * Called to layout our our children. Does no frame construction */ NS_IMETHODIMP nsListBoxLayout::LayoutInternal(nsIBox* aBox, nsBoxLayoutState& aState) { PRInt32 redrawStart = -1; // Get the start y position. nsListBoxBodyFrame* body = static_cast<nsListBoxBodyFrame*>(aBox); if (!body) { NS_ERROR("Frame encountered that isn't a listboxbody!"); return NS_ERROR_FAILURE; } nsMargin margin; // Get our client rect. nsRect clientRect; aBox->GetClientRect(clientRect); // Get the starting y position and the remaining available // height. nscoord availableHeight = body->GetAvailableHeight(); nscoord yOffset = body->GetYPosition(); if (availableHeight <= 0) { bool fixed = (body->GetFixedRowSize() != -1); if (fixed) availableHeight = 10; else return NS_OK; } // run through all our currently created children nsIBox* box = body->GetChildBox(); // if the reason is resize or initial we must relayout. nscoord rowHeight = body->GetRowHeightAppUnits(); while (box) { // If this box is dirty or if it has dirty children, we // call layout on it. nsRect childRect(box->GetRect()); box->GetMargin(margin); // relayout if we must or we are dirty or some of our children are dirty // or the client area is wider than us // XXXldb There should probably be a resize check here too! if (NS_SUBTREE_DIRTY(box) || childRect.width < clientRect.width) { childRect.x = 0; childRect.y = yOffset; childRect.width = clientRect.width; nsSize size = box->GetPrefSize(aState); body->SetRowHeight(size.height); childRect.height = rowHeight; childRect.Deflate(margin); box->SetBounds(aState, childRect); box->Layout(aState); } else { // if the child did not need to be relayed out. Then its easy. // Place the child by just grabbing its rect and adjusting the y. PRInt32 newPos = yOffset+margin.top; // are we pushing down or pulling up any rows? // Then we may have to redraw everything below the moved // rows. if (redrawStart == -1 && childRect.y != newPos) redrawStart = newPos; childRect.y = newPos; box->SetBounds(aState, childRect); } // Ok now the available size gets smaller and we move the // starting position of the next child down some. nscoord size = childRect.height + margin.top + margin.bottom; yOffset += size; availableHeight -= size; box = box->GetNextBox(); } // We have enough available height left to add some more rows // Since we can't do this during layout, we post a callback // that will be processed after the reflow completes. body->PostReflowCallback(); // if rows were pushed down or pulled up because some rows were added // before them then redraw everything under the inserted rows. The inserted // rows will automatically be redrawn because the were marked dirty on insertion. if (redrawStart > -1) { nsRect bounds(aBox->GetRect()); nsRect tempRect(0,redrawStart,bounds.width, bounds.height - redrawStart); aBox->Redraw(aState, &tempRect); } return NS_OK; }
void GrapplingHook::Logic() { mSprite.SetPosition(mPosition); Player* tempActor = static_cast<Player*>(mCurrentLevel->getPlayer()); if (mHasFired) { mHookLineShape.SetPosition(tempActor->getPosition()); if (!mHasCollided) { if (abs(mRopeLength) < mRopeLimit) { // increase rope length if it hasn't hit anything if (tempActor->getIsColliding()) tempActor->setVelocity(0, tempActor->getVelocity().y); if (mIsFacingLeft) { mHookLineShape.SetSize(sf::Vector2f(mRopeLength-=mHookSpeed, 1.f)); mHookSprite.SetPosition(mHookLineShape.GetPosition().x-mHookLineShape.GetLocalBounds().Width-mHookClip.Width, mHookLineShape.GetPosition().y); //mHookSprite.Scale(-1.f, 1.f); } else { mHookLineShape.SetSize(sf::Vector2f(mRopeLength+=mHookSpeed, 1.f)); mHookSprite.SetPosition(mHookLineShape.GetPosition().x+mHookLineShape.GetLocalBounds().Width, mHookLineShape.GetPosition().y); //mHookSprite.Scale(1.f, 1.f); } } else { // If the rope length is maxed and hasn't hit anything, reset the grappling hook Reset(); } sf::FloatRect tempRect(mHookSprite.GetPosition().x, mHookSprite.GetPosition().y, mHookClip.Width, mHookClip.Height); // Check for collision against colliders for (auto it = mCurrentLevel->getColliders().begin(); it != mCurrentLevel->getColliders().end(); ++it) { if (mCurrentLevel->checkCollision(tempRect, it->second->getPosition())) { mHasCollided = true; mCurrentCollider = it; } } } else { // If the hook has collided with something sf::FloatRect tempPlayerRect(tempActor->getPosition().x, tempActor->getPosition().y, tempActor->getClip().Width, tempActor->getClip().Height); sf::FloatRect tempRect(mHookSprite.GetPosition().x, mHookSprite.GetPosition().y, mHookClip.Width, mHookClip.Height); if (abs(mRopeLength) > 0 && !tempRect.Intersects(tempPlayerRect)) { // we'll determine direction of the hookshot and move the player closer to the hook if (mIsFacingLeft) { if (!tempActor->getIsColliding()) tempActor->setPosition(tempActor->getPosition().x-tempActor->getVelocity().x, tempRect.Top); else tempActor->setPosition(tempPlayerRect.Left-mHookSpeed, tempRect.Top); mHookLineShape.SetSize(sf::Vector2f(mRopeLength+=mHookSpeed, 1.f)); } else { if (!tempActor->getIsColliding()) tempActor->setPosition(tempActor->getPosition().x+tempActor->getVelocity().x, tempRect.Top); else tempActor->setPosition(tempPlayerRect.Left+mHookSpeed, tempRect.Top); mHookLineShape.SetSize(sf::Vector2f(mRopeLength-=mHookSpeed, 1.f)); } } else { Reset(); } } } }
EXPORT_C TBool CEikScrollBarFrame::TileL(TEikScrollBarModel* aHModel, TEikScrollBarModel* aVModel, TRect& aClientRect, TRect& aInclusiveRect, const TEikScrollBarFrameLayout& aLayout) { TRect tempRect(aClientRect); if(aClientRect.Height() < 0 ) { aClientRect.iTl.iY = aClientRect.iBr.iY; aClientRect.iBr.iY = tempRect.iTl.iY; } if(aClientRect.Width() < 0 ) { aClientRect.iTl.iX = aClientRect.iBr.iX; aClientRect.iBr.iX = tempRect.iTl.iX; } tempRect = aInclusiveRect; if(aInclusiveRect.Height() < 0 ) { aInclusiveRect.iTl.iY = aInclusiveRect.iBr.iY; aInclusiveRect.iBr.iY = tempRect.iTl.iY; } if(aInclusiveRect.Width() < 0 ) { aInclusiveRect.iTl.iX = aInclusiveRect.iBr.iX; aInclusiveRect.iBr.iX = tempRect.iTl.iX; } if (iExtension && iExtension->iH.iVisibility!=EOff) { if(aClientRect.Height() < ScrollBarBreadth( CEikScrollBar::EHorizontal) ) { aClientRect.SetHeight( ScrollBarBreadth(CEikScrollBar::EHorizontal) ); } if(aInclusiveRect.Height() < ScrollBarBreadth( CEikScrollBar::EHorizontal) ) { aInclusiveRect.SetHeight( ScrollBarBreadth(CEikScrollBar::EHorizontal) ); } } TBool sizeChanged = EFalse; GetScrollBars(EFalse); CalcTheoreticalScrollBarVisibility(aVModel,aHModel); if (iV.iVisibility!=EOff) iV.iModel = *aVModel; MakeSBarVisible(iV, iScrollBarFrameFlags&EDisplayVScrollBar); if (iExtension && iExtension->iH.iBar) { if (iExtension->iH.iVisibility!=EOff) iExtension->iH.iModel = *aHModel; MakeSBarVisible(iExtension->iH, iScrollBarFrameFlags&EDisplayHScrollBar); } // Vertical Double span scollbar if (iV.iBar && TypeOfVScrollBar() == EDoubleSpan && iV.iExternalScrollBarAttached==EFalse ) { TInt scrollBarWidth = ScrollBarBreadth(CEikScrollBar::EVertical); // is 0 if SB not visible ! TInt horizontalScrollBarWidth = 0; if (iExtension && iExtension->iH.iVisibility!=EOff) { horizontalScrollBarWidth = ScrollBarBreadth(CEikScrollBar::EHorizontal); } CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*> (iV.iBar); if (scrollbar->FixedLayoutRect().Size() == TSize(0,0)) { TMargins checkedClientMargin(aLayout.iClientMargin); TMargins checkedInclusiveMargin(aLayout.iInclusiveMargin); checkedClientMargin.iTop = Max(0,checkedClientMargin.iTop); checkedClientMargin.iBottom = Max(0,checkedClientMargin.iBottom); checkedClientMargin.iRight = Max(0,checkedClientMargin.iRight); checkedClientMargin.iLeft = Max(0,checkedClientMargin.iLeft); checkedInclusiveMargin.iTop = Max(0,checkedInclusiveMargin.iTop); checkedInclusiveMargin.iBottom = Max(0,checkedInclusiveMargin.iBottom); checkedInclusiveMargin.iRight = Max(0,checkedInclusiveMargin.iRight); checkedInclusiveMargin.iLeft = Max(0,checkedInclusiveMargin.iLeft); TInt width = 0; TInt xPos = 0; TInt yPos = 0; TInt height = 0; if (!AknLayoutUtils::LayoutMirrored()) { if (aLayout.iTilingMode == TEikScrollBarFrameLayout::EInclusiveRectConstant) { width = scrollBarWidth + checkedInclusiveMargin.iRight; xPos = aInclusiveRect.iBr.iX - width; yPos = aInclusiveRect.iTl.iY + checkedInclusiveMargin.iTop; height = aInclusiveRect.Size().iHeight - (checkedInclusiveMargin.iTop + checkedInclusiveMargin.iBottom) - horizontalScrollBarWidth; if ((aClientRect.iBr.iX + width > aInclusiveRect.iBr.iX) || (aInclusiveRect.iBr.iX - width > aClientRect.iBr.iX)) { aClientRect.iBr.iX = aInclusiveRect.iBr.iX - width; sizeChanged = ETrue; } } else { width = scrollBarWidth + checkedClientMargin.iRight; xPos = aClientRect.iBr.iX + checkedClientMargin.iRight; yPos = aInclusiveRect.iTl.iY + checkedInclusiveMargin.iTop; height = aInclusiveRect.Size().iHeight - (checkedInclusiveMargin.iTop + checkedInclusiveMargin.iBottom) - horizontalScrollBarWidth; if ((aClientRect.iBr.iX + width + checkedInclusiveMargin.iRight > aInclusiveRect.iBr.iX) || (aInclusiveRect.iBr.iX - (width + checkedInclusiveMargin.iRight) > aClientRect.iBr.iX)) { aInclusiveRect.iBr.iX = aClientRect.iBr.iX + width + checkedInclusiveMargin.iRight; sizeChanged = ETrue; } } } else { // Mirrored Left & Right if (aLayout.iTilingMode == TEikScrollBarFrameLayout::EInclusiveRectConstant) { width = scrollBarWidth + checkedInclusiveMargin.iRight; xPos = aInclusiveRect.iTl.iX + checkedInclusiveMargin.iRight; yPos = aInclusiveRect.iTl.iY + checkedInclusiveMargin.iTop; height = aInclusiveRect.Size().iHeight - (checkedInclusiveMargin.iTop + checkedInclusiveMargin.iBottom) - horizontalScrollBarWidth; if ((aClientRect.iTl.iX - width < aInclusiveRect.iTl.iX) || (aInclusiveRect.iTl.iX + width > aClientRect.iTl.iX)) { aClientRect.iTl.iX = aInclusiveRect.iTl.iX + width; xPos = aInclusiveRect.iTl.iX + checkedInclusiveMargin.iRight; sizeChanged = ETrue; } } else { width = scrollBarWidth + checkedClientMargin.iRight; xPos = aClientRect.iTl.iX - checkedClientMargin.iRight; yPos = aInclusiveRect.iTl.iY + checkedInclusiveMargin.iTop; height = aInclusiveRect.Size().iHeight - (checkedInclusiveMargin.iTop + checkedInclusiveMargin.iBottom) - horizontalScrollBarWidth; if ((aClientRect.iTl.iX - width - checkedInclusiveMargin.iRight > aInclusiveRect.iTl.iX) || (aInclusiveRect.iTl.iX - (width + checkedInclusiveMargin.iRight) < aClientRect.iTl.iX)) { aInclusiveRect.iTl.iX = aClientRect.iTl.iX - width - checkedInclusiveMargin.iRight; xPos = aInclusiveRect.iTl.iX + checkedInclusiveMargin.iRight; sizeChanged = ETrue; } } } TRect newRect = TRect(TPoint(xPos, yPos), TSize(width, height )); if (iV.iBar->IsVisible() && (newRect != TRect(iV.iBar->Position(), iV.iBar->Size()))) { iV.iBar->SetRect(newRect); } } } // Horizontal Double span scollbar if (iExtension && iExtension->iH.iBar && TypeOfHScrollBar() == EDoubleSpan && iExtension->iH.iExternalScrollBarAttached==EFalse ) { TInt scrollBarWidth = ScrollBarBreadth(CEikScrollBar::EHorizontal); // is 0 if SB not visible ! TInt verticalScrollBarWidth = 0; if (iV.iVisibility!=EOff) { verticalScrollBarWidth = ScrollBarBreadth(CEikScrollBar::EVertical); } CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*> (iExtension->iH.iBar); if (scrollbar->FixedLayoutRect().Size() == TSize(0,0)) { TMargins checkedClientMargin(aLayout.iClientMargin); TMargins checkedInclusiveMargin(aLayout.iInclusiveMargin); checkedClientMargin.iTop = Max(0,checkedClientMargin.iTop); checkedClientMargin.iBottom = Max(0,checkedClientMargin.iBottom); checkedClientMargin.iRight = Max(0,checkedClientMargin.iRight); checkedClientMargin.iLeft = Max(0,checkedClientMargin.iLeft); checkedInclusiveMargin.iTop = Max(0,checkedInclusiveMargin.iTop); checkedInclusiveMargin.iBottom = Max(0,checkedInclusiveMargin.iBottom); checkedInclusiveMargin.iRight = Max(0,checkedInclusiveMargin.iRight); checkedInclusiveMargin.iLeft = Max(0,checkedInclusiveMargin.iLeft); TInt width = 0; TInt xPos = 0; TInt yPos = 0; TInt height = 0; if (aLayout.iTilingMode == TEikScrollBarFrameLayout::EInclusiveRectConstant) { width = scrollBarWidth + checkedInclusiveMargin.iBottom; // width as vertical direction (height). xPos = aInclusiveRect.iTl.iX + checkedInclusiveMargin.iLeft; if (AknLayoutUtils::LayoutMirrored()) { xPos += verticalScrollBarWidth; } yPos = aInclusiveRect.iBr.iY - checkedInclusiveMargin.iBottom - width; height = aInclusiveRect.Size().iWidth - (checkedInclusiveMargin.iLeft + checkedInclusiveMargin.iRight) - verticalScrollBarWidth; // height as horizontal (width). if ((aClientRect.iBr.iY + width > aInclusiveRect.iBr.iY) || (aInclusiveRect.iBr.iY - width > aClientRect.iBr.iY)) { aClientRect.iBr.iY = aInclusiveRect.iBr.iY - width; sizeChanged = ETrue; } } else { width = scrollBarWidth + checkedClientMargin.iBottom; // width as vertical direction (height). xPos = aInclusiveRect.iTl.iX + checkedInclusiveMargin.iLeft; if (AknLayoutUtils::LayoutMirrored()) { xPos += verticalScrollBarWidth; } yPos = aClientRect.iBr.iY + checkedClientMargin.iBottom; height = aInclusiveRect.Size().iWidth - (checkedInclusiveMargin.iLeft + checkedInclusiveMargin.iRight) - verticalScrollBarWidth; // height as horizontal (width). if ((aClientRect.iBr.iY + width + checkedClientMargin.iBottom > aInclusiveRect.iBr.iY) || (aInclusiveRect.iBr.iY - (width + checkedInclusiveMargin.iBottom) > aClientRect.iBr.iY)) { aInclusiveRect.iBr.iY = aClientRect.iBr.iY + width + checkedInclusiveMargin.iBottom; sizeChanged = ETrue; } } TRect newRect = TRect(TPoint(xPos, yPos), TSize(height, width )); // height & width swapped if (iExtension->iH.iBar->IsVisible() && (newRect != TRect(iV.iBar->Position(), iV.iBar->Size()))) { iExtension->iH.iBar->SetRect(newRect); } } } return sizeChanged; }
/*! \brief Constructor for the ActivityWindow class. * \param[in] data The data to be displayed. * \param[in] target The process to be notified about user's choise. * \param[in] name Name of the Event. * \param[in] category Category of the Event. * \param[in] templateMessage The message to be sent to the target. * If \c NULL is passed, then a new message is constructed * with \c kActivityWindowRepsonceMessage value in \c what. * \param[in] reminder \c true if the window is constructed for a reminder, else * \c false. Actually, it matters only for explanation to user. * Default is \c false (it's not a reminder). * \note A note on memory management: * \c data (the ActionData) belongs to the caller, but it's used only for * initialization of this window. I. e., if the user makes changes to the * data while an ActivityWindow is open, the changes won't be reflected. * However, \c target and \c templateMessage belong to this object. User * shouldn't free them or do anything else. */ ActivityWindow::ActivityWindow( ActivityData* data, BMessenger* target, BString name, Category* category, BMessage* templateMessage, bool reminder ) : BWindow( BRect( 0, 0, 400, 500 ), "Event occurred", B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS ), fTarget( target ), fData( data ), fTemplateMessage( templateMessage ), bIsReminder( reminder ), fLastError( B_OK ), fEventName( name ), fCategory( category ), fTitle( NULL ), fEventNameView( NULL ), fCategoryView( NULL ), fTextScroller( NULL ), fSnoozeTime( NULL ), fNoteText( NULL ), fSnooze( NULL ), fOk( NULL ) { BFont boldFont( be_bold_font ); BFont plainFont( be_plain_font ); BFont font; // For various font-related activities font_height fh; // For setting the height of the Text View with notification text plainFont.GetHeight( &fh ); int numberOfColumnsInLayout = 2; // Sanity check if ( !data || !target ) { /* Panic! */ fLastError = B_BAD_VALUE; return; } if ( ! fData->GetNotification( NULL ) && ! fData->GetSound( NULL ) && ! fData->GetProgram( NULL, NULL ) ) { // Nothing to do! This is not an error! fLastError = B_NO_INIT; return; } BView* background = new BView( Bounds(), "Background view", B_FOLLOW_ALL_SIDES, B_WILL_DRAW ); if ( !background ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } this->AddChild( background ); BGridLayout* gridLayout = new BGridLayout(); if ( !gridLayout ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } background->SetLayout( gridLayout ); background->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) ); gridLayout->SetInsets( 5, 5, 5, 5 ); /*------------------------------------------------- * First line - explaining what's happening here *------------------------------------------------*/ BStringView* exp = new BStringView( BRect( 0, 0, 1, 1 ), "Explanation 1", ( bIsReminder ? "A Reminder has occured!" : "An Event has occured!" ) ); if ( ! exp ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } exp->SetFont( &boldFont ); exp->ResizeToPreferred(); BLayoutItem* layoutItem = gridLayout->AddView( exp, 0, 0, numberOfColumnsInLayout, 1 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_CENTER, B_ALIGN_TOP ) ); } /*----------------------------------------------------------------- * Second line - event's name on category's color as background *----------------------------------------------------------------*/ // Create background // Note: the pulse is requested for this Window to receive Pulse notifications. fBackground = new BView( BRect( 0, 0, 1, 1 ), "Background", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_V_CENTER | B_PULSE_NEEDED, B_WILL_DRAW ); if ( !fBackground ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } fBackground->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) ); layoutItem = gridLayout->AddView( fBackground, 0, 1, numberOfColumnsInLayout, 1 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_USE_FULL_HEIGHT ) ); } BGroupLayout* bgLayout = new BGroupLayout( B_VERTICAL ); if ( !bgLayout ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } fBackground->SetLayout( bgLayout ); bgLayout->SetInsets( 15, 10, 15, 10 ); fBackground->SetViewColor( fCategory.categoryColor ); BString sb = "Category:\n"; sb << fCategory.categoryName; fBackground->SetToolTip( sb.String() ); // Create Event's name view fTitle = new BStringView( BRect( 0, 0, 1, 1 ), "Event name", fEventName.String(), B_FOLLOW_H_CENTER | B_FOLLOW_V_CENTER ); if ( !fTitle ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } // Use big bold font for Event's name fTitle->SetFont( be_bold_font ); fTitle->GetFont( &font ); font.SetSize( font.Size() + 2 ); fTitle->SetFont( &font, B_FONT_SIZE ); // Add the title and set its tooltip fTitle->ResizeToPreferred(); fTitle->SetToolTip( sb.String() ); bgLayout->AddView( fTitle ); fTitle->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) ); fTitle->SetToolTip( fEventName.String() ); int nextLineInLayout = 2; /*================================================================ * If the notification was set by the user, display it. *================================================================*/ BString tempString; BPath path; float rectHeight = fh.leading + fh.ascent + fh.descent; float rectWidth = this->Bounds().Width() - 10; // Layout insets BSize size( rectWidth, rectHeight ); if ( fData->GetNotification( &tempString ) ) { /*----------------------------------------------------------------- * Line of explanation *----------------------------------------------------------------*/ exp = new BStringView( BRect( 0, 0, 1, 1 ), "Text view explanation", "You set the following notification:" ); if ( !exp ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } exp->ResizeToPreferred(); layoutItem = gridLayout->AddView( exp, 0, nextLineInLayout++, numberOfColumnsInLayout, 1 ); /*----------------------------------------------------------------- * Text view with notification text *----------------------------------------------------------------*/ BRect tempRect( BPoint( 0, 0 ), size ); tempRect.right -= B_V_SCROLL_BAR_WIDTH; fNoteText = new BTextView( tempRect, "Notification text container", tempRect.InsetByCopy( 1, 1 ), B_FOLLOW_ALL_SIDES, B_WILL_DRAW ); if ( !fNoteText ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } fNoteText->MakeEditable( false ); fNoteText->SetText( tempString.String() ); /*----------------------------------------------------------------- * Scroll view to scroll the notification text *----------------------------------------------------------------*/ fTextScroller = new BScrollView( "Notification text scroller", fNoteText, B_FOLLOW_ALL_SIDES, 0, false, true ); if ( !fTextScroller ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } layoutItem = gridLayout->AddView( fTextScroller, 0, nextLineInLayout++, numberOfColumnsInLayout, 1 ); if ( layoutItem ) { // layoutItem->SetExplicitMaxSize( size ); layoutItem->SetExplicitMinSize( size ); layoutItem->SetExplicitPreferredSize( size ); layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_USE_FULL_HEIGHT ) ); } } // <-- end of adding information about the notification /*================================================================ * If user wanted to play a sound file, notify him about it. *================================================================*/ if ( fData->GetSound( &path ) ) { /*----------------------------------------------------------------- * Line of explanation *----------------------------------------------------------------*/ exp = new BStringView( BRect( 0, 0, 1, 1 ), "Sound file explanation", "You wanted to play the file:", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP ); if ( !exp ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } exp->ResizeToPreferred(); layoutItem = gridLayout->AddView( exp, 0, nextLineInLayout++, numberOfColumnsInLayout, 1 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_CENTER, B_ALIGN_MIDDLE ) ); } /*----------------------------------------------------------------- * Display sound file name *----------------------------------------------------------------*/ // What should we display - full path or just the leaf? if ( ( size.width - 10 ) > plainFont.StringWidth( path.Path() ) ) { tempString.SetTo( path.Path() ); } else { tempString.SetTo( path.Leaf() ); } exp = new BStringView( BRect( 0, 0, 1, 1 ), "Sound file name", tempString.String() ); if ( !exp ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } exp->ResizeToPreferred(); layoutItem = gridLayout->AddView( exp, 0, nextLineInLayout++, numberOfColumnsInLayout, 1 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_CENTER, B_ALIGN_MIDDLE ) ); } } // <-- end of displaying information about the sound file /*================================================================ * If user wanted to run a program, notify him about it. *================================================================*/ if ( fData->GetProgram( &path, &tempString ) ) { /*----------------------------------------------------------------- * Line of explanation *----------------------------------------------------------------*/ exp = new BStringView( BRect( 0, 0, 1, 1 ), "Program explanation", "You wanted to run a program:" ); if ( !exp ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } exp->ResizeToPreferred(); layoutItem = gridLayout->AddView( exp, 0, nextLineInLayout++, numberOfColumnsInLayout, 1 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_CENTER, B_ALIGN_MIDDLE ) ); } /*----------------------------------------------------------------- * Display path to program file *----------------------------------------------------------------*/ // What should we display - full path or just the leaf? exp = new BStringView( BRect( 0, 0, 1, 1 ), "Program file name", ( ( size.width - 10 ) > plainFont.StringWidth( path.Path() ) ) ? path.Path() : path.Leaf() ); if ( !exp ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } exp->ResizeToPreferred(); layoutItem = gridLayout->AddView( exp, 0, nextLineInLayout++, numberOfColumnsInLayout, 1 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_CENTER, B_ALIGN_MIDDLE ) ); } /*----------------------------------------------------------------- * Explanation about the program options *----------------------------------------------------------------*/ if ( tempString.Length() > 0 ) { exp = new BStringView( BRect( 0, 0, 1, 1 ), "Program file options explanation", "With the following parameters:" ); if ( !exp ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } exp->ResizeToPreferred(); layoutItem = gridLayout->AddView( exp, 0, nextLineInLayout++, numberOfColumnsInLayout, 1 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_CENTER, B_ALIGN_MIDDLE ) ); } /*----------------------------------------------------------------- * Display the program options *----------------------------------------------------------------*/ // What should we display - full path or just the leaf? exp = new BStringView( BRect( 0, 0, 1, 1 ), "Program file options", tempString.String() ); if ( !exp ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } exp->ResizeToPreferred(); layoutItem = gridLayout->AddView( exp, 0, nextLineInLayout++, numberOfColumnsInLayout, 1 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_CENTER, B_ALIGN_MIDDLE ) ); } } // <-- end of diplaying CLI options } // <-- end of displaying information about the program to run /*================================================================ * Now it's time to display the Snooze time selector *================================================================*/ TimePreferences* prefs = pref_GetTimePreferences(); if ( prefs ) { prefs->GetDefaultSnoozeTime( ( int* )&fSnoozeHours, ( int* )&fSnoozeMins ); } else { fSnoozeHours = 0; fSnoozeMins = 10; } BMessage* toSend = new BMessage( kSnoozeTimeControlMessage ); if ( ! toSend ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } fSnoozeTime = new GeneralHourMinControl( BRect( 0, 0, 1, 1 ), "Snooze time selector", "Snooze this Activtiy for:", BString( "" ), // No check box toSend ); if ( !fSnoozeTime ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } fSnoozeTime->SetHoursLimit( 23 ); // Max reminder time delay is 23 hours 55 minutes fSnoozeTime->SetMinutesLimit( 55 ); fSnoozeTime->SetCurrentTime( fSnoozeHours, fSnoozeMins ); layoutItem = gridLayout->AddView( fSnoozeTime, 0, nextLineInLayout++, numberOfColumnsInLayout, 1 ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_CENTER, B_ALIGN_MIDDLE ) ); } /*================================================================ * Snooze button *================================================================*/ toSend = new BMessage( kSnoozeButtonPressed ); if ( !toSend ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } fSnooze = new BButton( BRect( 0, 0, 1, 1 ), "Snooze button", "Snooze", toSend, B_FOLLOW_LEFT | B_FOLLOW_TOP ); if ( !fSnooze ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } fSnooze->ResizeToPreferred(); layoutItem = gridLayout->AddView( fSnooze, 0, nextLineInLayout ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_LEFT, B_ALIGN_TOP ) ); } /*================================================================ * Ok button *================================================================*/ toSend = new BMessage( kDismissButtonPressed ); if ( !toSend ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } fOk = new BButton( BRect( 0, 0, 1, 1 ), "Dismiss button", "Dismiss", toSend, B_FOLLOW_RIGHT | B_FOLLOW_TOP ); if ( !fOk ) { /* Panic! */ fLastError = B_NO_MEMORY; return; } fSnooze->ResizeToPreferred(); layoutItem = gridLayout->AddView( fOk, 1, nextLineInLayout ); if ( layoutItem ) { layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_RIGHT, B_ALIGN_TOP ) ); } this->CenterOnScreen(); } // <-- end of constructor for ActivityWindow
PoorManLoggingView::PoorManLoggingView(BRect rect, const char *name) : BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW) { PoorManWindow * win; win = ((PoorManApplication *)be_app)->GetPoorManWindow(); SetViewColor(BACKGROUND_COLOR); // Console Logging BBox BRect consoleLoggingRect; consoleLoggingRect = rect; consoleLoggingRect.top -= 5.0; consoleLoggingRect.left -= 5.0; consoleLoggingRect.right -= 7.0; consoleLoggingRect.bottom -= 118.0; BBox * consoleLogging = new BBox(consoleLoggingRect, "Console Logging"); consoleLogging->SetLabel(STR_BBX_CONSOLE_LOGGING); AddChild(consoleLogging); // File Logging BBox BRect fileLoggingRect; fileLoggingRect = consoleLoggingRect; fileLoggingRect.top = consoleLoggingRect.bottom + 10.0; fileLoggingRect.bottom = fileLoggingRect.top + 100.0; BBox * fileLogging = new BBox(fileLoggingRect, "File Logging"); fileLogging->SetLabel(STR_BBX_FILE_LOGGING); AddChild(fileLogging); float left = 10.0; float top = 20.0; float box_size = 13.0; BRect tempRect(left, top, consoleLoggingRect.Width() - 5.0, top + box_size); // Console Logging logConsole = new BCheckBox(tempRect, "Log To Console", STR_CBX_LOG_CONSOLE, new BMessage(MSG_PREF_LOG_CBX_CONSOLE)); // set the checkbox to the value the program has SetLogConsoleValue(win->LogConsoleFlag()); consoleLogging->AddChild(logConsole); // File Logging logFile = new BCheckBox(tempRect, "Log To File", STR_CBX_LOG_FILE, new BMessage(MSG_PREF_LOG_CBX_FILE)); // set the checkbox to the value the program has SetLogFileValue(win->LogFileFlag()); fileLogging->AddChild(logFile); // File Name tempRect.top = tempRect.bottom + 10.0; tempRect.bottom = tempRect.top + box_size; tempRect.right -= 5.0; logFileName = new BTextControl(tempRect, "File Name", STR_TXT_LOG_FILE_NAME, NULL, NULL); logFileName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); logFileName->SetDivider(fileLogging->StringWidth(STR_TXT_LOG_FILE_NAME) + 8.0f); SetLogFileName(win->LogPath()); fileLogging->AddChild(logFileName); // Create Log File BRect createLogFileRect; createLogFileRect.top = tempRect.bottom + 13.0; createLogFileRect.right = tempRect.right + 2.0; createLogFileRect.left = createLogFileRect.right - fileLogging->StringWidth("Create Log File") - 24.0; createLogFileRect.bottom = createLogFileRect.top + 19.0; createLogFile = new BButton(createLogFileRect, "Create Log File", STR_BTN_CREATE_LOG_FILE, new BMessage(MSG_PREF_LOG_BTN_CREATE_FILE)); fileLogging->AddChild(createLogFile); }