remove right-click menu in InterfaceView; add FrameResized hook to invalidate to correct tearing right status text; Add heal button to renegotiate interface address.. this also balances the buttons on the bottom.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40908 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b4725a13b7
commit
a0a9cb5c21
@ -80,6 +80,10 @@ InterfacesAddOn::CreateView(BRect *bounds)
|
||||
new BMessage(kMsgInterfaceToggle));
|
||||
fOnOff->SetEnabled(false);
|
||||
|
||||
fHeal = new BButton(intViewRect, "heal",
|
||||
"Heal", new BMessage(kMsgInterfaceHeal));
|
||||
fHeal->SetEnabled(false);
|
||||
|
||||
// Build the layout
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
|
||||
@ -89,6 +93,7 @@ InterfacesAddOn::CreateView(BRect *bounds)
|
||||
.Add(fConfigure)
|
||||
.Add(fOnOff)
|
||||
.AddGlue()
|
||||
.Add(fHeal)
|
||||
.End()
|
||||
.SetInsets(10, 10, 10, 10)
|
||||
);
|
||||
@ -104,6 +109,7 @@ InterfacesAddOn::AttachedToWindow()
|
||||
fListview->SetTarget(this);
|
||||
fConfigure->SetTarget(this);
|
||||
fOnOff->SetTarget(this);
|
||||
fHeal->SetTarget(this);
|
||||
}
|
||||
|
||||
|
||||
@ -127,11 +133,13 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
|
||||
switch (msg->what) {
|
||||
case kMsgInterfaceSelected:
|
||||
{
|
||||
fOnOff->SetEnabled(item != NULL);
|
||||
fConfigure->SetEnabled(item != NULL);
|
||||
fOnOff->SetEnabled(item != NULL);
|
||||
fHeal->SetEnabled(item != NULL);
|
||||
if (!item)
|
||||
break;
|
||||
fConfigure->SetEnabled(!item->IsDisabled());
|
||||
fHeal->SetEnabled(!item->IsDisabled());
|
||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||
break;
|
||||
}
|
||||
@ -152,8 +160,9 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
|
||||
break;
|
||||
|
||||
item->SetDisabled(!item->IsDisabled());
|
||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||
fConfigure->SetEnabled(!item->IsDisabled());
|
||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||
fHeal->SetEnabled(!item->IsDisabled());
|
||||
fListview->Invalidate();
|
||||
break;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
static const uint32 kMsgInterfaceSelected = 'ifce';
|
||||
static const uint32 kMsgInterfaceConfigure = 'ifcf';
|
||||
static const uint32 kMsgInterfaceToggle = 'onof';
|
||||
static const uint32 kMsgInterfaceHeal = 'heal';
|
||||
|
||||
|
||||
class InterfacesAddOn : public NetworkSetupAddOn, public BBox
|
||||
@ -43,6 +44,7 @@ private:
|
||||
InterfacesListView* fListview;
|
||||
BButton* fConfigure;
|
||||
BButton* fOnOff;
|
||||
BButton* fHeal;
|
||||
};
|
||||
|
||||
|
||||
|
@ -342,6 +342,13 @@ InterfacesListView::AttachedToWindow()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InterfacesListView::FrameResized(float width, float height)
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InterfacesListView::DetachedFromWindow()
|
||||
{
|
||||
@ -371,36 +378,6 @@ InterfacesListView::MessageReceived(BMessage* message)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InterfacesListView::MouseDown(BPoint point)
|
||||
{
|
||||
BMessage *msg = Window()->CurrentMessage();
|
||||
BListView::MouseDown(point);
|
||||
|
||||
// if user is clicking and an item that has been selected
|
||||
// via MouseDown call above. (eg. user clicked a list item)
|
||||
if (msg->what == B_MOUSE_DOWN
|
||||
&& this->CurrentSelection() >= 0) {
|
||||
uint32 buttons = 0;
|
||||
msg->FindInt32("buttons", (int32 *)&buttons);
|
||||
|
||||
// was it the secondary mouse button? If so show interface options
|
||||
if (buttons & B_SECONDARY_MOUSE_BUTTON) {
|
||||
BPopUpMenu *menu = new BPopUpMenu("IntefaceOptions");
|
||||
menu->SetFont(be_plain_font);
|
||||
menu->AddItem(new BMenuItem("Renegotiate Address",
|
||||
new BMessage(kMsgInterfaceReconfigure)));
|
||||
menu->Go(ConvertToScreen(point));
|
||||
//if (selected)
|
||||
// Window()->PostMessage(selected->Message()->what);
|
||||
//delete menu;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
InterfaceListItem *
|
||||
InterfacesListView::FindItem(const char* name)
|
||||
{
|
||||
|
@ -31,8 +31,6 @@
|
||||
#define ICON_SIZE 37
|
||||
|
||||
|
||||
static const uint32 kMsgInterfaceReconfigure = 'ifre';
|
||||
|
||||
class InterfaceListItem : public BListItem {
|
||||
public:
|
||||
InterfaceListItem(const char* name);
|
||||
@ -85,7 +83,7 @@ public:
|
||||
protected:
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void MouseDown(BPoint point);
|
||||
virtual void FrameResized(float width, float height);
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user