Ticket #7052: Deskbar WindowMenu Refactoring 1.diff

File Deskbar WindowMenu Refactoring 1.diff, 2.4 KB (added by jscipione, 13 years ago)

Does some refactoring on WindowMenuBar.cpp and WindowMenuBar.h that I noticed while fixing more things

  • src/apps/deskbar/WindowMenu.cpp

     
    8181    fExpandedIndex(0)
    8282{
    8383    SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f);
     84    fBarView = static_cast<TBarApp*>(be_app)->BarView();
    8485}
    8586
    8687
     
    9495    int32 miniCount = 0;
    9596
    9697    bool dragging = false;
    97     TBarView* barview =(static_cast<TBarApp*>(be_app))->BarView();
    98     if (barview && barview->LockLooper()) {
     98    if (fBarView && fBarView->LockLooper()) {
    9999        //  'dragging' mode set in BarView::CacheDragData
    100100        //      invoke in MouseEnter in ExpandoMenuBar
    101         dragging = barview->Dragging();
     101        dragging = fBarView->Dragging();
    102102        if (dragging) {
    103103            // We don't want to show the menu when dragging, but it's not
    104104            // possible to remove a submenu once it exists, so we simply hide it
     
    106106            // and then.
    107107            Window()->Hide();
    108108            //  if in expando (horizontal or vertical)
    109             if (barview->Expando()) {
    110                 SetTrackingHook(barview->MenuTrackingHook,
    111                     barview->GetTrackingHookData());
     109            if (fBarView->Expando()) {
     110                SetTrackingHook(fBarView->MenuTrackingHook,
     111                    fBarView->GetTrackingHookData());
    112112            }
    113             barview->DragStart();
     113            fBarView->DragStart();
    114114        }
    115         barview->UnlockLooper();
     115        fBarView->UnlockLooper();
    116116    }
    117117
    118118    int32 parentMenuItems = 0;
     
    227227{
    228228    // in expando mode the teammenu will not call DragStop,
    229229    // thus, it needs to be called from here
    230     TBarView* barview = (dynamic_cast<TBarApp*>(be_app))->BarView();
    231     if (barview && barview->Expando() && barview->Dragging()
    232         && barview->LockLooper()) {
     230    if (fBarView && fBarView->Expando() && fBarView->Dragging()
     231        && fBarView->LockLooper()) {
    233232        // We changed the show level in AttachedToWindow().  Undo it.
    234233        Window()->Show();
    235         barview->DragStop();
    236         barview->UnlockLooper();
     234        fBarView->DragStop();
     235        fBarView->UnlockLooper();
    237236    }
    238237
    239238    BMenu::DetachedFromWindow();
  • src/apps/deskbar/WindowMenu.h

     
    5555        static bool     WindowShouldBeListed(uint32 behavior);
    5656
    5757    private:
    58         const BList     *fTeam;
     58        const BList*    fTeam;
     59        TBarView*       fBarView;
    5960        BString         fApplicationSignature;
    6061        bool            fExpanded;
    6162        int             fExpandedIndex;