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:
parent
f4d7a7b4bd
commit
18c5b74250
16
src/apps/installer/InstallerCopyLoopControl.cpp
Normal file
16
src/apps/installer/InstallerCopyLoopControl.cpp
Normal file
@ -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)
|
||||
{
|
||||
}
|
21
src/apps/installer/InstallerCopyLoopControl.h
Normal file
21
src/apps/installer/InstallerCopyLoopControl.h
Normal file
@ -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
|
@ -1,14 +1,16 @@
|
||||
SubDir OBOS_TOP src apps installer ;
|
||||
|
||||
UsePrivateHeaders shared ;
|
||||
UsePrivateHeaders tracker ;
|
||||
SubDirHdrs [ FDirName $(OBOS_TOP) src kits tracker ] ;
|
||||
|
||||
App Installer :
|
||||
DrawButton.cpp
|
||||
InstallerApp.cpp
|
||||
InstallerCopyLoopControl.cpp
|
||||
InstallerWindow.cpp
|
||||
PackageViews.cpp
|
||||
PartitionMenuItem.cpp
|
||||
: be tracker
|
||||
: libbe.so libtracker.so
|
||||
: Installer.rdef ;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <fs_attr.h>
|
||||
#include <Directory.h>
|
||||
#include <ScrollBar.h>
|
||||
#include <String.h>
|
||||
@ -10,6 +11,8 @@
|
||||
#include <View.h>
|
||||
#include "PackageViews.h"
|
||||
|
||||
#define ICON_ATTRIBUTE "INSTALLER PACKAGE: ICON"
|
||||
|
||||
Package::Package()
|
||||
: Group(),
|
||||
fName(NULL),
|
||||
@ -25,7 +28,7 @@ Package::~Package()
|
||||
{
|
||||
free(fName);
|
||||
free(fDescription);
|
||||
free(fIcon);
|
||||
delete fIcon;
|
||||
}
|
||||
|
||||
|
||||
@ -60,6 +63,16 @@ Package::PackageFromEntry(BEntry &entry)
|
||||
package->SetSize(size);
|
||||
package->SetAlwaysOn(alwaysOn);
|
||||
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;
|
||||
err:
|
||||
delete package;
|
||||
@ -117,6 +130,10 @@ PackageCheckBox::Draw(BRect update)
|
||||
fPackage.GetSizeAsString(string);
|
||||
float width = StringWidth(string);
|
||||
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)
|
||||
@ -126,6 +143,7 @@ GroupView::GroupView(BRect rect, Group &group)
|
||||
SetFont(be_bold_font);
|
||||
}
|
||||
|
||||
|
||||
GroupView::~GroupView()
|
||||
{
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#ifndef __PACKAGEVIEWS_H__
|
||||
#define __PACKAGEVIEWS_H__
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <CheckBox.h>
|
||||
#include <List.h>
|
||||
#include <StringView.h>
|
||||
@ -30,7 +31,7 @@ public:
|
||||
void SetName(const char *name) { free(fName); fName=strdup(name);};
|
||||
void SetDescription(const char *description) { free(fDescription); fDescription=strdup(description);};
|
||||
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 SetAlwaysOn(bool alwaysOn) { fAlwaysOn = alwaysOn; };
|
||||
const char * Name() const { return fName; };
|
||||
@ -54,8 +55,8 @@ private:
|
||||
class PackageCheckBox : public BCheckBox {
|
||||
public:
|
||||
PackageCheckBox(BRect rect, Package &item);
|
||||
~PackageCheckBox();
|
||||
void Draw(BRect update);
|
||||
virtual ~PackageCheckBox();
|
||||
virtual void Draw(BRect update);
|
||||
private:
|
||||
Package &fPackage;
|
||||
};
|
||||
@ -63,7 +64,7 @@ class PackageCheckBox : public BCheckBox {
|
||||
class GroupView : public BStringView {
|
||||
public:
|
||||
GroupView(BRect rect, Group &group);
|
||||
~GroupView();
|
||||
virtual ~GroupView();
|
||||
private:
|
||||
Group &fGroup;
|
||||
|
||||
@ -73,7 +74,7 @@ class GroupView : public BStringView {
|
||||
class PackagesView : public BView {
|
||||
public:
|
||||
PackagesView(BRect rect, const char* name);
|
||||
~PackagesView();
|
||||
virtual ~PackagesView();
|
||||
void Clean();
|
||||
void AddPackages(BList &list);
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user