diff --git a/headers/os/interface/ControlLook.h b/headers/os/interface/ControlLook.h index ec4476248e..6de91e289d 100644 --- a/headers/os/interface/ControlLook.h +++ b/headers/os/interface/ControlLook.h @@ -84,8 +84,9 @@ public: B_IGNORE_OUTLINE = 1 << 6, B_PARTIALLY_ACTIVATED = 1 << 7, // like B_ACTIVATED, but for tri-state B_FLAT = 1 << 8, // flat look (e.g. button background) + B_INVALID = 1 << 9, // invalid value, use B_FAILURE_COLOR - B_BLEND_FRAME = 1 << 16 + B_BLEND_FRAME = 1 << 16, }; virtual BAlignment DefaultLabelAlignment() const; diff --git a/headers/os/interface/TextControl.h b/headers/os/interface/TextControl.h index 05bf6dec3b..95906b32ed 100644 --- a/headers/os/interface/TextControl.h +++ b/headers/os/interface/TextControl.h @@ -40,6 +40,7 @@ public: virtual void SetText(const char* text); const char* Text() const; + void MarkAsInvalid(bool invalid); virtual void SetValue(int32 value); virtual status_t Invoke(BMessage* message = NULL); @@ -139,8 +140,9 @@ private: float fDivider; LayoutData* fLayoutData; + uint32 fLook; - uint32 _reserved[9]; + uint32 _reserved[8]; }; #endif // _TEXT_CONTROL_H diff --git a/src/kits/interface/TextControl.cpp b/src/kits/interface/TextControl.cpp index f4828d670b..caabbbed37 100644 --- a/src/kits/interface/TextControl.cpp +++ b/src/kits/interface/TextControl.cpp @@ -333,6 +333,16 @@ BTextControl::Text() const } +void +BTextControl::MarkAsInvalid(bool invalid) +{ + if (invalid) + fLook |= BControlLook::B_INVALID; + else + fLook &= ~BControlLook::B_INVALID; +} + + void BTextControl::SetValue(int32 value) { @@ -425,7 +435,7 @@ BTextControl::Draw(BRect updateRect) if (be_control_look != NULL) { rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); - uint32 flags = 0; + uint32 flags = fLook; if (!enabled) flags |= BControlLook::B_DISABLED; if (active) @@ -1122,6 +1132,8 @@ BTextControl::_InitData(const char* label, const BMessage* archive) if (label) fDivider = floorf(bounds.Width() / 2.0f); + + fLook = 0; }