* Changed the signature of UpdateText() to return a "const char*" (char*

really makes no sense if the pointer belongs to the derived class and
  only confuses). Note this change does not affect binary compatibility.
* Introduced a new MaxUpdateTextWidth() virtual method which is really
  necessary to handle the update text correctly in the layout.
* Introduced a new UpdateTextChanged() method which can be called to
  notify the control of a changed update text. Internally, SetValue()
  also uses it.
* Handle the width or height of the UpdateText() correctly in the layout.
  For horizontal layout, the width was forgotten to be included in
  GetPreferredSize(), for vertical layout, it was completely broken before.
* Handle invalidation correctly when the UpdateText() changes.
* Remove the arbitrary insets for labels from the border the control. This
  makes it easier to align the control's labels with other controls.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26447 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-07-16 18:37:44 +00:00
parent 06688259b6
commit 1ae794159a
2 changed files with 201 additions and 118 deletions
+9 -5
View File
@@ -91,7 +91,8 @@ class BSlider : public BControl {
virtual void DrawThumb();
virtual void DrawFocusMark();
virtual void DrawText();
virtual char* UpdateText() const;
virtual const char* UpdateText() const;
void UpdateTextChanged();
virtual BRect BarFrame() const;
virtual BRect HashMarksFrame() const;
@@ -145,6 +146,8 @@ class BSlider : public BControl {
virtual void SetLimits(int32 minimum, int32 maximum);
virtual float MaxUpdateTextWidth();
virtual void InvalidateLayout(bool descendants = false);
virtual BSize MinSize();
@@ -164,7 +167,6 @@ class BSlider : public BControl {
BSize _ValidateMinSize();
virtual void _ReservedSlider5();
virtual void _ReservedSlider6();
virtual void _ReservedSlider7();
virtual void _ReservedSlider8();
@@ -187,7 +189,7 @@ class BSlider : public BControl {
char* fMinLimitLabel;
char* fMaxLimitLabel;
char* fUpdateText;
const char* fUpdateText;
int32 fMinValue;
int32 fMaxValue;
@@ -211,10 +213,12 @@ class BSlider : public BControl {
BSize fMinSize;
float fMaxUpdateTextWidth;
#if USE_OFF_SCREEN_VIEW
uint32 _reserved[5];
uint32 _reserved[4];
#else
uint32 _reserved[7];
uint32 _reserved[6];
#endif
};