BControl subclasses: Override SetIcon()

... and implement Perform() action for potential later use.
This commit is contained in:
Ingo Weinhold 2013-12-22 02:31:47 +01:00
parent be260374d5
commit be4367428b
16 changed files with 101 additions and 3 deletions

View File

@ -68,6 +68,8 @@ public:
virtual BSize MaxSize(); virtual BSize MaxSize();
virtual BSize PreferredSize(); virtual BSize PreferredSize();
virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
protected: protected:
virtual void LayoutInvalidated(bool descendants = false); virtual void LayoutInvalidated(bool descendants = false);

View File

@ -69,6 +69,8 @@ public:
virtual status_t Perform(perform_code code, void* data); virtual status_t Perform(perform_code code, void* data);
virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
bool IsPartialStateToOff() const; bool IsPartialStateToOff() const;
void SetPartialStateToOff(bool partialToOff); void SetPartialStateToOff(bool partialToOff);

View File

@ -76,6 +76,8 @@ public:
virtual void AllAttached(); virtual void AllAttached();
virtual void AllDetached(); virtual void AllDetached();
virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
private: private:
virtual status_t Perform(perform_code d, void *arg); virtual status_t Perform(perform_code d, void *arg);
// this can be made public again if needed // this can be made public again if needed

View File

@ -79,6 +79,8 @@ public:
virtual status_t Perform(perform_code code, void* data); virtual status_t Perform(perform_code code, void* data);
virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
private: private:
// FBC padding and forbidden methods // FBC padding and forbidden methods
virtual void _ReservedPictureButton1(); virtual void _ReservedPictureButton1();

View File

@ -63,6 +63,8 @@ public:
virtual BSize MaxSize(); virtual BSize MaxSize();
virtual BAlignment LayoutAlignment(); virtual BAlignment LayoutAlignment();
virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
private: private:
friend status_t _init_interface_kit_(); friend status_t _init_interface_kit_();

View File

@ -159,6 +159,8 @@ public:
virtual BSize MaxSize(); virtual BSize MaxSize();
virtual BSize PreferredSize(); virtual BSize PreferredSize();
virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
protected: protected:
virtual void LayoutInvalidated(bool descendants); virtual void LayoutInvalidated(bool descendants);

View File

@ -98,6 +98,8 @@ protected:
virtual void LayoutInvalidated(bool descendants); virtual void LayoutInvalidated(bool descendants);
virtual void DoLayout(); virtual void DoLayout();
virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
private: private:
// FBC padding and forbidden methods // FBC padding and forbidden methods
virtual status_t Perform(perform_code d, void* arg); virtual status_t Perform(perform_code d, void* arg);

View File

@ -71,7 +71,8 @@ public:
status_t SetIcon(int32 resourceID); status_t SetIcon(int32 resourceID);
status_t SetIcon(const char* pathToBitmap); status_t SetIcon(const char* pathToBitmap);
status_t SetIcon(const BBitmap* bitmap); virtual status_t SetIcon(const BBitmap* bitmap,
uint32 flags = 0);
status_t SetIcon(const BMimeType* fileType, status_t SetIcon(const BMimeType* fileType,
bool small = true); bool small = true);
status_t SetIcon(const unsigned char* bitsFromQuickRes, status_t SetIcon(const unsigned char* bitsFromQuickRes,

View File

@ -661,6 +661,11 @@ BButton::Perform(perform_code code, void* _data)
BButton::DoLayout(); BButton::DoLayout();
return B_OK; return B_OK;
} }
case PERFORM_CODE_SET_ICON:
{
perform_data_set_icon* data = (perform_data_set_icon*)_data;
return BButton::SetIcon(data->icon, data->flags);
}
} }
return BControl::Perform(code, _data); return BControl::Perform(code, _data);
@ -691,6 +696,13 @@ BButton::PreferredSize()
} }
status_t
BButton::SetIcon(const BBitmap* icon, uint32 flags)
{
return BControl::SetIcon(icon, flags);
}
void void
BButton::LayoutInvalidated(bool descendants) BButton::LayoutInvalidated(bool descendants)
{ {

View File

@ -589,12 +589,24 @@ BCheckBox::Perform(perform_code code, void* _data)
BCheckBox::DoLayout(); BCheckBox::DoLayout();
return B_OK; return B_OK;
} }
case PERFORM_CODE_SET_ICON:
{
perform_data_set_icon* data = (perform_data_set_icon*)_data;
return BCheckBox::SetIcon(data->icon, data->flags);
}
} }
return BControl::Perform(code, _data); return BControl::Perform(code, _data);
} }
status_t
BCheckBox::SetIcon(const BBitmap* icon, uint32 flags)
{
return BControl::SetIcon(icon, flags);
}
void void
BCheckBox::LayoutInvalidated(bool descendants) BCheckBox::LayoutInvalidated(bool descendants)
{ {

View File

@ -1036,6 +1036,13 @@ BColorControl::AllDetached()
} }
status_t
BColorControl::SetIcon(const BBitmap* icon, uint32 flags)
{
return BControl::SetIcon(icon, flags);
}
status_t status_t
BColorControl::Perform(perform_code code, void* _data) BColorControl::Perform(perform_code code, void* _data)
{ {
@ -1086,6 +1093,11 @@ BColorControl::Perform(perform_code code, void* _data)
BColorControl::DoLayout(); BColorControl::DoLayout();
return B_OK; return B_OK;
} }
case PERFORM_CODE_SET_ICON:
{
perform_data_set_icon* data = (perform_data_set_icon*)_data;
return BColorControl::SetIcon(data->icon, data->flags);
}
} }
return BControl::Perform(code, _data); return BControl::Perform(code, _data);

View File

@ -470,12 +470,24 @@ BPictureButton::Perform(perform_code code, void* _data)
BPictureButton::DoLayout(); BPictureButton::DoLayout();
return B_OK; return B_OK;
} }
case PERFORM_CODE_SET_ICON:
{
perform_data_set_icon* data = (perform_data_set_icon*)_data;
return BPictureButton::SetIcon(data->icon, data->flags);
}
} }
return BControl::Perform(code, _data); return BControl::Perform(code, _data);
} }
status_t
BPictureButton::SetIcon(const BBitmap* icon, uint32 flags)
{
return BControl::SetIcon(icon, flags);
}
// #pragma mark - // #pragma mark -

View File

@ -555,6 +555,11 @@ BRadioButton::Perform(perform_code code, void* _data)
BRadioButton::DoLayout(); BRadioButton::DoLayout();
return B_OK; return B_OK;
} }
case PERFORM_CODE_SET_ICON:
{
perform_data_set_icon* data = (perform_data_set_icon*)_data;
return BRadioButton::SetIcon(data->icon, data->flags);
}
} }
return BControl::Perform(code, _data); return BControl::Perform(code, _data);
@ -580,6 +585,12 @@ BRadioButton::LayoutAlignment()
} }
status_t
BRadioButton::SetIcon(const BBitmap* icon, uint32 flags)
{
return BControl::SetIcon(icon, flags);
}
void BRadioButton::_ReservedRadioButton1() {} void BRadioButton::_ReservedRadioButton1() {}
void BRadioButton::_ReservedRadioButton2() {} void BRadioButton::_ReservedRadioButton2() {}

View File

@ -345,6 +345,11 @@ BSlider::Perform(perform_code code, void* _data)
BSlider::DoLayout(); BSlider::DoLayout();
return B_OK; return B_OK;
} }
case PERFORM_CODE_SET_ICON:
{
perform_data_set_icon* data = (perform_data_set_icon*)_data;
return BSlider::SetIcon(data->icon, data->flags);
}
} }
return BControl::Perform(code, _data); return BControl::Perform(code, _data);
@ -1768,6 +1773,13 @@ BSlider::PreferredSize()
} }
status_t
BSlider::SetIcon(const BBitmap* icon, uint32 flags)
{
return BControl::SetIcon(icon, flags);
}
void void
BSlider::LayoutInvalidated(bool descendants) BSlider::LayoutInvalidated(bool descendants)
{ {

View File

@ -947,6 +947,13 @@ BTextControl::DoLayout()
} }
status_t
BTextControl::SetIcon(const BBitmap* icon, uint32 flags)
{
return BControl::SetIcon(icon, flags);
}
// #pragma mark - // #pragma mark -
@ -981,7 +988,7 @@ BTextControl::Perform(perform_code code, void* _data)
BTextControl::GetHeightForWidth(data->width, &data->min, &data->max, BTextControl::GetHeightForWidth(data->width, &data->min, &data->max,
&data->preferred); &data->preferred);
return B_OK; return B_OK;
} }
case PERFORM_CODE_SET_LAYOUT: case PERFORM_CODE_SET_LAYOUT:
{ {
perform_data_set_layout* data = (perform_data_set_layout*)_data; perform_data_set_layout* data = (perform_data_set_layout*)_data;
@ -1000,6 +1007,11 @@ BTextControl::Perform(perform_code code, void* _data)
BTextControl::DoLayout(); BTextControl::DoLayout();
return B_OK; return B_OK;
} }
case PERFORM_CODE_SET_ICON:
{
perform_data_set_icon* data = (perform_data_set_icon*)_data;
return BTextControl::SetIcon(data->icon, data->flags);
}
case PERFORM_CODE_ALL_UNARCHIVED: case PERFORM_CODE_ALL_UNARCHIVED:
{ {
perform_data_all_unarchived* data perform_data_all_unarchived* data

View File

@ -382,7 +382,7 @@ BIconButton::SetIcon(const char* pathToBitmap)
status_t status_t
BIconButton::SetIcon(const BBitmap* bitmap) BIconButton::SetIcon(const BBitmap* bitmap, uint32 flags)
{ {
if (bitmap && bitmap->ColorSpace() == B_CMAP8) { if (bitmap && bitmap->ColorSpace() == B_CMAP8) {
status_t status = bitmap->InitCheck(); status_t status = bitmap->InitCheck();