Added a playlist class which will be later used for handling tracks CD music will stop on quit to avoid confusing users Added pause up/down images to resource file Style tweaks to some files git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13324 a95241bf-73f2-0310-859d-f6bbb57e9c96
83 lines
1.2 KiB
C++
83 lines
1.2 KiB
C++
#include "DrawButton.h"
|
|
|
|
DrawButton::DrawButton(BRect frame, const char *name, BBitmap *up, BBitmap *down,
|
|
BMessage *msg, int32 resize, int32 flags)
|
|
: BButton(frame, name, "", msg, resize, flags)
|
|
{
|
|
fUp=up;
|
|
fDown=down;
|
|
fDisabled=NULL;
|
|
}
|
|
|
|
DrawButton::~DrawButton(void)
|
|
{
|
|
delete fUp;
|
|
delete fDown;
|
|
delete fDisabled;
|
|
}
|
|
|
|
void
|
|
DrawButton::SetBitmaps(BBitmap *up, BBitmap *down)
|
|
{
|
|
delete fUp;
|
|
delete fDown;
|
|
|
|
fUp=up;
|
|
fDown=down;
|
|
|
|
if(IsEnabled())
|
|
Invalidate();
|
|
}
|
|
|
|
void
|
|
DrawButton::SetDisabled(BBitmap *disabled)
|
|
{
|
|
delete fDisabled;
|
|
|
|
fDisabled=disabled;
|
|
|
|
if(!IsEnabled())
|
|
Invalidate();
|
|
}
|
|
|
|
void
|
|
DrawButton::Draw(BRect update)
|
|
{
|
|
if(!IsEnabled())
|
|
{
|
|
if(fDisabled)
|
|
DrawBitmap(fDisabled, BPoint(0,0));
|
|
else
|
|
StrokeRect(Bounds());
|
|
return;
|
|
}
|
|
|
|
if(Value() == B_CONTROL_ON)
|
|
{
|
|
if(fDown)
|
|
DrawBitmap(fDown, BPoint(0,0));
|
|
else
|
|
StrokeRect(Bounds());
|
|
}
|
|
else
|
|
{
|
|
if(fUp)
|
|
DrawBitmap(fUp, BPoint(0,0));
|
|
else
|
|
StrokeRect(Bounds());
|
|
}
|
|
}
|
|
|
|
void
|
|
DrawButton::ResizeToPreferred(void)
|
|
{
|
|
if(fUp)
|
|
ResizeTo(fUp->Bounds().Width(),fUp->Bounds().Height());
|
|
else
|
|
if(fDown)
|
|
ResizeTo(fDown->Bounds().Width(),fDown->Bounds().Height());
|
|
else
|
|
if(fDisabled)
|
|
ResizeTo(fDisabled->Bounds().Width(),fDisabled->Bounds().Height());
|
|
}
|