AboutSystem: Hide border when "Show replicants" is turned off
Create SysInfoDragger class and override its MessageReceived() method to redraw the target view when draggers are shown or hidden. Check that fDragger->AreDraggersDrawn() is turned on before drawing the border in the SysInfoView::Draw() method. Change-Id: I8de1acafe52319ae0f4ed1d91eec2e9c0ad2cb9f Reviewed-on: https://review.haiku-os.org/c/haiku/+/7191 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
1395769e97
commit
fc786a2f07
@ -21,6 +21,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <AboutWindow.h>
|
#include <AboutWindow.h>
|
||||||
|
#include <AppDefs.h>
|
||||||
#include <AppFileInfo.h>
|
#include <AppFileInfo.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
@ -217,6 +218,17 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class SysInfoDragger : public BDragger {
|
||||||
|
public:
|
||||||
|
SysInfoDragger(BView* target);
|
||||||
|
|
||||||
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BView* fTarget;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class SysInfoView : public BView {
|
class SysInfoView : public BView {
|
||||||
public:
|
public:
|
||||||
SysInfoView();
|
SysInfoView();
|
||||||
@ -528,6 +540,33 @@ CropView::DoLayout()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - SysInfoDragger
|
||||||
|
|
||||||
|
|
||||||
|
SysInfoDragger::SysInfoDragger(BView* target)
|
||||||
|
:
|
||||||
|
BDragger(BRect(0, 0, 7, 7), target, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM),
|
||||||
|
fTarget(target)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
SysInfoDragger::MessageReceived(BMessage* message)
|
||||||
|
{
|
||||||
|
switch (message->what) {
|
||||||
|
case _SHOW_DRAG_HANDLES_:
|
||||||
|
if (fTarget != NULL)
|
||||||
|
fTarget->Invalidate();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
BDragger::MessageReceived(message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - SysInfoView
|
// #pragma mark - SysInfoView
|
||||||
|
|
||||||
|
|
||||||
@ -712,7 +751,7 @@ SysInfoView::Draw(BRect updateRect)
|
|||||||
BView::Draw(updateRect);
|
BView::Draw(updateRect);
|
||||||
|
|
||||||
// stroke a line around the view
|
// stroke a line around the view
|
||||||
if (_OnDesktop())
|
if (_OnDesktop() && fDragger != NULL && fDragger->AreDraggersDrawn())
|
||||||
StrokeRect(Bounds());
|
StrokeRect(Bounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -969,8 +1008,7 @@ void
|
|||||||
SysInfoView::_CreateDragger()
|
SysInfoView::_CreateDragger()
|
||||||
{
|
{
|
||||||
// create replicant dragger and add it as the new child 0
|
// create replicant dragger and add it as the new child 0
|
||||||
fDragger = new BDragger(BRect(0, 0, 7, 7), this,
|
fDragger = new SysInfoDragger(this);
|
||||||
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
|
|
||||||
BPopUpMenu* popUp = new BPopUpMenu("Shelf", false, false, B_ITEMS_IN_COLUMN);
|
BPopUpMenu* popUp = new BPopUpMenu("Shelf", false, false, B_ITEMS_IN_COLUMN);
|
||||||
popUp->AddItem(new BMenuItem(B_TRANSLATE("Remove replicant"),
|
popUp->AddItem(new BMenuItem(B_TRANSLATE("Remove replicant"),
|
||||||
new BMessage(kDeleteReplicant)));
|
new BMessage(kDeleteReplicant)));
|
||||||
|
Loading…
Reference in New Issue
Block a user