Commit often, commit small...
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8861 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
33efb91915
commit
606359d937
@ -1,15 +1,19 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <kernel/image.h>
|
||||
#include <storage/Resources.h>
|
||||
|
||||
#include "NetworkSetupAddOn.h"
|
||||
|
||||
|
||||
NetworkSetupAddOn::NetworkSetupAddOn(image_id image)
|
||||
: is_dirty(false), profile(NULL), addon_image(image)
|
||||
: m_is_dirty(false), m_profile(NULL), m_addon_image(image), m_addon_resources(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
NetworkSetupAddOn::~NetworkSetupAddOn()
|
||||
{
|
||||
delete m_addon_resources;
|
||||
}
|
||||
|
||||
BView * NetworkSetupAddOn::CreateView(BRect *bounds)
|
||||
@ -34,7 +38,7 @@ status_t NetworkSetupAddOn::Revert()
|
||||
|
||||
status_t NetworkSetupAddOn::ProfileChanged(NetworkSetupProfile *new_profile)
|
||||
{
|
||||
profile = new_profile;
|
||||
m_profile = new_profile;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -43,3 +47,24 @@ const char * NetworkSetupAddOn::Name()
|
||||
return "Dummy NetworkSetupAddon";
|
||||
}
|
||||
|
||||
BResources * NetworkSetupAddOn::Resources()
|
||||
{
|
||||
if (!m_addon_resources) {
|
||||
image_info info;
|
||||
if (get_image_info(m_addon_image, &info) != B_OK)
|
||||
return NULL;
|
||||
|
||||
BResources *resources = new BResources();
|
||||
BFile addon_file(info.name, O_RDONLY);
|
||||
if (resources->SetTo(&addon_file) == B_OK)
|
||||
m_addon_resources = resources;
|
||||
else
|
||||
delete resources;
|
||||
};
|
||||
return m_addon_resources;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#ifndef NETWORKSETUPADDON_H
|
||||
#define NETWORKSETUPADDON_H
|
||||
|
||||
#include <View.h>
|
||||
#include <interface/View.h>
|
||||
#include <kernel/image.h> // for image_id
|
||||
#include <storage/Resources.h>
|
||||
|
||||
class NetworkSetupProfile;
|
||||
|
||||
@ -23,18 +24,20 @@ class NetworkSetupAddOn {
|
||||
NetworkSetupProfile * Profile();
|
||||
bool IsDirty();
|
||||
void SetDirty(bool dirty = true);
|
||||
image_id AddonImageId();
|
||||
image_id ImageId();
|
||||
BResources * Resources();
|
||||
|
||||
private:
|
||||
bool is_dirty;
|
||||
NetworkSetupProfile * profile;
|
||||
image_id addon_image;
|
||||
bool m_is_dirty;
|
||||
NetworkSetupProfile * m_profile;
|
||||
image_id m_addon_image;
|
||||
BResources * m_addon_resources;
|
||||
};
|
||||
|
||||
inline bool NetworkSetupAddOn::IsDirty() { return is_dirty; };
|
||||
inline void NetworkSetupAddOn::SetDirty(bool dirty) { is_dirty = dirty; };
|
||||
inline NetworkSetupProfile * NetworkSetupAddOn::Profile() { return profile; };
|
||||
inline image_id NetworkSetupAddOn::AddonImageId() { return addon_image; };
|
||||
inline bool NetworkSetupAddOn::IsDirty() { return m_is_dirty; };
|
||||
inline void NetworkSetupAddOn::SetDirty(bool dirty) { m_is_dirty = dirty; };
|
||||
inline NetworkSetupProfile * NetworkSetupAddOn::Profile() { return m_profile; };
|
||||
inline image_id NetworkSetupAddOn::ImageId() { return m_addon_image; };
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
@ -143,7 +143,7 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
||||
fHelpButton = button;
|
||||
#endif
|
||||
|
||||
r.top += h + SMALL_MARGIN;
|
||||
r.top += h + V_MARGIN;
|
||||
r.left = H_MARGIN;
|
||||
|
||||
fPanel = new BBox(r, "showview_box", B_FOLLOW_ALL,
|
||||
@ -228,7 +228,7 @@ void NetworkSetupWindow::MessageReceived
|
||||
|
||||
fPanel->AddChild(fAddonView);
|
||||
fAddonView->ResizeTo(fPanel->Bounds().Width(), fPanel->Bounds().Height());
|
||||
fAddonView->SetViewColor((rand() % 256), (rand() % 256), (rand() % 256));
|
||||
// fAddonView->SetViewColor((rand() % 256), (rand() % 256), (rand() % 256));
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user