Tracker: style fixes to WidgetAttributeText

This commit is contained in:
John Scipione 2014-06-20 19:26:06 -04:00
parent 69e5768d45
commit 92199e801c
2 changed files with 284 additions and 255 deletions

View File

@ -240,40 +240,54 @@ WidgetAttributeText::NewWidgetText(const Model* model,
if (strcmp(attrName, kAttrPath) == 0)
return new PathAttributeText(model, column);
if (strcmp(attrName, kAttrMIMEType) == 0)
return new KindAttributeText(model, column);
if (strcmp(attrName, kAttrStatName) == 0)
return new NameAttributeText(model, column);
if (strcmp(attrName, kAttrRealName) == 0)
return new RealNameAttributeText(model, column);
if (strcmp(attrName, kAttrStatSize) == 0)
return new SizeAttributeText(model, column);
if (strcmp(attrName, kAttrStatModified) == 0)
return new ModificationTimeAttributeText(model, column);
if (strcmp(attrName, kAttrStatCreated) == 0)
return new CreationTimeAttributeText(model, column);
#ifdef OWNER_GROUP_ATTRIBUTES
if (strcmp(attrName, kAttrStatOwner) == 0)
return new OwnerAttributeText(model, column);
if (strcmp(attrName, kAttrStatGroup) == 0)
return new GroupAttributeText(model, column);
#endif
if (strcmp(attrName, kAttrStatMode) == 0)
return new ModeAttributeText(model, column);
if (strcmp(attrName, kAttrOpenWithRelation) == 0)
return new OpenWithRelationAttributeText(model, column, view);
if (strcmp(attrName, kAttrAppVersion) == 0)
return new AppShortVersionAttributeText(model, column);
if (strcmp(attrName, kAttrSystemVersion) == 0)
return new SystemShortVersionAttributeText(model, column);
if (strcmp(attrName, kAttrOriginalPath) == 0)
return new OriginalPathAttributeText(model, column);
if (column->DisplayAs() != NULL) {
if (!strncmp(column->DisplayAs(), "checkbox", 8))
return new CheckboxAttributeText(model, column);
if (!strncmp(column->DisplayAs(), "duration", 8))
return new DurationAttributeText(model, column);
if (!strncmp(column->DisplayAs(), "rating", 6))
return new RatingAttributeText(model, column);
}
@ -283,7 +297,7 @@ WidgetAttributeText::NewWidgetText(const Model* model,
WidgetAttributeText::WidgetAttributeText(const Model* model,
const BColumn* column)
const BColumn* column)
:
fModel(const_cast<Model*>(model)),
fColumn(column),
@ -304,8 +318,9 @@ const char*
WidgetAttributeText::FittingText(const BPoseView* view)
{
if (fDirty || fColumn->Width() != fOldWidth || CheckSettingsChanged()
|| !fValueIsDefined )
|| !fValueIsDefined) {
CheckViewChanged(view);
}
ASSERT(!fDirty);
return fText.String();
@ -469,7 +484,7 @@ WidgetAttributeText::SetDirty(bool value)
}
// #pragma mark -
// #pragma mark - StringAttributeText
StringAttributeText::StringAttributeText(const Model* model,
@ -570,7 +585,7 @@ StringAttributeText::CommitEditedText(BTextView* textView)
}
// #pragma mark -
// #pragma mark - ScalarAttributeText
ScalarAttributeText::ScalarAttributeText(const Model* model,
@ -599,7 +614,8 @@ ScalarAttributeText::CheckAttributeChanged()
return false;
fValue = newValue;
fDirty = true; // have to redo fitted string
fDirty = true;
// have to redo fitted string
return true;
}
@ -629,7 +645,7 @@ ScalarAttributeText::Compare(WidgetAttributeText& attr, BPoseView*)
}
// #pragma mark -
// #pragma mark - PathAttributeText
PathAttributeText::PathAttributeText(const Model* model, const BColumn* column)
@ -651,11 +667,12 @@ PathAttributeText::ReadValue(BString* result)
TruncateLeaf(result);
} else
*result = "-";
fValueDirty = false;
}
// #pragma mark -
// #pragma mark - OriginalPathAttributeText
OriginalPathAttributeText::OriginalPathAttributeText(const Model* model,
@ -677,15 +694,15 @@ OriginalPathAttributeText::ReadValue(BString* result)
*result = path.Path();
else
*result = "-";
fValueDirty = false;
}
// #pragma mark -
// #pragma mark - KindAttributeText
KindAttributeText::KindAttributeText(const Model* model,
const BColumn* column)
KindAttributeText::KindAttributeText(const Model* model, const BColumn* column)
:
StringAttributeText(model, column)
{
@ -701,20 +718,21 @@ KindAttributeText::ReadValue(BString* result)
// get the mime type
if (mime.SetType(fModel->MimeType()) != B_OK)
*result = B_TRANSLATE("Unknown");
// get the short mime type description
else if (mime.GetShortDescription(desc) == B_OK)
else if (mime.GetShortDescription(desc) == B_OK) {
// get the short mime type description
*result = desc;
else
} else
*result = fModel->MimeType();
fValueDirty = false;
}
// #pragma mark -
// #pragma mark - NameAttributeText
NameAttributeText::NameAttributeText(const Model* model,
const BColumn* column)
const BColumn* column)
:
StringAttributeText(model, column)
{
@ -791,9 +809,7 @@ NameAttributeText::CommitEditedTextFlavor(BTextView* textView)
B_TRANSLATE("Replace other file"),
B_TRANSLATE("OK"),
NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, 'r');
if (alert->Go())
return false;
@ -847,7 +863,7 @@ NameAttributeText::IsEditable() const
}
// #pragma mark -
// #pragma mark - RealNameAttributeText
RealNameAttributeText::RealNameAttributeText(const Model* model,
@ -981,8 +997,6 @@ RealNameAttributeText::SetSortFolderNamesFirst(bool enabled)
#ifdef OWNER_GROUP_ATTRIBUTES
OwnerAttributeText::OwnerAttributeText(const Model* model,
const BColumn* column)
:
@ -1035,11 +1049,12 @@ GroupAttributeText::ReadValue(BString* result)
fValueDirty = false;
}
#endif // OWNER_GROUP_ATTRIBUTES
// #pragma mark - ModeAttributeText
ModeAttributeText::ModeAttributeText(const Model* model,
const BColumn* column)
:
@ -1080,7 +1095,7 @@ ModeAttributeText::ReadValue(BString* result)
}
// #pragma mark -
// #pragma mark - SizeAttributeText
SizeAttributeText::SizeAttributeText(const Model* model,
@ -1137,7 +1152,7 @@ SizeAttributeText::PreferredWidth(const BPoseView* pose) const
}
// #pragma mark - time related
// #pragma mark - TimeAttributeText
TimeAttributeText::TimeAttributeText(const Model* model,
@ -1176,6 +1191,9 @@ TimeAttributeText::CheckSettingsChanged(void)
}
// #pragma mark - CreationTimeAttributeText
CreationTimeAttributeText::CreationTimeAttributeText(const Model* model,
const BColumn* column)
:
@ -1193,6 +1211,9 @@ CreationTimeAttributeText::ReadValue()
}
// #pragma mark - ModificationTimeAttributeText
ModificationTimeAttributeText::ModificationTimeAttributeText(
const Model* model, const BColumn* column)
:
@ -1210,7 +1231,7 @@ ModificationTimeAttributeText::ReadValue()
}
// #pragma mark -
// #pragma mark - GenericAttributeText
GenericAttributeText::GenericAttributeText(const Model* model,
@ -1326,11 +1347,13 @@ GenericAttributeText::ReadValue(BString* result)
default:
TRESPASS();
break;
}
} else {
// handle the standard data types
switch (info.size) {
case sizeof(char): // Takes care of bool too.
case sizeof(char):
// Takes care of bool too.
fValueIsDefined = true;
fValue.int8t = tmp.int8t;
break;
@ -1340,18 +1363,21 @@ GenericAttributeText::ReadValue(BString* result)
fValue.int16t = tmp.int16t;
break;
case sizeof(int32): // Takes care of time_t too.
case sizeof(int32):
// Takes care of time_t too.
fValueIsDefined = true;
fValue.int32t = tmp.int32t;
break;
case sizeof(int64): // Takes care of off_t too.
case sizeof(int64):
// Takes care of off_t too.
fValueIsDefined = true;
fValue.int64t = tmp.int64t;
break;
default:
TRESPASS();
break;
}
}
}
@ -1528,9 +1554,10 @@ GenericAttributeText::Compare(WidgetAttributeText& attr, BPoseView*)
if (compareTo->fValueDirty)
compareTo->ReadValue(&compareTo->fFullValueText);
// Sort undefined values last, regardless of the other value:
// sort undefined values last, regardless of the other value
if (!fValueIsDefined)
return compareTo->fValueIsDefined ? 1 : 0;
if (!compareTo->fValueIsDefined)
return -1;
@ -1598,6 +1625,7 @@ GenericAttributeText::Compare(WidgetAttributeText& attr, BPoseView*)
return fValue.uint64t >= compareTo->fValue.uint64t ?
(fValue.uint64t == compareTo->fValue.uint64t ? 0 : 1) : -1;
}
return 0;
}
@ -1794,7 +1822,6 @@ GenericAttributeText::CommitEditedTextFlavor(BTextView* textView)
default:
TRESPASS();
}
size = fModel->WriteAttr(columnName, type, 0, &tmp, scalarSize);
@ -1819,7 +1846,7 @@ GenericAttributeText::CommitEditedTextFlavor(BTextView* textView)
}
// #pragma mark - display as: duration
// #pragma mark - DurationAttributeText (display as: duration)
DurationAttributeText::DurationAttributeText(const Model* model,
@ -1901,7 +1928,7 @@ DurationAttributeText::FitValue(BString* result, const BPoseView* view)
}
// #pragma mark - display as: checkbox
// #pragma mark - CheckboxAttributeText (display as: checkbox)
CheckboxAttributeText::CheckboxAttributeText(const Model* model,
@ -1981,7 +2008,7 @@ CheckboxAttributeText::FitValue(BString* result, const BPoseView* view)
}
// #pragma mark - display as: rating
// #pragma mark - RatingAttributeText (display as: rating)
RatingAttributeText::RatingAttributeText(const Model* model,
@ -2052,7 +2079,7 @@ RatingAttributeText::FitValue(BString* result, const BPoseView* view)
}
// #pragma mark -
// #pragma mark - OpenWithRelationAttributeText
OpenWithRelationAttributeText::OpenWithRelationAttributeText(const Model* model,
@ -2110,6 +2137,9 @@ OpenWithRelationAttributeText::FitValue(BString* result, const BPoseView* view)
}
// #pragma mark - VersionAttributeText
VersionAttributeText::VersionAttributeText(const Model* model,
const BColumn* column, bool app)
:

View File

@ -31,8 +31,8 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders.
All rights reserved.
*/
#ifndef __TEXT_WIDGET_ATTRIBUTE__
#define __TEXT_WIDGET_ATTRIBUTE__
#ifndef _TEXT_WIDGET_ATTRIBUTE_H
#define _TEXT_WIDGET_ATTRIBUTE_H
#include <String.h>
@ -56,83 +56,83 @@ class WidgetAttributeText {
// corresponding text, fitted into a specified width using a given
// view
// It is being asked for the string value by the TextWidget object
public:
WidgetAttributeText(const Model*, const BColumn*);
virtual ~WidgetAttributeText();
public:
WidgetAttributeText(const Model*, const BColumn*);
virtual ~WidgetAttributeText();
virtual bool CheckAttributeChanged() = 0;
// returns true if attribute value changed
virtual bool CheckAttributeChanged() = 0;
// returns true if attribute value changed
bool CheckViewChanged(const BPoseView*);
// returns true if fitted text changed, either because value
// changed or because width/view changed
bool CheckViewChanged(const BPoseView*);
// returns true if fitted text changed, either because value
// changed or because width/view changed
virtual bool CheckSettingsChanged();
// override if the text rendering depends on a setting
virtual bool CheckSettingsChanged();
// override if the text rendering depends on a setting
const char* FittingText(const BPoseView*);
// returns text, recalculating if not yet calculated
const char* FittingText(const BPoseView*);
// returns text, recalculating if not yet calculated
virtual int Compare(WidgetAttributeText&, BPoseView* view) = 0;
// override to define a compare of two different attributes for
// sorting
virtual int Compare(WidgetAttributeText&, BPoseView* view) = 0;
// override to define a compare of two different attributes for
// sorting
static WidgetAttributeText* NewWidgetText(const Model*,
const BColumn*, const BPoseView*);
// WidgetAttributeText factory
// call this to make the right WidgetAttributeText type for a
// given column
static WidgetAttributeText* NewWidgetText(const Model*,
const BColumn*, const BPoseView*);
// WidgetAttributeText factory
// call this to make the right WidgetAttributeText type for a
// given column
float Width(const BPoseView*);
// respects the width of the corresponding column
float CurrentWidth() const;
// return the item width we got during our last fitting attempt
float Width(const BPoseView*);
// respects the width of the corresponding column
float CurrentWidth() const;
// return the item width we got during our last fitting attempt
virtual void SetUpEditing(BTextView*);
// set up the passed textView for the specifics of a given
// attribute editing
virtual bool CommitEditedText(BTextView*) = 0;
// return true if attribute actually changed
virtual void SetUpEditing(BTextView*);
// set up the passed textView for the specifics of a given
// attribute editing
virtual bool CommitEditedText(BTextView*) = 0;
// return true if attribute actually changed
virtual float PreferredWidth(const BPoseView*) const = 0;
virtual float PreferredWidth(const BPoseView*) const = 0;
static status_t AttrAsString(const Model* model, BString* result,
const char* attrName, int32 attrType, float width,
BView* view, int64* value = 0);
static status_t AttrAsString(const Model* model, BString* result,
const char* attrName, int32 attrType, float width,
BView* view, int64* value = 0);
Model* TargetModel() const;
Model* TargetModel() const;
virtual bool IsEditable() const;
virtual bool IsEditable() const;
void SetDirty(bool);
void SetDirty(bool);
protected:
// generic fitting routines used by the different attributes
static float TruncString(BString* result, const char* src,
int32 length, const BPoseView*, float width,
uint32 truncMode = B_TRUNCATE_MIDDLE);
protected:
// generic fitting routines used by the different attributes
static float TruncString(BString* result, const char* src,
int32 length, const BPoseView*, float width,
uint32 truncMode = B_TRUNCATE_MIDDLE);
static float TruncTime(BString* result, int64 src,
const BPoseView* view, float width);
static float TruncTime(BString* result, int64 src,
const BPoseView* view, float width);
static float TruncFileSize(BString* result, int64 src,
const BPoseView* view, float width);
static float TruncFileSize(BString* result, int64 src,
const BPoseView* view, float width);
virtual void FitValue(BString* result, const BPoseView*) = 0;
// override FitValue to do a specific text fitting for a given
// attribute
virtual void FitValue(BString* result, const BPoseView*) = 0;
// override FitValue to do a specific text fitting for a given
// attribute
mutable Model* fModel;
const BColumn* fColumn;
// TODO: make these int32 only
float fOldWidth;
float fTruncatedWidth;
bool fDirty;
// if true, need to recalculate text next time we try to use it
bool fValueIsDefined;
BString fText;
// holds the truncated text, fit to the parameters passed in
// in the last FittingText call
mutable Model* fModel;
const BColumn* fColumn;
// TODO: make these int32 only
float fOldWidth;
float fTruncatedWidth;
bool fDirty;
// if true, need to recalculate text next time we try to use it
bool fValueIsDefined;
BString fText;
// holds the truncated text, fit to the parameters passed in
// in the last FittingText call
};
inline Model*
@ -143,49 +143,50 @@ WidgetAttributeText::TargetModel() const
class StringAttributeText : public WidgetAttributeText {
public:
StringAttributeText(const Model*, const BColumn*);
public:
StringAttributeText(const Model*, const BColumn*);
virtual const char* ValueAsText(const BPoseView* view);
// returns the untrucated text that corresponds to
// the attribute value
virtual const char* ValueAsText(const BPoseView* view);
// returns the untrucated text that corresponds to
// the attribute value
virtual bool CheckAttributeChanged();
virtual bool CheckAttributeChanged();
virtual float PreferredWidth(const BPoseView*) const;
virtual float PreferredWidth(const BPoseView*) const;
virtual bool CommitEditedText(BTextView*);
virtual bool CommitEditedText(BTextView*);
protected:
virtual bool CommitEditedTextFlavor(BTextView*) { return false; }
protected:
virtual bool CommitEditedTextFlavor(BTextView*) { return false; }
virtual void FitValue(BString* result, const BPoseView*);
virtual void ReadValue(BString* result) = 0;
virtual void FitValue(BString* result, const BPoseView*);
virtual void ReadValue(BString* result) = 0;
virtual int Compare(WidgetAttributeText &, BPoseView* view);
virtual int Compare(WidgetAttributeText &, BPoseView* view);
BString fFullValueText;
bool fValueDirty;
// used for lazy read, managed by ReadValue
BString fFullValueText;
bool fValueDirty;
// used for lazy read, managed by ReadValue
};
class ScalarAttributeText : public WidgetAttributeText {
public:
ScalarAttributeText(const Model*, const BColumn*);
int64 Value();
virtual bool CheckAttributeChanged();
public:
ScalarAttributeText(const Model*, const BColumn*);
virtual float PreferredWidth(const BPoseView*) const;
int64 Value();
virtual bool CheckAttributeChanged();
virtual bool CommitEditedText(BTextView*) { return false; }
// return true if attribute actually changed
protected:
virtual int64 ReadValue() = 0;
virtual int Compare(WidgetAttributeText&, BPoseView* view);
int64 fValue;
bool fValueDirty;
// used for lazy read, managed by ReadValue
virtual float PreferredWidth(const BPoseView*) const;
virtual bool CommitEditedText(BTextView*) { return false; }
// return true if attribute actually changed
protected:
virtual int64 ReadValue() = 0;
virtual int Compare(WidgetAttributeText&, BPoseView* view);
int64 fValue;
bool fValueDirty;
// used for lazy read, managed by ReadValue
};
@ -211,184 +212,178 @@ union GenericValueStruct {
//! Used for displaying mime extra attributes. Supports different formats.
class GenericAttributeText : public StringAttributeText {
public:
GenericAttributeText(const Model* model,
const BColumn* column);
GenericAttributeText(const Model* model, const BColumn* column);
virtual bool CheckAttributeChanged();
virtual float PreferredWidth(const BPoseView* view) const;
virtual bool CheckAttributeChanged();
virtual float PreferredWidth(const BPoseView* view) const;
virtual int Compare(WidgetAttributeText& other,
BPoseView* view);
virtual int Compare(WidgetAttributeText& other, BPoseView* view);
virtual void SetUpEditing(BTextView* view);
virtual bool CommitEditedText(BTextView* view);
virtual void SetUpEditing(BTextView* view);
virtual bool CommitEditedText(BTextView* view);
virtual const char* ValueAsText(const BPoseView* view);
virtual const char* ValueAsText(const BPoseView* view);
protected:
virtual bool CommitEditedTextFlavor(BTextView* view);
virtual bool CommitEditedTextFlavor(BTextView* view);
virtual void FitValue(BString* result,
const BPoseView* view);
virtual void ReadValue(BString* result);
virtual void FitValue(BString* result, const BPoseView* view);
virtual void ReadValue(BString* result);
protected:
// TODO: split this up into a scalar flavor and string flavor
// to save memory
GenericValueStruct fValue;
GenericValueStruct fValue;
};
//! Used for the display-as type "duration"
class DurationAttributeText : public GenericAttributeText {
public:
DurationAttributeText(const Model* model,
const BColumn* column);
DurationAttributeText(const Model* model, const BColumn* column);
private:
virtual void FitValue(BString* result,
const BPoseView* view);
virtual void FitValue(BString* result, const BPoseView* view);
};
//! Used for the display-as type "checkbox"
class CheckboxAttributeText : public GenericAttributeText {
public:
CheckboxAttributeText(const Model* model,
const BColumn* column);
CheckboxAttributeText(const Model* model, const BColumn* column);
virtual void SetUpEditing(BTextView* view);
virtual void SetUpEditing(BTextView* view);
private:
virtual void FitValue(BString* result,
const BPoseView* view);
virtual void FitValue(BString* result, const BPoseView* view);
private:
BString fOnChar;
BString fOffChar;
BString fOnChar;
BString fOffChar;
};
//! Used for the display-as type "rating"
class RatingAttributeText : public GenericAttributeText {
public:
RatingAttributeText(const Model* model,
const BColumn* column);
RatingAttributeText(const Model* model, const BColumn* column);
virtual void SetUpEditing(BTextView* view);
virtual void SetUpEditing(BTextView* view);
private:
virtual void FitValue(BString* result,
const BPoseView* view);
virtual void FitValue(BString* result, const BPoseView* view);
private:
int32 fCount;
int32 fMax;
int32 fCount;
int32 fMax;
};
class TimeAttributeText : public ScalarAttributeText {
public:
TimeAttributeText(const Model*, const BColumn*);
protected:
virtual float PreferredWidth(const BPoseView*) const;
virtual void FitValue(BString* result, const BPoseView*);
virtual bool CheckSettingsChanged();
public:
TimeAttributeText(const Model*, const BColumn*);
TrackerSettings fSettings;
bool fLastClockIs24;
DateOrder fLastDateOrder;
FormatSeparator fLastTimeFormatSeparator;
protected:
virtual float PreferredWidth(const BPoseView*) const;
virtual void FitValue(BString* result, const BPoseView*);
virtual bool CheckSettingsChanged();
TrackerSettings fSettings;
bool fLastClockIs24;
DateOrder fLastDateOrder;
FormatSeparator fLastTimeFormatSeparator;
};
class PathAttributeText : public StringAttributeText {
public:
PathAttributeText(const Model*, const BColumn*);
protected:
virtual void ReadValue(BString* result);
public:
PathAttributeText(const Model*, const BColumn*);
protected:
virtual void ReadValue(BString* result);
};
class OriginalPathAttributeText : public StringAttributeText {
public:
OriginalPathAttributeText(const Model*, const BColumn*);
protected:
virtual void ReadValue(BString* result);
public:
OriginalPathAttributeText(const Model*, const BColumn*);
protected:
virtual void ReadValue(BString* result);
};
class KindAttributeText : public StringAttributeText {
public:
KindAttributeText(const Model*, const BColumn*);
protected:
virtual void ReadValue(BString* result);
public:
KindAttributeText(const Model*, const BColumn*);
protected:
virtual void ReadValue(BString* result);
};
class NameAttributeText : public StringAttributeText {
public:
NameAttributeText(const Model*, const BColumn*);
virtual void SetUpEditing(BTextView*);
virtual void FitValue(BString* result, const BPoseView*);
virtual bool IsEditable() const;
public:
NameAttributeText(const Model*, const BColumn*);
virtual void SetUpEditing(BTextView*);
virtual void FitValue(BString* result, const BPoseView*);
virtual bool IsEditable() const;
static void SetSortFolderNamesFirst(bool);
protected:
virtual bool CommitEditedTextFlavor(BTextView*);
virtual int Compare(WidgetAttributeText&, BPoseView* view);
virtual void ReadValue(BString* result);
static void SetSortFolderNamesFirst(bool);
static bool sSortFolderNamesFirst;
protected:
virtual bool CommitEditedTextFlavor(BTextView*);
virtual int Compare(WidgetAttributeText&, BPoseView* view);
virtual void ReadValue(BString* result);
static bool sSortFolderNamesFirst;
};
class RealNameAttributeText : public StringAttributeText {
public:
RealNameAttributeText(const Model*,
const BColumn*);
virtual void SetUpEditing(BTextView*);
virtual void FitValue(BString* result, const BPoseView*);
RealNameAttributeText(const Model*, const BColumn*);
static void SetSortFolderNamesFirst(bool);
virtual void SetUpEditing(BTextView*);
virtual void FitValue(BString* result, const BPoseView*);
static void SetSortFolderNamesFirst(bool);
protected:
virtual bool CommitEditedTextFlavor(BTextView*);
virtual int Compare(WidgetAttributeText&, BPoseView* view);
virtual void ReadValue(BString* result);
virtual bool CommitEditedTextFlavor(BTextView*);
virtual int Compare(WidgetAttributeText&, BPoseView* view);
virtual void ReadValue(BString* result);
static bool sSortFolderNamesFirst;
static bool sSortFolderNamesFirst;
};
#ifdef OWNER_GROUP_ATTRIBUTES
class OwnerAttributeText : public StringAttributeText {
public:
OwnerAttributeText(const Model*, const BColumn*);
public:
OwnerAttributeText(const Model*, const BColumn*);
protected:
virtual void ReadValue(BString* result);
protected:
virtual void ReadValue(BString* result);
};
class GroupAttributeText : public StringAttributeText {
public:
GroupAttributeText(const Model*, const BColumn*);
public:
GroupAttributeText(const Model*, const BColumn*);
protected:
virtual void ReadValue(BString* result);
protected:
virtual void ReadValue(BString* result);
};
#endif // OWNER_GROUP_ATTRIBUTES
#endif // OWNER_GROUP_ATTRIBUTES
class ModeAttributeText : public StringAttributeText {
public:
ModeAttributeText(const Model*, const BColumn*);
public:
ModeAttributeText(const Model*, const BColumn*);
protected:
virtual void ReadValue(BString* result);
protected:
virtual void ReadValue(BString* result);
};
@ -396,77 +391,80 @@ const int64 kUnknownSize = -1;
class SizeAttributeText : public ScalarAttributeText {
public:
SizeAttributeText(const Model*, const BColumn*);
public:
SizeAttributeText(const Model*, const BColumn*);
protected:
virtual void FitValue(BString* result, const BPoseView*);
virtual int64 ReadValue();
virtual float PreferredWidth(const BPoseView*) const;
protected:
virtual void FitValue(BString* result, const BPoseView*);
virtual int64 ReadValue();
virtual float PreferredWidth(const BPoseView*) const;
};
class CreationTimeAttributeText : public TimeAttributeText {
public:
CreationTimeAttributeText(const Model*, const BColumn*);
protected:
virtual int64 ReadValue();
public:
CreationTimeAttributeText(const Model*, const BColumn*);
protected:
virtual int64 ReadValue();
};
class ModificationTimeAttributeText : public TimeAttributeText {
public:
ModificationTimeAttributeText(const Model*, const BColumn*);
public:
ModificationTimeAttributeText(const Model*, const BColumn*);
protected:
virtual int64 ReadValue();
protected:
virtual int64 ReadValue();
};
class OpenWithRelationAttributeText : public ScalarAttributeText {
public:
OpenWithRelationAttributeText(const Model*, const BColumn*,
const BPoseView*);
public:
OpenWithRelationAttributeText(const Model*, const BColumn*,
const BPoseView*);
protected:
virtual void FitValue(BString* result, const BPoseView*);
virtual int64 ReadValue();
virtual float PreferredWidth(const BPoseView*) const;
protected:
virtual void FitValue(BString* result, const BPoseView*);
virtual int64 ReadValue();
virtual float PreferredWidth(const BPoseView*) const;
const BPoseView* fPoseView;
BString fRelationText;
const BPoseView* fPoseView;
BString fRelationText;
};
class VersionAttributeText : public StringAttributeText {
public:
VersionAttributeText(const Model*, const BColumn*, bool appVersion);
public:
VersionAttributeText(const Model*, const BColumn*, bool appVersion);
protected:
virtual void ReadValue(BString* result);
protected:
virtual void ReadValue(BString* result);
private:
bool fAppVersion;
private:
bool fAppVersion;
};
class AppShortVersionAttributeText : public VersionAttributeText {
public:
AppShortVersionAttributeText(const Model* model,
const BColumn* column)
: VersionAttributeText(model, column, true)
{
}
public:
AppShortVersionAttributeText(const Model* model,
const BColumn* column)
:
VersionAttributeText(model, column, true)
{
}
};
class SystemShortVersionAttributeText : public VersionAttributeText {
public:
SystemShortVersionAttributeText(const Model* model,
const BColumn* column)
: VersionAttributeText(model, column, false)
{
}
public:
SystemShortVersionAttributeText(const Model* model,
const BColumn* column)
:
VersionAttributeText(model, column, false)
{
}
};
} // namespace BPrivate
@ -477,4 +475,5 @@ extern status_t TimeFormat(BString &string, int32 index,
using namespace BPrivate;
#endif // __TEXT_WIDGET_ATTRIBUTE__
#endif // _TEXT_WIDGET_ATTRIBUTE_H