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:
@@ -80,6 +80,10 @@ InterfacesAddOn::CreateView(BRect *bounds)
|
|||||||
new BMessage(kMsgInterfaceToggle));
|
new BMessage(kMsgInterfaceToggle));
|
||||||
fOnOff->SetEnabled(false);
|
fOnOff->SetEnabled(false);
|
||||||
|
|
||||||
|
fHeal = new BButton(intViewRect, "heal",
|
||||||
|
"Heal", new BMessage(kMsgInterfaceHeal));
|
||||||
|
fHeal->SetEnabled(false);
|
||||||
|
|
||||||
// Build the layout
|
// Build the layout
|
||||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||||
|
|
||||||
@@ -89,6 +93,7 @@ InterfacesAddOn::CreateView(BRect *bounds)
|
|||||||
.Add(fConfigure)
|
.Add(fConfigure)
|
||||||
.Add(fOnOff)
|
.Add(fOnOff)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
|
.Add(fHeal)
|
||||||
.End()
|
.End()
|
||||||
.SetInsets(10, 10, 10, 10)
|
.SetInsets(10, 10, 10, 10)
|
||||||
);
|
);
|
||||||
@@ -104,6 +109,7 @@ InterfacesAddOn::AttachedToWindow()
|
|||||||
fListview->SetTarget(this);
|
fListview->SetTarget(this);
|
||||||
fConfigure->SetTarget(this);
|
fConfigure->SetTarget(this);
|
||||||
fOnOff->SetTarget(this);
|
fOnOff->SetTarget(this);
|
||||||
|
fHeal->SetTarget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -127,11 +133,13 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
|
|||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
case kMsgInterfaceSelected:
|
case kMsgInterfaceSelected:
|
||||||
{
|
{
|
||||||
fOnOff->SetEnabled(item != NULL);
|
|
||||||
fConfigure->SetEnabled(item != NULL);
|
fConfigure->SetEnabled(item != NULL);
|
||||||
|
fOnOff->SetEnabled(item != NULL);
|
||||||
|
fHeal->SetEnabled(item != NULL);
|
||||||
if (!item)
|
if (!item)
|
||||||
break;
|
break;
|
||||||
fConfigure->SetEnabled(!item->IsDisabled());
|
fConfigure->SetEnabled(!item->IsDisabled());
|
||||||
|
fHeal->SetEnabled(!item->IsDisabled());
|
||||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -152,8 +160,9 @@ InterfacesAddOn::MessageReceived(BMessage* msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
item->SetDisabled(!item->IsDisabled());
|
item->SetDisabled(!item->IsDisabled());
|
||||||
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
|
||||||
fConfigure->SetEnabled(!item->IsDisabled());
|
fConfigure->SetEnabled(!item->IsDisabled());
|
||||||
|
fOnOff->SetLabel(item->IsDisabled() ? "Enable" : "Disable");
|
||||||
|
fHeal->SetEnabled(!item->IsDisabled());
|
||||||
fListview->Invalidate();
|
fListview->Invalidate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
static const uint32 kMsgInterfaceSelected = 'ifce';
|
static const uint32 kMsgInterfaceSelected = 'ifce';
|
||||||
static const uint32 kMsgInterfaceConfigure = 'ifcf';
|
static const uint32 kMsgInterfaceConfigure = 'ifcf';
|
||||||
static const uint32 kMsgInterfaceToggle = 'onof';
|
static const uint32 kMsgInterfaceToggle = 'onof';
|
||||||
|
static const uint32 kMsgInterfaceHeal = 'heal';
|
||||||
|
|
||||||
|
|
||||||
class InterfacesAddOn : public NetworkSetupAddOn, public BBox
|
class InterfacesAddOn : public NetworkSetupAddOn, public BBox
|
||||||
@@ -43,6 +44,7 @@ private:
|
|||||||
InterfacesListView* fListview;
|
InterfacesListView* fListview;
|
||||||
BButton* fConfigure;
|
BButton* fConfigure;
|
||||||
BButton* fOnOff;
|
BButton* fOnOff;
|
||||||
|
BButton* fHeal;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -342,6 +342,13 @@ InterfacesListView::AttachedToWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
InterfacesListView::FrameResized(float width, float height)
|
||||||
|
{
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InterfacesListView::DetachedFromWindow()
|
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 *
|
InterfaceListItem *
|
||||||
InterfacesListView::FindItem(const char* name)
|
InterfacesListView::FindItem(const char* name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
#define ICON_SIZE 37
|
#define ICON_SIZE 37
|
||||||
|
|
||||||
|
|
||||||
static const uint32 kMsgInterfaceReconfigure = 'ifre';
|
|
||||||
|
|
||||||
class InterfaceListItem : public BListItem {
|
class InterfaceListItem : public BListItem {
|
||||||
public:
|
public:
|
||||||
InterfaceListItem(const char* name);
|
InterfaceListItem(const char* name);
|
||||||
@@ -85,7 +83,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
virtual void MouseDown(BPoint point);
|
virtual void FrameResized(float width, float height);
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user