* Moved WirelessNetworkMenuItem into its own file.
* Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39833 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -15,6 +15,8 @@ Application NetworkStatus :
|
|||||||
NetworkStatusView.cpp
|
NetworkStatusView.cpp
|
||||||
NetworkStatus.cpp
|
NetworkStatus.cpp
|
||||||
RadioView.cpp
|
RadioView.cpp
|
||||||
|
WirelessNetworkMenuItem.cpp
|
||||||
|
|
||||||
: be $(HAIKU_LOCALE_LIBS) $(icon_libs) $(TARGET_NETWORK_LIBS)
|
: be $(HAIKU_LOCALE_LIBS) $(icon_libs) $(TARGET_NETWORK_LIBS)
|
||||||
libbnetapi.so $(TARGET_LIBSTDC++)
|
libbnetapi.so $(TARGET_LIBSTDC++)
|
||||||
: NetworkStatus.rdef NetworkStatusIcons.rdef
|
: NetworkStatus.rdef NetworkStatusIcons.rdef
|
||||||
|
|||||||
@@ -66,9 +66,10 @@ our_image(image_info& image)
|
|||||||
|
|
||||||
|
|
||||||
NetworkStatus::NetworkStatus()
|
NetworkStatus::NetworkStatus()
|
||||||
: BApplication(kSignature),
|
:
|
||||||
fAutoInstallInDeskbar(false),
|
BApplication(kSignature),
|
||||||
fQuitImmediately(false)
|
fAutoInstallInDeskbar(false),
|
||||||
|
fQuitImmediately(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
#include "NetworkStatus.h"
|
#include "NetworkStatus.h"
|
||||||
#include "NetworkStatusIcons.h"
|
#include "NetworkStatusIcons.h"
|
||||||
#include "RadioView.h"
|
#include "RadioView.h"
|
||||||
|
#include "WirelessNetworkMenuItem.h"
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_CONTEXT
|
#undef B_TRANSLATE_CONTEXT
|
||||||
@@ -70,31 +71,6 @@ const uint32 kMinIconWidth = 16;
|
|||||||
const uint32 kMinIconHeight = 16;
|
const uint32 kMinIconHeight = 16;
|
||||||
|
|
||||||
|
|
||||||
class WirelessNetworkMenuItem : public BMenuItem {
|
|
||||||
public:
|
|
||||||
WirelessNetworkMenuItem(const char* name,
|
|
||||||
int32 signalQuality, bool encrypted,
|
|
||||||
BMessage* message);
|
|
||||||
virtual ~WirelessNetworkMenuItem();
|
|
||||||
|
|
||||||
void SetSignalQuality(int32 quality);
|
|
||||||
int32 SignalQuality() const
|
|
||||||
{ return fQuality; }
|
|
||||||
bool IsEncrypted() const
|
|
||||||
{ return fIsEncrypted; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void DrawContent();
|
|
||||||
virtual void Highlight(bool isHighlighted);
|
|
||||||
virtual void GetContentSize(float* width, float* height);
|
|
||||||
void DrawRadioIcon();
|
|
||||||
|
|
||||||
private:
|
|
||||||
int32 fQuality;
|
|
||||||
bool fIsEncrypted;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class SocketOpener {
|
class SocketOpener {
|
||||||
public:
|
public:
|
||||||
SocketOpener()
|
SocketOpener()
|
||||||
@@ -122,66 +98,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - WirelessNetworkMenuItem
|
|
||||||
|
|
||||||
|
|
||||||
WirelessNetworkMenuItem::WirelessNetworkMenuItem(const char* name,
|
|
||||||
int32 signalQuality, bool encrypted, BMessage* message)
|
|
||||||
:
|
|
||||||
BMenuItem(name, message),
|
|
||||||
fQuality(signalQuality),
|
|
||||||
fIsEncrypted(encrypted)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WirelessNetworkMenuItem::~WirelessNetworkMenuItem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
WirelessNetworkMenuItem::SetSignalQuality(int32 quality)
|
|
||||||
{
|
|
||||||
fQuality = quality;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
WirelessNetworkMenuItem::DrawContent()
|
|
||||||
{
|
|
||||||
DrawRadioIcon();
|
|
||||||
BMenuItem::DrawContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
WirelessNetworkMenuItem::Highlight(bool isHighlighted)
|
|
||||||
{
|
|
||||||
BMenuItem::Highlight(isHighlighted);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
WirelessNetworkMenuItem::GetContentSize(float* width, float* height)
|
|
||||||
{
|
|
||||||
BMenuItem::GetContentSize(width, height);
|
|
||||||
*width += *height + 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
WirelessNetworkMenuItem::DrawRadioIcon()
|
|
||||||
{
|
|
||||||
BRect bounds = Frame();
|
|
||||||
bounds.left = bounds.right - 4 - bounds.Height();
|
|
||||||
bounds.right -= 4;
|
|
||||||
bounds.bottom -= 2;
|
|
||||||
|
|
||||||
RadioView::Draw(Menu(), bounds, fQuality, RadioView::DefaultMax());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010, Axel Dörfler, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "WirelessNetworkMenuItem.h"
|
||||||
|
|
||||||
|
#include "RadioView.h"
|
||||||
|
|
||||||
|
|
||||||
|
WirelessNetworkMenuItem::WirelessNetworkMenuItem(const char* name,
|
||||||
|
int32 signalQuality, bool encrypted, BMessage* message)
|
||||||
|
:
|
||||||
|
BMenuItem(name, message),
|
||||||
|
fQuality(signalQuality),
|
||||||
|
fIsEncrypted(encrypted)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WirelessNetworkMenuItem::~WirelessNetworkMenuItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WirelessNetworkMenuItem::SetSignalQuality(int32 quality)
|
||||||
|
{
|
||||||
|
fQuality = quality;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WirelessNetworkMenuItem::DrawContent()
|
||||||
|
{
|
||||||
|
DrawRadioIcon();
|
||||||
|
BMenuItem::DrawContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WirelessNetworkMenuItem::Highlight(bool isHighlighted)
|
||||||
|
{
|
||||||
|
BMenuItem::Highlight(isHighlighted);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WirelessNetworkMenuItem::GetContentSize(float* width, float* height)
|
||||||
|
{
|
||||||
|
BMenuItem::GetContentSize(width, height);
|
||||||
|
*width += *height + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
WirelessNetworkMenuItem::DrawRadioIcon()
|
||||||
|
{
|
||||||
|
BRect bounds = Frame();
|
||||||
|
bounds.left = bounds.right - 4 - bounds.Height();
|
||||||
|
bounds.right -= 4;
|
||||||
|
bounds.bottom -= 2;
|
||||||
|
|
||||||
|
RadioView::Draw(Menu(), bounds, fQuality, RadioView::DefaultMax());
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010, Axel Dörfler, axeld@pinc-software.de.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef WIRELESS_NETWORK_MENU_ITEM_H
|
||||||
|
#define WIRELESS_NETWORK_MENU_ITEM_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <MenuItem.h>
|
||||||
|
|
||||||
|
|
||||||
|
class WirelessNetworkMenuItem : public BMenuItem {
|
||||||
|
public:
|
||||||
|
WirelessNetworkMenuItem(const char* name,
|
||||||
|
int32 signalQuality, bool encrypted,
|
||||||
|
BMessage* message);
|
||||||
|
virtual ~WirelessNetworkMenuItem();
|
||||||
|
|
||||||
|
void SetSignalQuality(int32 quality);
|
||||||
|
int32 SignalQuality() const
|
||||||
|
{ return fQuality; }
|
||||||
|
bool IsEncrypted() const
|
||||||
|
{ return fIsEncrypted; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DrawContent();
|
||||||
|
virtual void Highlight(bool isHighlighted);
|
||||||
|
virtual void GetContentSize(float* width, float* height);
|
||||||
|
void DrawRadioIcon();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int32 fQuality;
|
||||||
|
bool fIsEncrypted;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // WIRELESS_NETWORK_MENU_ITEM_H
|
||||||
Reference in New Issue
Block a user