* Removed trailing spaces in ScrollBar.h

* It's not a good idea to archive fProportion as int32, seeing it's a float
  on [0..1].
* Implemented archive constructor for BScrollBar. Untested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24832 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-04-06 15:11:31 +00:00
parent 658aafcb62
commit 6a1d169c52
2 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -112,7 +112,7 @@ class BScrollBar : public BView {
float fLargeStep; float fLargeStep;
float fValue; float fValue;
float fProportion; float fProportion;
BView* fTarget; BView* fTarget;
orientation fOrientation; orientation fOrientation;
char* fTargetName; char* fTargetName;
+19 -1
View File
@@ -199,6 +199,24 @@ BScrollBar::BScrollBar(BRect frame, const char* name, BView *target,
BScrollBar::BScrollBar(BMessage *data) BScrollBar::BScrollBar(BMessage *data)
: BView(data) : BView(data)
{ {
if (data->FindFloat("_range", 0, &fMin) < B_OK)
fMin = 0.0;
if (data->FindFloat("_range", 1, &fMax) < B_OK)
fMax = 0.0;
if (data->FindFloat("_steps", 0, &fSmallStep) < B_OK)
fSmallStep = 1.0;
if (data->FindFloat("_steps", 1, &fLargeStep) < B_OK)
fSmallStep = 10.0;
if (data->FindFloat("_val", &fValue) < B_OK)
fValue = 0.0;
int32 orientation;
if (data->FindInt32("_orient", &orientation) < B_OK)
fOrientation = B_VERTICAL;
else
fOrientation = (enum orientation)orientation;
if (data->FindFloat("_prop", &fProportion) < B_OK)
fProportion = 0.0;
} }
@@ -248,7 +266,7 @@ BScrollBar::Archive(BMessage *data, bool deep) const
err = data->AddInt32("_orient", (int32)fOrientation); err = data->AddInt32("_orient", (int32)fOrientation);
if (err != B_OK) if (err != B_OK)
return err; return err;
err = data->AddInt32("_prop", (int32)fProportion); err = data->AddFloat("_prop", fProportion);
return err; return err;
} }