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 ----------------------------------------------------------- // Standard Includes -----------------------------------------------------------
#include <string.h> #include <string.h>
#include <malloc.h>
// System Includes ------------------------------------------------------------- // System Includes -------------------------------------------------------------
#include <Control.h> #include <Control.h>
@@ -104,7 +105,7 @@ BControl::BControl(BRect frame, const char *name, const char *label, BMessage *m
BControl::~BControl() BControl::~BControl()
{ {
if (fLabel) if (fLabel)
delete fLabel; free(fLabel);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
BControl::BControl(BMessage *archive) : BView(archive) BControl::BControl(BMessage *archive) : BView(archive)
@@ -175,7 +176,13 @@ status_t BControl::Archive(BMessage *archive, bool deep) const
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void BControl::WindowActivated(bool active) void BControl::WindowActivated(bool active)
{ {
// TODO: redraw if focus // Should we check this?
if (Window())
{
Draw(Bounds());
Flush();
}
BView::WindowActivated(active); BView::WindowActivated(active);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -277,11 +284,14 @@ void BControl::MakeFocus(bool focused)
{ {
BView::MakeFocus(focused); BView::MakeFocus(focused);
if(Window())
{
fFocusChanging = true; fFocusChanging = true;
Draw(Bounds()); Draw(Bounds());
Flush(); Flush();
fFocusChanging = false; fFocusChanging = false;
} }
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void BControl::KeyDown(const char *bytes, int32 numBytes) void BControl::KeyDown(const char *bytes, int32 numBytes)
{ {
@@ -351,7 +361,7 @@ void BControl::DetachedFromWindow()
void BControl::SetLabel(const char *string) void BControl::SetLabel(const char *string)
{ {
if (fLabel) if (fLabel)
delete fLabel; free(fLabel);
fLabel = strdup(string); fLabel = strdup(string);
@@ -370,7 +380,11 @@ void BControl::SetValue(int32 value)
fValue = value; fValue = value;
Invalidate(); if (Window())
{
Draw(Bounds());
Flush();
}
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int32 BControl::Value() const int32 BControl::Value() const
@@ -390,7 +404,11 @@ void BControl::SetEnabled(bool enabled)
else else
BView::SetFlags(Flags() & ~B_NAVIGABLE); BView::SetFlags(Flags() & ~B_NAVIGABLE);
Invalidate(); if (Window())
{
Draw(Bounds());
Flush();
}
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool BControl::IsEnabled() const bool BControl::IsEnabled() const