Some fixes

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1343 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marc Flerackers
2002-10-02 12:06:16 +00:00
parent a0cbca4f9f
commit fb4bf99df7
+23 -5
View File
@@ -26,6 +26,7 @@
// Standard Includes -----------------------------------------------------------
#include <string.h>
#include <malloc.h>
// System Includes -------------------------------------------------------------
#include <Control.h>
@@ -104,7 +105,7 @@ BControl::BControl(BRect frame, const char *name, const char *label, BMessage *m
BControl::~BControl()
{
if (fLabel)
delete fLabel;
free(fLabel);
}
//------------------------------------------------------------------------------
BControl::BControl(BMessage *archive) : BView(archive)
@@ -175,7 +176,13 @@ status_t BControl::Archive(BMessage *archive, bool deep) const
//------------------------------------------------------------------------------
void BControl::WindowActivated(bool active)
{
// TODO: redraw if focus
// Should we check this?
if (Window())
{
Draw(Bounds());
Flush();
}
BView::WindowActivated(active);
}
//------------------------------------------------------------------------------
@@ -277,11 +284,14 @@ void BControl::MakeFocus(bool focused)
{
BView::MakeFocus(focused);
if(Window())
{
fFocusChanging = true;
Draw(Bounds());
Flush();
fFocusChanging = false;
}
}
//------------------------------------------------------------------------------
void BControl::KeyDown(const char *bytes, int32 numBytes)
{
@@ -351,7 +361,7 @@ void BControl::DetachedFromWindow()
void BControl::SetLabel(const char *string)
{
if (fLabel)
delete fLabel;
free(fLabel);
fLabel = strdup(string);
@@ -370,7 +380,11 @@ void BControl::SetValue(int32 value)
fValue = value;
Invalidate();
if (Window())
{
Draw(Bounds());
Flush();
}
}
//------------------------------------------------------------------------------
int32 BControl::Value() const
@@ -390,7 +404,11 @@ void BControl::SetEnabled(bool enabled)
else
BView::SetFlags(Flags() & ~B_NAVIGABLE);
Invalidate();
if (Window())
{
Draw(Bounds());
Flush();
}
}
//------------------------------------------------------------------------------
bool BControl::IsEnabled() const