From 39fbf5509b8740d9883b61649027478dc8a3ead8 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 15 Oct 2008 09:29:06 +0000 Subject: [PATCH] bonefish + zooey: * Fixed a general problem with respect to overriding of the reserved virtual function slots: instead of statically invoking the method that corresponds to the reserved slot on the class that contains the slot, we now invoke the virtual Perform() method. Perform() then dispatches the method invocation to the "proper" class, i.e. the highest class in the hierarchy that actually implements the requested method. This fixes a crash in apps that use liblayout's MSlider class and should fix one or other spurious bug with old apps or libraries, too. * added new header folder 'binary_compatibility' that contains files that define the method codes and data structures required by Perform() * looked for and implemented all used reserved virtual slot functions to invoke Perform() where necessary or to pass on the method call statically (for slots that were already maintained by Be) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28124 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/Slider.h | 2 +- headers/os/interface/View.h | 2 +- headers/private/binary_compatibility/Global.h | 29 +++ .../private/binary_compatibility/Interface.h | 49 +++++ src/kits/app/Handler.cpp | 11 +- src/kits/interface/Alert.cpp | 22 +- src/kits/interface/Box.cpp | 55 ++++- src/kits/interface/Button.cpp | 55 ++++- src/kits/interface/CheckBox.cpp | 55 ++++- src/kits/interface/ColorControl.cpp | 55 ++++- src/kits/interface/Control.cpp | 59 +++++- src/kits/interface/Dragger.cpp | 78 +++++++- src/kits/interface/ListView.cpp | 59 +++++- src/kits/interface/Menu.cpp | 55 ++++- src/kits/interface/MenuBar.cpp | 55 ++++- src/kits/interface/MenuField.cpp | 55 ++++- src/kits/interface/OutlineListView.cpp | 56 +++++- src/kits/interface/PictureButton.cpp | 55 ++++- src/kits/interface/PopUpMenu.cpp | 55 ++++- src/kits/interface/RadioButton.cpp | 55 ++++- src/kits/interface/ScrollBar.cpp | 55 ++++- src/kits/interface/ScrollView.cpp | 54 ++++- src/kits/interface/Shelf.cpp | 7 +- src/kits/interface/Slider.cpp | 83 +++++++- src/kits/interface/StatusBar.cpp | 55 ++++- src/kits/interface/StringView.cpp | 56 +++++- src/kits/interface/TextControl.cpp | 55 ++++- src/kits/interface/TextView.cpp | 56 +++++- src/kits/interface/View.cpp | 188 +++++++++++++++--- src/kits/interface/Window.cpp | 19 +- 30 files changed, 1448 insertions(+), 97 deletions(-) create mode 100644 headers/private/binary_compatibility/Global.h create mode 100644 headers/private/binary_compatibility/Interface.h diff --git a/headers/os/interface/Slider.h b/headers/os/interface/Slider.h index 3cb7c04ab7..aba86e213f 100644 --- a/headers/os/interface/Slider.h +++ b/headers/os/interface/Slider.h @@ -55,7 +55,7 @@ class BSlider : public BControl { static BArchivable *Instantiate(BMessage *data); virtual status_t Archive(BMessage *data, bool deep = true) const; - virtual status_t Perform(perform_code d, void *arg); + virtual status_t Perform(perform_code code, void* data); virtual void WindowActivated(bool state); virtual void AttachedToWindow(); diff --git a/headers/os/interface/View.h b/headers/os/interface/View.h index eb7dff9125..09b2fa339f 100644 --- a/headers/os/interface/View.h +++ b/headers/os/interface/View.h @@ -506,7 +506,7 @@ public: float Scale() const; // new for Haiku - virtual status_t Perform(perform_code d, void* arg); + virtual status_t Perform(perform_code code, void* data); virtual void DrawAfterChildren(BRect r); diff --git a/headers/private/binary_compatibility/Global.h b/headers/private/binary_compatibility/Global.h new file mode 100644 index 0000000000..6d0aec0490 --- /dev/null +++ b/headers/private/binary_compatibility/Global.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008, Oliver Tappe, zooey@hirschkaefer.de. + * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _BINARY_COMPATIBILITY_GLOBAL_H_ +#define _BINARY_COMPATIBILITY__GLOBAL_H_ + + +// method codes +enum { + // app kit + + // interface kit + PERFORM_CODE_MIN_SIZE = 1000, + PERFORM_CODE_MAX_SIZE = 1001, + PERFORM_CODE_PREFERRED_SIZE = 1002, + PERFORM_CODE_LAYOUT_ALIGNMENT = 1003, + PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH = 1004, + PERFORM_CODE_GET_HEIGHT_FOR_WIDTH = 1005, + PERFORM_CODE_SET_LAYOUT = 1006, + PERFORM_CODE_INVALIDATE_LAYOUT = 1007, + PERFORM_CODE_DO_LAYOUT = 1008 + + // support kit +}; + + +#endif // _BINARY_COMPATIBILITY__GLOBAL_H_ diff --git a/headers/private/binary_compatibility/Interface.h b/headers/private/binary_compatibility/Interface.h new file mode 100644 index 0000000000..00879fbe50 --- /dev/null +++ b/headers/private/binary_compatibility/Interface.h @@ -0,0 +1,49 @@ +/* + * Copyright 2008, Oliver Tappe, zooey@hirschkaefer.de. + * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _BINARY_COMPATIBILITY_INTERFACE_H_ +#define _BINARY_COMPATIBILITY_INTERFACE_H_ + + +#include + + +struct perform_data_min_size { + BSize return_value; +}; + +struct perform_data_max_size { + BSize return_value; +}; + +struct perform_data_preferred_size { + BSize return_value; +}; + +struct perform_data_layout_alignment { + BAlignment return_value; +}; + +struct perform_data_has_height_for_width { + bool return_value; +}; + +struct perform_data_get_height_for_width { + float width; + float min; + float max; + float preferred; +}; + +struct perform_data_set_layout { + BLayout* layout; +}; + +struct perform_data_invalidate_layout { + bool descendants; +}; + + +#endif /* _BINARY_COMPATIBILITY_INTERFACE_H_ */ diff --git a/src/kits/app/Handler.cpp b/src/kits/app/Handler.cpp index 179ae7e0f6..5b1c8acb00 100644 --- a/src/kits/app/Handler.cpp +++ b/src/kits/app/Handler.cpp @@ -662,9 +662,16 @@ BHandler::SetLooper(BLooper *looper) } -#ifdef __INTEL__ +#if __GNUC__ < 3 // binary compatibility with R4.5 -extern "C" void _ReservedHandler1__8BHandler(void) {} + +extern "C" void +_ReservedHandler1__8BHandler(BHandler* handler, uint32 what, + const BMessage* notice) +{ + handler->BHandler::SendNotices(what, notice); +} + #endif void BHandler::_ReservedHandler2() {} diff --git a/src/kits/interface/Alert.cpp b/src/kits/interface/Alert.cpp index aabfe9622b..3d8b5f861f 100644 --- a/src/kits/interface/Alert.cpp +++ b/src/kits/interface/Alert.cpp @@ -9,6 +9,10 @@ //! BAlert displays a modal alert window. +#include +#include +#include + #include #include #include @@ -28,9 +32,8 @@ #include #include -#include -#include -#include +#include + //#define DEBUG_ALERT #ifdef DEBUG_ALERT @@ -417,9 +420,18 @@ BAlert::AlertPosition(float width, float height) status_t -BAlert::Perform(perform_code d, void* arg) +BAlert::Perform(perform_code code, void* _data) { - return BWindow::Perform(d, arg); + switch (code) { + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BAlert::SetLayout(data->layout); + return B_OK; +} + } + + return BWindow::Perform(code, _data); } diff --git a/src/kits/interface/Box.cpp b/src/kits/interface/Box.cpp index 26eb9cfc0d..3af2bb6c56 100644 --- a/src/kits/interface/Box.cpp +++ b/src/kits/interface/Box.cpp @@ -21,6 +21,8 @@ #include #include +#include + struct BBox::LayoutData { LayoutData() @@ -449,9 +451,58 @@ BBox::GetSupportedSuites(BMessage *message) status_t -BBox::Perform(perform_code d, void *arg) +BBox::Perform(perform_code code, void* _data) { - return BView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BBox::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BBox::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BBox::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BBox::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BBox::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BBox::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BBox::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BBox::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BBox::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); } diff --git a/src/kits/interface/Button.cpp b/src/kits/interface/Button.cpp index c277ff4e30..b3e9913791 100644 --- a/src/kits/interface/Button.cpp +++ b/src/kits/interface/Button.cpp @@ -18,6 +18,8 @@ #include #include +#include + BButton::BButton(BRect frame, const char *name, const char *label, BMessage *message, uint32 resizingMode, uint32 flags) @@ -705,9 +707,58 @@ BButton::GetSupportedSuites(BMessage *message) status_t -BButton::Perform(perform_code d, void *arg) +BButton::Perform(perform_code code, void* _data) { - return BControl::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BButton::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BButton::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BButton::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BButton::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BButton::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BButton::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BButton::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BButton::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BButton::DoLayout(); + return B_OK; + } + } + + return BControl::Perform(code, _data); } diff --git a/src/kits/interface/CheckBox.cpp b/src/kits/interface/CheckBox.cpp index 20efa5cdcd..11eaf1f0e9 100644 --- a/src/kits/interface/CheckBox.cpp +++ b/src/kits/interface/CheckBox.cpp @@ -14,6 +14,8 @@ #include #include +#include + BCheckBox::BCheckBox(BRect frame, const char *name, const char *label, BMessage *message, uint32 resizingMode, uint32 flags) @@ -442,9 +444,58 @@ BCheckBox::AllDetached() status_t -BCheckBox::Perform(perform_code d, void *arg) +BCheckBox::Perform(perform_code code, void* _data) { - return BControl::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BCheckBox::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BCheckBox::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BCheckBox::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BCheckBox::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BCheckBox::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BCheckBox::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BCheckBox::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BCheckBox::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BCheckBox::DoLayout(); + return B_OK; + } + } + + return BControl::Perform(code, _data); } diff --git a/src/kits/interface/ColorControl.cpp b/src/kits/interface/ColorControl.cpp index 1bffa7d78d..269f53e27a 100644 --- a/src/kits/interface/ColorControl.cpp +++ b/src/kits/interface/ColorControl.cpp @@ -21,6 +21,8 @@ #include #include +#include + static const uint32 kMsgColorEntered = 'ccol'; static const uint32 kMinCellSize = 6; @@ -857,9 +859,58 @@ BColorControl::AllDetached() status_t -BColorControl::Perform(perform_code d, void *arg) +BColorControl::Perform(perform_code code, void* _data) { - return BControl::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BColorControl::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BColorControl::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BColorControl::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BColorControl::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BColorControl::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BColorControl::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BColorControl::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BColorControl::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BColorControl::DoLayout(); + return B_OK; + } + } + + return BControl::Perform(code, _data); } diff --git a/src/kits/interface/Control.cpp b/src/kits/interface/Control.cpp index 0697b55417..d42f88ddd9 100644 --- a/src/kits/interface/Control.cpp +++ b/src/kits/interface/Control.cpp @@ -9,12 +9,14 @@ /*! BControl is the base class for user-event handling objects. */ +#include +#include + #include #include #include -#include -#include +#include static property_info sPropertyList[] = { @@ -452,9 +454,58 @@ BControl::AllDetached() status_t -BControl::Perform(perform_code d, void *arg) +BControl::Perform(perform_code code, void* _data) { - return BView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BControl::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BControl::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BControl::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BControl::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BControl::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BControl::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BControl::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BControl::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BControl::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); } diff --git a/src/kits/interface/Dragger.cpp b/src/kits/interface/Dragger.cpp index 12bc847640..2c09c27b54 100644 --- a/src/kits/interface/Dragger.cpp +++ b/src/kits/interface/Dragger.cpp @@ -9,9 +9,8 @@ //! BDragger represents a replicant "handle". -#include -#include -#include +#include +#include #include #include @@ -24,10 +23,12 @@ #include #include -#include "ZombieReplicantView.h" +#include +#include +#include +#include -#include -#include +#include "ZombieReplicantView.h" bool BDragger::sVisible; @@ -378,9 +379,58 @@ BDragger::GetSupportedSuites(BMessage* data) status_t -BDragger::Perform(perform_code d, void* arg) +BDragger::Perform(perform_code code, void* _data) { - return BView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BDragger::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BDragger::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BDragger::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BDragger::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BDragger::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BDragger::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BDragger::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BDragger::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BDragger::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); } @@ -620,3 +670,15 @@ BDragger::_ShowPopUp(BView *target, BPoint where) fPopUp->Go(point, true, false, rect, true); } + + +#if __GNUC__ < 3 + +extern "C" BBitmap* +_ReservedDragger1__8BDragger(BDragger* dragger, BPoint* offset, + drawing_mode* mode) +{ + return dragger->BDragger::DragBitmap(offset, mode); +} + +#endif diff --git a/src/kits/interface/ListView.cpp b/src/kits/interface/ListView.cpp index 287355cef7..2fd601961b 100644 --- a/src/kits/interface/ListView.cpp +++ b/src/kits/interface/ListView.cpp @@ -13,6 +13,8 @@ #include +#include + #include #include #include @@ -20,7 +22,7 @@ #include #include -#include +#include struct track_data { @@ -1062,12 +1064,61 @@ BListView::GetSupportedSuites(BMessage* data) return err; } -// Perform status_t -BListView::Perform(perform_code d, void *arg) +BListView::Perform(perform_code code, void* _data) { - return BView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BListView::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BListView::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BListView::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BListView::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BListView::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BListView::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; } + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BListView::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BListView::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BListView::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); +} + // WindowActivated void diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index db01af8664..30eda7ca65 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -34,6 +35,7 @@ #include "utf8_functions.h" + #define USE_CACHED_MENUWINDOW 1 using std::nothrow; @@ -1094,9 +1096,58 @@ BMenu::GetSupportedSuites(BMessage *data) status_t -BMenu::Perform(perform_code d, void *arg) +BMenu::Perform(perform_code code, void* _data) { - return BView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BMenu::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BMenu::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BMenu::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BMenu::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BMenu::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BMenu::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BMenu::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BMenu::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BMenu::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); } diff --git a/src/kits/interface/MenuBar.cpp b/src/kits/interface/MenuBar.cpp index 16ca1146d2..e3e4f1db76 100644 --- a/src/kits/interface/MenuBar.cpp +++ b/src/kits/interface/MenuBar.cpp @@ -18,11 +18,13 @@ #include #include +#include #include #include #include "BMCPrivate.h" + using BPrivate::gDefaultTokens; @@ -325,9 +327,58 @@ BMenuBar::AllDetached() status_t -BMenuBar::Perform(perform_code d, void *arg) +BMenuBar::Perform(perform_code code, void* _data) { - return BMenu::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BMenuBar::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BMenuBar::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BMenuBar::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BMenuBar::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BMenuBar::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BMenuBar::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BMenuBar::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BMenuBar::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BMenuBar::DoLayout(); + return B_OK; + } + } + + return BMenu::Perform(code, _data); } diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index eef16b2c8c..f2eb2c586e 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -19,6 +19,8 @@ #include #include +#include + //#define TRACE_MENU_FIELD #ifdef TRACE_MENU_FIELD @@ -721,9 +723,58 @@ BMenuField::CreateMenuBarLayoutItem() status_t -BMenuField::Perform(perform_code d, void *arg) +BMenuField::Perform(perform_code code, void* _data) { - return BView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BMenuField::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BMenuField::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BMenuField::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BMenuField::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BMenuField::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BMenuField::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BMenuField::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BMenuField::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BMenuField::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); } diff --git a/src/kits/interface/OutlineListView.cpp b/src/kits/interface/OutlineListView.cpp index bad59638d0..704be14d59 100644 --- a/src/kits/interface/OutlineListView.cpp +++ b/src/kits/interface/OutlineListView.cpp @@ -18,6 +18,9 @@ #include +#include + + struct ListItemComparator { ListItemComparator(int (*compareFunc)(const BListItem *, const BListItem *)) : fCompareFunc(compareFunc) @@ -546,9 +549,58 @@ BOutlineListView::GetSupportedSuites(BMessage* data) status_t -BOutlineListView::Perform(perform_code d, void* arg) +BOutlineListView::Perform(perform_code code, void* _data) { - return BListView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BOutlineListView::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BOutlineListView::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BOutlineListView::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BOutlineListView::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BOutlineListView::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BOutlineListView::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BOutlineListView::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BOutlineListView::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BOutlineListView::DoLayout(); + return B_OK; + } + } + + return BListView::Perform(code, _data); } diff --git a/src/kits/interface/PictureButton.cpp b/src/kits/interface/PictureButton.cpp index 397f7fac0b..7c93bb40ba 100644 --- a/src/kits/interface/PictureButton.cpp +++ b/src/kits/interface/PictureButton.cpp @@ -11,6 +11,8 @@ #include +#include + BPictureButton::BPictureButton(BRect frame, const char* name, BPicture *off, BPicture *on, BMessage *message, @@ -408,9 +410,58 @@ BPictureButton::AllDetached() status_t -BPictureButton::Perform(perform_code d, void *arg) +BPictureButton::Perform(perform_code code, void* _data) { - return BControl::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BPictureButton::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BPictureButton::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BPictureButton::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BPictureButton::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BPictureButton::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BPictureButton::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BPictureButton::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BPictureButton::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BPictureButton::DoLayout(); + return B_OK; + } + } + + return BControl::Perform(code, _data); } diff --git a/src/kits/interface/PopUpMenu.cpp b/src/kits/interface/PopUpMenu.cpp index 2a644cb23a..1164595fee 100644 --- a/src/kits/interface/PopUpMenu.cpp +++ b/src/kits/interface/PopUpMenu.cpp @@ -16,6 +16,8 @@ #include +#include + struct popup_menu_data { BPopUpMenu *object; @@ -172,9 +174,58 @@ BPopUpMenu::GetSupportedSuites(BMessage *data) status_t -BPopUpMenu::Perform(perform_code d, void *arg) +BPopUpMenu::Perform(perform_code code, void* _data) { - return BMenu::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BPopUpMenu::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BPopUpMenu::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BPopUpMenu::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BPopUpMenu::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BPopUpMenu::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BPopUpMenu::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BPopUpMenu::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BPopUpMenu::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BPopUpMenu::DoLayout(); + return B_OK; + } + } + + return BMenu::Perform(code, _data); } diff --git a/src/kits/interface/RadioButton.cpp b/src/kits/interface/RadioButton.cpp index 7ce215049d..6efdb141d0 100644 --- a/src/kits/interface/RadioButton.cpp +++ b/src/kits/interface/RadioButton.cpp @@ -20,6 +20,8 @@ #include #include +#include + BRadioButton::BRadioButton(BRect frame, const char* name, const char* label, BMessage* message, uint32 resizMask, uint32 flags) @@ -480,9 +482,58 @@ BRadioButton::GetSupportedSuites(BMessage* message) status_t -BRadioButton::Perform(perform_code d, void* arg) +BRadioButton::Perform(perform_code code, void* _data) { - return BControl::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BRadioButton::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BRadioButton::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BRadioButton::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BRadioButton::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BRadioButton::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BRadioButton::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BRadioButton::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BRadioButton::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BRadioButton::DoLayout(); + return B_OK; + } + } + + return BControl::Perform(code, _data); } diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index 33b18b5e52..7214ce0e00 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -22,6 +22,8 @@ #include #include +#include + //#define TRACE_SCROLLBAR #ifdef TRACE_SCROLLBAR # define TRACE(x...) printf(x) @@ -1153,9 +1155,58 @@ BScrollBar::PreferredSize() status_t -BScrollBar::Perform(perform_code d, void* arg) +BScrollBar::Perform(perform_code code, void* _data) { - return BView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BScrollBar::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BScrollBar::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BScrollBar::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BScrollBar::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BScrollBar::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BScrollBar::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BScrollBar::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BScrollBar::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BScrollBar::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); } diff --git a/src/kits/interface/ScrollView.cpp b/src/kits/interface/ScrollView.cpp index 6318571fa4..de03e491a8 100644 --- a/src/kits/interface/ScrollView.cpp +++ b/src/kits/interface/ScrollView.cpp @@ -10,6 +10,7 @@ #include #include +#include static const float kFancyBorderSize = 2; static const float kPlainBorderSize = 1; @@ -634,9 +635,58 @@ BScrollView::PreferredSize() status_t -BScrollView::Perform(perform_code d, void *arg) +BScrollView::Perform(perform_code code, void* _data) { - return BView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BScrollView::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BScrollView::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BScrollView::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BScrollView::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BScrollView::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BScrollView::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BScrollView::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BScrollView::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BScrollView::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); } diff --git a/src/kits/interface/Shelf.cpp b/src/kits/interface/Shelf.cpp index ed1eba45a8..7cb0786235 100644 --- a/src/kits/interface/Shelf.cpp +++ b/src/kits/interface/Shelf.cpp @@ -99,10 +99,6 @@ static property_info sReplicantPropertyList[] = { }; -extern "C" void _ReservedShelf1__6BShelfFv(BShelf *const, int32, - const BMessage*, const BView*); - - namespace BPrivate { struct replicant_data { @@ -1018,9 +1014,10 @@ BShelf::ReplicantDeleted(int32 index, const BMessage *archive, } -void +extern "C" void _ReservedShelf1__6BShelfFv(BShelf *const, int32, const BMessage*, const BView*) { + // is not contained in BeOS R5's libbe, so we leave it empty } diff --git a/src/kits/interface/Slider.cpp b/src/kits/interface/Slider.cpp index 899553aea0..555480880f 100644 --- a/src/kits/interface/Slider.cpp +++ b/src/kits/interface/Slider.cpp @@ -12,7 +12,6 @@ #include #include - #include #include @@ -24,6 +23,8 @@ #include #include +#include + BSlider::BSlider(BRect frame, const char* name, const char* label, BMessage* message, int32 minValue, int32 maxValue, @@ -285,9 +286,58 @@ BSlider::Archive(BMessage *archive, bool deep) const status_t -BSlider::Perform(perform_code d, void *arg) +BSlider::Perform(perform_code code, void* _data) { - return BControl::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BSlider::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BSlider::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BSlider::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BSlider::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BSlider::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BSlider::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BSlider::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BSlider::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BSlider::DoLayout(); + return B_OK; + } + } + + return BControl::Perform(code, _data); } @@ -2018,8 +2068,29 @@ _ReservedSlider5__7BSlider(BSlider *slider) return slider->BSlider::MaxUpdateTextWidth(); } -extern "C" void _ReservedSlider1__7BSlider() {} -extern "C" void _ReservedSlider2__7BSlider() {} -extern "C" void _ReservedSlider3__7BSlider() {} + +extern "C" +void +_ReservedSlider1__7BSlider(BSlider* slider, orientation _orientation) +{ + slider->BSlider::SetOrientation(_orientation); +} + + +extern "C" +void +_ReservedSlider2__7BSlider(BSlider* slider, float thickness) +{ + slider->BSlider::SetBarThickness(thickness); +} + + +extern "C" +void +_ReservedSlider3__7BSlider(BSlider* slider, const BFont* font, + uint32 properties) +{ + slider->BSlider::SetFont(font, properties); +} #endif // __GNUC__ < 3 diff --git a/src/kits/interface/StatusBar.cpp b/src/kits/interface/StatusBar.cpp index 5aba252e79..b9730ba590 100644 --- a/src/kits/interface/StatusBar.cpp +++ b/src/kits/interface/StatusBar.cpp @@ -21,6 +21,8 @@ #include #include +#include + static const rgb_color kDefaultBarColor = {50, 150, 255, 255}; @@ -644,9 +646,58 @@ BStatusBar::PreferredSize() status_t -BStatusBar::Perform(perform_code d, void* arg) +BStatusBar::Perform(perform_code code, void* _data) { - return BView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BStatusBar::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BStatusBar::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BStatusBar::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BStatusBar::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BStatusBar::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BStatusBar::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BStatusBar::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BStatusBar::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BStatusBar::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); } diff --git a/src/kits/interface/StringView.cpp b/src/kits/interface/StringView.cpp index 1eee366911..7ac711df91 100644 --- a/src/kits/interface/StringView.cpp +++ b/src/kits/interface/StringView.cpp @@ -22,6 +22,8 @@ #include #include +#include + BStringView::BStringView(BRect frame, const char* name, const char* text, uint32 resizeMask, uint32 flags) @@ -335,10 +337,60 @@ BStringView::PreferredSize() status_t -BStringView::Perform(perform_code d, void* arg) +BStringView::Perform(perform_code code, void* _data) { - return B_ERROR; + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BStringView::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BStringView::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BStringView::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BStringView::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BStringView::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BStringView::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; } + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BStringView::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BStringView::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BStringView::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); +} + void BStringView::_ReservedStringView1() {} diff --git a/src/kits/interface/TextControl.cpp b/src/kits/interface/TextControl.cpp index 1db8df0451..8cadbf5613 100644 --- a/src/kits/interface/TextControl.cpp +++ b/src/kits/interface/TextControl.cpp @@ -20,6 +20,8 @@ #include #include +#include + #include "TextInput.h" @@ -794,9 +796,58 @@ BTextControl::DoLayout() status_t -BTextControl::Perform(perform_code d, void *arg) +BTextControl::Perform(perform_code code, void* _data) { - return BControl::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BTextControl::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BTextControl::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BTextControl::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BTextControl::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BTextControl::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BTextControl::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BTextControl::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BTextControl::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BTextControl::DoLayout(); + return B_OK; + } + } + + return BControl::Perform(code, _data); } diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index a8ec1d8aae..c2897d23f6 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -40,6 +40,8 @@ #include #include +#include + #include "InlineInput.h" #include "LineBuffer.h" #include "StyleBuffer.h" @@ -47,6 +49,7 @@ #include "UndoBuffer.h" #include "WidthBuffer.h" + using namespace std; #undef TRACE @@ -1040,9 +1043,58 @@ BTextView::GetSupportedSuites(BMessage *data) status_t -BTextView::Perform(perform_code d, void *arg) +BTextView::Perform(perform_code code, void* _data) { - return BView::Perform(d, arg); + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BTextView::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BTextView::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BTextView::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BTextView::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BTextView::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BTextView::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BTextView::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BTextView::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BTextView::DoLayout(); + return B_OK; + } + } + + return BView::Perform(code, _data); } diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 8cc100963d..f1c06f35a3 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -9,16 +9,10 @@ * Ingo Weinhold */ +#include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include @@ -50,9 +44,16 @@ #include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using std::nothrow; @@ -4279,9 +4280,58 @@ BView::MessageReceived(BMessage* msg) status_t -BView::Perform(perform_code d, void* arg) +BView::Perform(perform_code code, void* _data) { - return B_BAD_VALUE; + switch (code) { + case PERFORM_CODE_MIN_SIZE: + ((perform_data_min_size*)_data)->return_value + = BView::MinSize(); + return B_OK; + case PERFORM_CODE_MAX_SIZE: + ((perform_data_max_size*)_data)->return_value + = BView::MaxSize(); + return B_OK; + case PERFORM_CODE_PREFERRED_SIZE: + ((perform_data_preferred_size*)_data)->return_value + = BView::PreferredSize(); + return B_OK; + case PERFORM_CODE_LAYOUT_ALIGNMENT: + ((perform_data_layout_alignment*)_data)->return_value + = BView::LayoutAlignment(); + return B_OK; + case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH: + ((perform_data_has_height_for_width*)_data)->return_value + = BView::HasHeightForWidth(); + return B_OK; + case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH: + { + perform_data_get_height_for_width* data + = (perform_data_get_height_for_width*)_data; + BView::GetHeightForWidth(data->width, &data->min, &data->max, + &data->preferred); + return B_OK; +} + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BView::SetLayout(data->layout); + return B_OK; + } + case PERFORM_CODE_INVALIDATE_LAYOUT: + { + perform_data_invalidate_layout* data + = (perform_data_invalidate_layout*)_data; + BView::InvalidateLayout(data->descendants); + return B_OK; + } + case PERFORM_CODE_DO_LAYOUT: + { + BView::DoLayout(); + return B_OK; + } + } + + return BHandler::Perform(code, _data); } @@ -5305,16 +5355,106 @@ BView::_SwitchServerCurrentView() const } -extern "C" void _ReservedView1__5BView() {} -extern "C" void _ReservedView2__5BView() {} -extern "C" void _ReservedView3__5BView() {} -extern "C" void _ReservedView4__5BView() {} -extern "C" void _ReservedView5__5BView() {} -extern "C" void _ReservedView6__5BView() {} -extern "C" void _ReservedView7__5BView() {} -extern "C" void _ReservedView8__5BView() {} -extern "C" void _ReservedView9__5BView() {} -extern "C" void _ReservedView10__5BView() {} +extern "C" void +_ReservedView1__5BView(BView* view, BRect rect) +{ + view->BView::DrawAfterChildren(rect); +} + + +extern "C" void +_ReservedView2__5BView(BView* view) +{ + // MinSize() + perform_data_min_size data; + view->Perform(PERFORM_CODE_MIN_SIZE, &data); +} + + +extern "C" void +_ReservedView3__5BView(BView* view) +{ + // MaxSize() + perform_data_max_size data; + view->Perform(PERFORM_CODE_MAX_SIZE, &data); +} + + +extern "C" BSize +_ReservedView4__5BView(BView* view) +{ + // PreferredSize() + perform_data_preferred_size data; + view->Perform(PERFORM_CODE_PREFERRED_SIZE, &data); + return data.return_value; +} + + +extern "C" BAlignment +_ReservedView5__5BView(BView* view) +{ + // LayoutAlignment() + perform_data_layout_alignment data; + view->Perform(PERFORM_CODE_LAYOUT_ALIGNMENT, &data); + return data.return_value; +} + + +extern "C" bool +_ReservedView6__5BView(BView* view) +{ + // HasHeightForWidth() + perform_data_has_height_for_width data; + view->Perform(PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH, &data); + return data.return_value; +} + + +extern "C" void +_ReservedView7__5BView(BView* view, float width, float* min, float* max, + float* preferred) +{ + // GetHeightForWidth() + perform_data_get_height_for_width data; + data.width = width; + view->Perform(PERFORM_CODE_GET_HEIGHT_FOR_WIDTH, &data); + if (min != NULL) + *min = data.min; + if (max != NULL) + *max = data.max; + if (preferred != NULL) + *preferred = data.preferred; +} + + +extern "C" void +_ReservedView8__5BView(BView* view, BLayout* layout) +{ + // SetLayout() + perform_data_set_layout data; + data.layout = layout; + view->Perform(PERFORM_CODE_SET_LAYOUT, &data); +} + + +extern "C" void +_ReservedView9__5BView(BView* view, bool descendants) +{ + // InvalidateLayout() + perform_data_invalidate_layout data; + data.descendants = descendants; + view->Perform(PERFORM_CODE_INVALIDATE_LAYOUT, &data); +} + + +extern "C" void +_ReservedView10__5BView(BView* view) +{ + // DoLayout() + view->Perform(PERFORM_CODE_DO_LAYOUT, NULL); +} + + void BView::_ReservedView11(){} void BView::_ReservedView12(){} void BView::_ReservedView13(){} diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 049beb1368..2ca20d0173 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -2013,9 +2014,18 @@ BWindow::RemoveFromSubset(BWindow *window) status_t -BWindow::Perform(perform_code d, void *arg) +BWindow::Perform(perform_code code, void* _data) { - return BLooper::Perform(d, arg); + switch (code) { + case PERFORM_CODE_SET_LAYOUT: + { + perform_data_set_layout* data = (perform_data_set_layout*)_data; + BWindow::SetLayout(data->layout); + return B_OK; +} + } + + return BLooper::Perform(code, _data); } @@ -3624,9 +3634,12 @@ BWindow::IsFilePanel() const extern "C" void -_ReservedWindow1__7BWindow() +_ReservedWindow1__7BWindow(BWindow* window, BLayout* layout) { // SetLayout() + perform_data_set_layout data; + data.layout = layout; + window->Perform(PERFORM_CODE_SET_LAYOUT, &data); }