added package icon

added a InstallerCopyLoopControl class


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14243 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2005-09-26 15:04:52 +00:00
parent f4d7a7b4bd
commit 18c5b74250
5 changed files with 65 additions and 7 deletions
@@ -0,0 +1,16 @@
/*
* Copyright 2005, Jérôme Duval. All rights reserved.
* Distributed under the terms of the MIT License.
*
*/
#include "InstallerCopyLoopControl.h"
InstallerCopyLoopControl::InstallerCopyLoopControl()
: CopyLoopControl()
{
}
InstallerCopyLoopControl::~InstallerCopyLoopControl(void)
{
}
@@ -0,0 +1,21 @@
/*
* Copyright 2005, Jérôme Duval. All rights reserved.
* Distributed under the terms of the MIT License.
*
*/
#ifndef _INSTALLERCOPYLOOPCONTROL_H
#define _INSTALLERCOPYLOOPCONTROL_H
#include "FSUtils.h"
class InstallerCopyLoopControl : public CopyLoopControl
{
public:
InstallerCopyLoopControl();
~InstallerCopyLoopControl(void);
private:
};
#endif
+3 -1
View File
@@ -1,14 +1,16 @@
SubDir OBOS_TOP src apps installer ; SubDir OBOS_TOP src apps installer ;
UsePrivateHeaders shared ; UsePrivateHeaders shared ;
UsePrivateHeaders tracker ;
SubDirHdrs [ FDirName $(OBOS_TOP) src kits tracker ] ; SubDirHdrs [ FDirName $(OBOS_TOP) src kits tracker ] ;
App Installer : App Installer :
DrawButton.cpp DrawButton.cpp
InstallerApp.cpp InstallerApp.cpp
InstallerCopyLoopControl.cpp
InstallerWindow.cpp InstallerWindow.cpp
PackageViews.cpp PackageViews.cpp
PartitionMenuItem.cpp PartitionMenuItem.cpp
: be tracker : libbe.so libtracker.so
: Installer.rdef ; : Installer.rdef ;
+19 -1
View File
@@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include <fs_attr.h>
#include <Directory.h> #include <Directory.h>
#include <ScrollBar.h> #include <ScrollBar.h>
#include <String.h> #include <String.h>
@@ -10,6 +11,8 @@
#include <View.h> #include <View.h>
#include "PackageViews.h" #include "PackageViews.h"
#define ICON_ATTRIBUTE "INSTALLER PACKAGE: ICON"
Package::Package() Package::Package()
: Group(), : Group(),
fName(NULL), fName(NULL),
@@ -25,7 +28,7 @@ Package::~Package()
{ {
free(fName); free(fName);
free(fDescription); free(fDescription);
free(fIcon); delete fIcon;
} }
@@ -60,6 +63,16 @@ Package::PackageFromEntry(BEntry &entry)
package->SetSize(size); package->SetSize(size);
package->SetAlwaysOn(alwaysOn); package->SetAlwaysOn(alwaysOn);
package->SetOnByDefault(onByDefault); package->SetOnByDefault(onByDefault);
attr_info info;
if (directory.GetAttrInfo(ICON_ATTRIBUTE, &info) == B_OK) {
char buffer[info.size];
BMessage msg;
if ((directory.ReadAttr(ICON_ATTRIBUTE, info.type, 0, buffer, info.size) == info.size)
&& (msg.Unflatten(buffer) == B_OK)) {
package->SetIcon(new BBitmap(&msg));
}
}
return package; return package;
err: err:
delete package; delete package;
@@ -117,6 +130,10 @@ PackageCheckBox::Draw(BRect update)
fPackage.GetSizeAsString(string); fPackage.GetSizeAsString(string);
float width = StringWidth(string); float width = StringWidth(string);
DrawString(string, BPoint(Bounds().right - width - 8, 11)); DrawString(string, BPoint(Bounds().right - width - 8, 11));
const BBitmap *icon = fPackage.Icon();
if (icon)
DrawBitmap(icon, BPoint(Bounds().right - 92, 0));
} }
GroupView::GroupView(BRect rect, Group &group) GroupView::GroupView(BRect rect, Group &group)
@@ -126,6 +143,7 @@ GroupView::GroupView(BRect rect, Group &group)
SetFont(be_bold_font); SetFont(be_bold_font);
} }
GroupView::~GroupView() GroupView::~GroupView()
{ {
} }
+6 -5
View File
@@ -6,6 +6,7 @@
#ifndef __PACKAGEVIEWS_H__ #ifndef __PACKAGEVIEWS_H__
#define __PACKAGEVIEWS_H__ #define __PACKAGEVIEWS_H__
#include <Bitmap.h>
#include <CheckBox.h> #include <CheckBox.h>
#include <List.h> #include <List.h>
#include <StringView.h> #include <StringView.h>
@@ -30,7 +31,7 @@ public:
void SetName(const char *name) { free(fName); fName=strdup(name);}; void SetName(const char *name) { free(fName); fName=strdup(name);};
void SetDescription(const char *description) { free(fDescription); fDescription=strdup(description);}; void SetDescription(const char *description) { free(fDescription); fDescription=strdup(description);};
void SetSize(const int32 size) { fSize = size; }; void SetSize(const int32 size) { fSize = size; };
void SetIcon(const BBitmap * icon); void SetIcon(BBitmap * icon) { delete fIcon; fIcon = icon; };
void SetOnByDefault(bool onByDefault) { fOnByDefault = onByDefault; }; void SetOnByDefault(bool onByDefault) { fOnByDefault = onByDefault; };
void SetAlwaysOn(bool alwaysOn) { fAlwaysOn = alwaysOn; }; void SetAlwaysOn(bool alwaysOn) { fAlwaysOn = alwaysOn; };
const char * Name() const { return fName; }; const char * Name() const { return fName; };
@@ -54,8 +55,8 @@ private:
class PackageCheckBox : public BCheckBox { class PackageCheckBox : public BCheckBox {
public: public:
PackageCheckBox(BRect rect, Package &item); PackageCheckBox(BRect rect, Package &item);
~PackageCheckBox(); virtual ~PackageCheckBox();
void Draw(BRect update); virtual void Draw(BRect update);
private: private:
Package &fPackage; Package &fPackage;
}; };
@@ -63,7 +64,7 @@ class PackageCheckBox : public BCheckBox {
class GroupView : public BStringView { class GroupView : public BStringView {
public: public:
GroupView(BRect rect, Group &group); GroupView(BRect rect, Group &group);
~GroupView(); virtual ~GroupView();
private: private:
Group &fGroup; Group &fGroup;
@@ -73,7 +74,7 @@ class GroupView : public BStringView {
class PackagesView : public BView { class PackagesView : public BView {
public: public:
PackagesView(BRect rect, const char* name); PackagesView(BRect rect, const char* name);
~PackagesView(); virtual ~PackagesView();
void Clean(); void Clean();
void AddPackages(BList &list); void AddPackages(BList &list);
private: private: