void TStageMovieCue::DragPicture(BPoint thePoint) { BPoint savePt; uint32 buttons = 0; GetMouse(&thePoint, &buttons, true); ConvertToParent(&thePoint); savePt = thePoint; while (buttons) { if (thePoint != savePt) { // Convert to parents coordinate system ConvertToParent(&thePoint); MoveBy( ( thePoint.x - savePt.x) , (thePoint.y - savePt.y) ); // Save mouse location for next compare savePt = thePoint; } GetMouse(&thePoint, &buttons, true); } }
void TStageMovieCue::ResizeBottomRight( BPoint thePoint) { // Resize the cue to the right will the mouse button is down BPoint savePt; uint32 buttons = 0; GetMouse(&thePoint, &buttons, true); ConvertToParent(&thePoint); savePt = thePoint; while (buttons) { if (thePoint != savePt) { float resizeX = thePoint.x - savePt.x; float resizeY = thePoint.y - savePt.y; // Don't allow resize past bitmap width and height if ( ( Bounds().Width() + resizeX <= m_Bitmap->Bounds().Width()) || Bounds().Height() + resizeY <= m_Bitmap->Bounds().Height() ) { // Constrian to minimum bounds if ( ( Bounds().right - resizeX >= kBorder*2 ) || Bounds().bottom - resizeY >= m_Bitmap->Bounds().top + kBorder*2 ) { // Redraw the selection rect and resize points InvalidateSelectionRect(); // Do resize ResizeBy( resizeX, resizeY ); SetResizeZones(); } } // Save mouse location for next compare savePt = thePoint; } GetMouse(&thePoint, &buttons, true); // Clip the point back within the proper bounds if (thePoint.x > m_Bitmap->Bounds().right) thePoint.x = m_Bitmap->Bounds().right; if (thePoint.y > m_Bitmap->Bounds().bottom) thePoint.y = m_Bitmap->Bounds().bottom; if (thePoint.x < m_Bitmap->Bounds().left + (kBorder*2) ) thePoint.x = m_Bitmap->Bounds().left + (kBorder*2); if (thePoint.y < m_Bitmap->Bounds().top + (kBorder*2)) thePoint.y = m_Bitmap->Bounds().top + (kBorder*2); // Convert to parents coordinate system ConvertToParent(&thePoint); } }
void TStageMovieCue::ResizeLeft( BPoint thePoint) { // Resize the cue to the right will the mouse button is down BPoint savePt; uint32 buttons = 0; GetMouse(&thePoint, &buttons, true); ConvertToParent(&thePoint); savePt = thePoint; while (buttons) { if (thePoint != savePt) { float resize = thePoint.x - savePt.x; // Don't allow resize past bitmap width if ( Bounds().Width() <= m_Bitmap->Bounds().Width() ) { // Redraw the selection rect and resize points InvalidateSelectionRect(); // Do resize. Resize the view and move it to the proper location //float curRight = Bounds().right; BPoint movePt = thePoint; ConvertToParent(movePt); MoveTo( movePt.x, Frame().top ); if ( Bounds().Width() + resize > m_Bitmap->Bounds().Width() ) resize = Bounds().Width() - m_Bitmap->Bounds().Width(); ResizeBy( -resize, 0 ); SetResizeZones(); } // Save mouse location for next compare savePt = thePoint; } GetMouse(&thePoint, &buttons, true); // Clip the point back within the proper bounds // Fix bounds violation //if ( Bounds().Width() > m_Bitmap->Bounds().Width() ) // ResizeBy( (Bounds().Width() - m_Bitmap->Bounds().Width()), 0 ); // Convert to parents coordinate system ConvertToParent(&thePoint); } }
void Splitter::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage) { if (transit == B_ENTERED_VIEW) { BCursor cursor(kSplitterCursor); SetViewCursor(&cursor); } if (!fTracking || fIgnoreMouseMoved) { fIgnoreMouseMoved = false; return; } // stupid R5 app_server sends us bogus mouse // coordinates when we have moved meanwhile // (by relayouting) uint32 buttons; GetMouse(&where, &buttons, false); ConvertToParent(&where); float offset; if (fOrientation == B_VERTICAL) offset = where.x - fMousePos.x; else offset = where.y - fMousePos.y; if (offset != 0.0) Move(offset); }
void AmTrackDataView::HandleScrollMsg(const BMessage* msg) { bool scrollToX, scrollToY; if (msg->FindBool("x", &scrollToX) != B_OK) scrollToX = false; if (msg->FindBool("y", &scrollToY) != B_OK) scrollToY = false; if (!scrollToX && !scrollToY) return; float x_delta = 0, y_delta = 0; BRect f = Frame(); BPoint where; uint32 button; GetMouse(&where, &button, false); ConvertToParent(&where); if( where.x < f.left ) x_delta = where.x - f.left; else if( where.x > f.right ) x_delta = where.x - f.right; if( where.y < f.top ) y_delta = where.y - f.top; else if( where.y > f.bottom ) y_delta = where.y - f.bottom; if( x_delta != 0 || y_delta != 0 ) { BMessage msg(AM_SCROLL_MSG); if (scrollToX && x_delta != 0) msg.AddFloat( "x", x_delta * 0.5 ); if (scrollToY && y_delta != 0) msg.AddFloat( "pri_y", y_delta * 0.5 ); if ( Window() ) Window()->PostMessage( &msg ); } }
// MouseDown void OptionValueView::MouseDown(BPoint where) { if (BView* parent = Parent()) parent->MouseDown(ConvertToParent(where)); if (fProperty) { BPopUpMenu* menu = new BPopUpMenu("option popup", false, false); BString name; int32 id; for (int32 i = 0; fProperty->GetOption(i, &name, &id); i++) { BMessage* message = new BMessage(MSG_OPTION_CHANGED); message->AddInt32("id", id); BMenuItem* item = new BMenuItem(name.String(), message); menu->AddItem(item); if (id == fProperty->CurrentOptionID()) item->SetMarked(true); } menu->SetTargetForItems(this); menu->SetAsyncAutoDestruct(true); menu->SetFont(be_plain_font); menu->SetEnabled(fEnabled); where = ConvertToScreen(where); BRect mouseRect(where, where); mouseRect.InsetBy(-10.0, -10.0); where += BPoint(5.0, 5.0); menu->Go(where, true, false, mouseRect, true); } }
void PSplitter::AttachedToWindow() { BPoint p = ConvertToParent(Bounds().LeftTop()); fOrigin = p.y; fText->SetSplitter(this); SetViewColor(B_TRANSPARENT_32_BIT); } /* PSplitter::AttachedToWindow */
// MouseDown void SwatchValueView::MouseDown(BPoint where) { // forward click if (BView* parent = Parent()) parent->MouseDown(ConvertToParent(where)); SwatchView::MouseDown(where); }
void TStageMovieCue::ResizeRight( BPoint thePoint) { // Resize the cue to the right will the mouse button is down BPoint savePt; uint32 buttons = 0; GetMouse(&thePoint, &buttons, true); ConvertToParent(&thePoint); savePt = thePoint; while (buttons) { if (thePoint.x != savePt.x) { float resize = thePoint.x - savePt.x; // Don't allow resize past bitmap width if ( ( Bounds().Width() + resize <= m_Bitmap->Bounds().Width()) || ( Bounds().right - resize >= kBorder*2 ) ) { // Redraw the selection rect and resize points InvalidateSelectionRect(); // Do resize ResizeBy( resize, 0 ); SetResizeZones(); } // Save mouse location for next compare savePt = thePoint; } GetMouse(&thePoint, &buttons, true); // Clip the point back within the proper bounds if (thePoint.x > m_Bitmap->Bounds().right) thePoint.x = m_Bitmap->Bounds().right; if (thePoint.x < m_Bitmap->Bounds().left + (kBorder*2) ) thePoint.x = m_Bitmap->Bounds().left + (kBorder*2); // Convert to parents coordinate system ConvertToParent(&thePoint); } }
void TStageMovieCue::ResizeBottom( BPoint thePoint) { // Resize the cue to the right will the mouse button is down BPoint savePt; uint32 buttons = 0; GetMouse(&thePoint, &buttons, true); ConvertToParent(&thePoint); savePt = thePoint; while (buttons) { if (thePoint.y != savePt.y) { float resize = thePoint.y - savePt.y; // Don't allow resize past bitmap height or mimimum height if ( Bounds().Height() + resize <= m_Bitmap->Bounds().Height() || Bounds().bottom - resize >= m_Bitmap->Bounds().top + kBorder*2 ) { // Redraw the selection rect and resize points InvalidateSelectionRect(); // Do resize ResizeBy( 0, resize ); SetResizeZones(); } // Save mouse location for next compare savePt = thePoint; } GetMouse(&thePoint, &buttons, true); // Clip the point back within the proper bounds if (thePoint.y > m_Bitmap->Bounds().bottom) thePoint.y = m_Bitmap->Bounds().bottom; if (thePoint.y < m_Bitmap->Bounds().top + (kBorder*2)) thePoint.y = m_Bitmap->Bounds().top + (kBorder*2); // Convert to parents coordinate system ConvertToParent(&thePoint); } }
void BDragger::Draw(BRect update) { BRect bounds(Bounds()); if (AreDraggersDrawn() && (!fShelf || fShelf->AllowsDragging())) { if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) == 0) { uint32 flags = Parent()->Flags(); Parent()->SetFlags(flags | B_DRAW_ON_CHILDREN); Parent()->Draw(Frame() & ConvertToParent(update)); Parent()->Flush(); Parent()->SetFlags(flags); } BPoint where = bounds.RightBottom() - BPoint(fBitmap->Bounds().Width(), fBitmap->Bounds().Height()); SetDrawingMode(B_OP_OVER); DrawBitmap(fBitmap, where); SetDrawingMode(B_OP_COPY); if (fIsZombie) { // TODO: should draw it differently ? } } else if (IsVisibilityChanging()) { if (Parent()) { if ((Parent()->Flags() & B_DRAW_ON_CHILDREN) == 0) { uint32 flags = Parent()->Flags(); Parent()->SetFlags(flags | B_DRAW_ON_CHILDREN); Parent()->Invalidate(Frame() & ConvertToParent(update)); Parent()->SetFlags(flags); } } else { SetHighColor(255, 255, 255); FillRect(bounds); } } }
void InputTextView::MouseDown(BPoint where) { // enforce the behaviour of a typical BTextControl // only let the BTextView handle mouse up/down when // it already had focus fWasFocus = IsFocus(); if (fWasFocus) { BTextView::MouseDown(where); } else { // forward click if (BView* view = Parent()) { view->MouseDown(ConvertToParent(where)); } } }
void Splitter::MouseDown(BPoint where) { int32 clicks = 1; if (Window() != NULL && Window()->CurrentMessage() != NULL) Window()->CurrentMessage()->FindInt32("clicks", &clicks); if (clicks == 2) { DoubleClickMove(); return; } fTracking = true; fMousePos = where; ConvertToParent(&fMousePos); SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); fInitialPosition = fOrientation == B_VERTICAL ? Frame().left : Frame().top; }
void BHSplitter::MouseMoved(BPoint where, uint32 code, const BMessage* message) { BPoint line=ConvertToParent(where); BPoint p=Parent()->ConvertToParent(line); //if(code==B_ENTERED_VIEW)be_app->SetCursor(c_h_resize_cursor_data); //if((code==B_EXITED_VIEW || code==B_OUTSIDE_VIEW) && drag!=1)be_app->SetCursor(B_HAND_CURSOR); if(drag==1) { float split=(Bounds().Height()); float dy=Window()->Bounds().Height()-(p.y+split/2)-2; if(dy!=((NaviWindow*)wnd)->GetSplitPos()) { ((NaviWindow*)wnd)->SetSplitPos(dy); Invalidate(); } } BView::MouseMoved(where,code,message); }
// MouseDown void FontValueView::MouseDown(BPoint where) { if (BView* parent = Parent()) parent->MouseDown(ConvertToParent(where)); if (fProperty) { font_family family; font_style style; fProperty->Value().GetFamilyAndStyle(&family, &style); BPopUpMenu* menu = new BPopUpMenu("font popup", false, false); _PolulateMenu(menu, this, family, style); menu->SetTargetForItems(this); menu->SetEnabled(fEnabled); show_popup_menu(menu, where, this); } }
void ColorView::MouseDown(BPoint point) { ConvertToParent(&point); ((QueryView*)Parent())->MouseDown(point); }