hrev47369 adds 2 changesets to branch 'master' old head: 4a2260f21ae708afb64c2bf13dd2ed4bd58705ea new head: 47852bff02be873c48ec9399e7cc119502bb8c67 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=47852bf+%5E4a2260f ---------------------------------------------------------------------------- 1f42463: Style fixes to IK, focus on docs 47852bf: IK documentation update * Add \since directive to each method. * Add documentation for BScrollBar and BScrollView classes. * Title Case group titles. * Some other minor documentation updates. [ John Scipione <jscipione@xxxxxxxxx> ] ---------------------------------------------------------------------------- 77 files changed, 6355 insertions(+), 2288 deletions(-) docs/user/interface/AbstractLayout.dox | 36 +- docs/user/interface/Alert.dox | 150 +++- docs/user/interface/Bitmap.dox | 116 ++- docs/user/interface/Box.dox | 71 +- docs/user/interface/Button.dox | 178 ++--- docs/user/interface/CheckBox.dox | 108 ++- docs/user/interface/ColorControl.dox | 92 ++- docs/user/interface/Control.dox | 195 ++--- docs/user/interface/Dragger.dox | 28 + docs/user/interface/Font.dox | 342 ++++++++- docs/user/interface/GraphicsDefs.dox | 20 + docs/user/interface/GridLayout.dox | 74 +- docs/user/interface/GroupLayout.dox | 61 +- docs/user/interface/IconUtils.dox | 18 + docs/user/interface/InterfaceDefs.dox | 60 ++ docs/user/interface/Layout.dox | 220 ++++-- docs/user/interface/LayoutBuilder.Group.dox | 107 ++- docs/user/interface/LayoutBuilder.dox | 10 +- docs/user/interface/LayoutItem.dox | 96 ++- docs/user/interface/ListItem.dox | 53 ++ docs/user/interface/ListView.dox | 219 ++++-- docs/user/interface/Menu.dox | 170 ++++- docs/user/interface/MenuBar.dox | 61 +- docs/user/interface/MenuField.dox | 108 ++- docs/user/interface/MenuItem.dox | 79 +- docs/user/interface/OutlineListView.dox | 129 +++- docs/user/interface/Picture.dox | 33 + docs/user/interface/PictureButton.dox | 159 ++-- docs/user/interface/Point.dox | 63 +- docs/user/interface/Polygon.dox | 26 +- docs/user/interface/PopUpMenu.dox | 53 +- docs/user/interface/RadioButton.dox | 151 ++-- docs/user/interface/Rect.dox | 141 +++- docs/user/interface/Region.dox | 108 ++- docs/user/interface/Screen.dox | 200 +++-- docs/user/interface/ScrollBar.dox | 580 +++++++++++++++ docs/user/interface/ScrollView.dox | 457 ++++++++++++ docs/user/interface/SeparatorItem.dox | 31 + docs/user/interface/StringItem.dox | 36 +- docs/user/interface/TextView.dox | 401 +++++++--- docs/user/interface/TwoDimensionalLayout.dox | 48 +- docs/user/interface/View.dox | 867 +++++++++++++++++----- docs/user/interface/Window.dox | 386 ++++++++-- headers/os/interface/Alert.h | 38 +- headers/os/interface/Button.h | 5 +- headers/os/interface/ChannelControl.h | 44 +- headers/os/interface/CheckBox.h | 2 +- headers/os/interface/ColorControl.h | 8 +- headers/os/interface/Control.h | 2 +- headers/os/interface/ListView.h | 6 +- headers/os/interface/MenuField.h | 2 +- headers/os/interface/OutlineListView.h | 36 +- headers/os/interface/PictureButton.h | 14 +- headers/os/interface/RadioButton.h | 4 +- headers/os/interface/Region.h | 4 +- headers/os/interface/ScrollBar.h | 58 +- headers/os/interface/ScrollView.h | 65 +- headers/os/interface/TextView.h | 12 +- headers/os/interface/View.h | 8 +- headers/os/interface/Window.h | 2 +- src/kits/interface/Alert.cpp | 24 +- src/kits/interface/Button.cpp | 8 +- src/kits/interface/ChannelControl.cpp | 286 ++++---- src/kits/interface/CheckBox.cpp | 4 +- src/kits/interface/ColorControl.cpp | 44 +- src/kits/interface/Control.cpp | 8 +- src/kits/interface/ListView.cpp | 32 +- src/kits/interface/MenuField.cpp | 8 +- src/kits/interface/OutlineListView.cpp | 5 +- src/kits/interface/PictureButton.cpp | 23 +- src/kits/interface/RadioButton.cpp | 8 +- src/kits/interface/Region.cpp | 29 +- src/kits/interface/ScrollBar.cpp | 895 +++++++++++------------ src/kits/interface/ScrollView.cpp | 334 ++++----- src/kits/interface/TextView.cpp | 35 +- src/kits/interface/View.cpp | 47 +- src/kits/interface/Window.cpp | 2 +- ############################################################################ Commit: 1f424632be5dcad5b81a23080eb205ab6471cd7b URL: http://cgit.haiku-os.org/haiku/commit/?id=1f42463 Author: John Scipione <jscipione@xxxxxxxxx> Date: Wed Jun 11 23:00:46 2014 UTC Style fixes to IK, focus on docs ---------------------------------------------------------------------------- diff --git a/headers/os/interface/Alert.h b/headers/os/interface/Alert.h index c6c66d5..3020b41 100644 --- a/headers/os/interface/Alert.h +++ b/headers/os/interface/Alert.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku, Inc. All rights reserved. + * Copyright 2001-2014 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _ALERT_H @@ -9,11 +9,6 @@ #include <Window.h> -class BBitmap; -class BButton; -class BInvoker; -class BTextView; - // enum for flavors of alert enum alert_type { B_EMPTY_ALERT = 0, @@ -29,41 +24,46 @@ enum button_spacing { }; +class BBitmap; +class BButton; +class BInvoker; +class BTextView; + class BAlert : public BWindow { - public: +public: BAlert(const char* title, const char* text, const char* button1, const char* button2 = NULL, const char* button3 = NULL, button_width width = B_WIDTH_AS_USUAL, alert_type type = B_INFO_ALERT); - BAlert(const char *title, const char *text, - const char *button1, const char *button2, - const char *button3, button_width width, + BAlert(const char* title, const char* text, + const char* button1, const char* button2, + const char* button3, button_width width, button_spacing spacing, alert_type type = B_INFO_ALERT); virtual ~BAlert(); // Archiving - BAlert(BMessage *data); - static BArchivable *Instantiate(BMessage *data); - virtual status_t Archive(BMessage *data, bool deep = true) const; + BAlert(BMessage* data); + static BArchivable *Instantiate(BMessage* data); + virtual status_t Archive(BMessage* data, bool deep = true) const; // BAlert guts void SetShortcut(int32 button_index, char key); char Shortcut(int32 button_index) const; int32 Go(); - status_t Go(BInvoker *invoker); + status_t Go(BInvoker* invoker); - virtual void MessageReceived(BMessage *an_event); + virtual void MessageReceived(BMessage* message); virtual void FrameResized(float new_width, float new_height); BButton* ButtonAt(int32 index) const; BTextView* TextView() const; virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 form, + BMessage* specifier, int32 what, const char* property); - virtual status_t GetSupportedSuites(BMessage *data); + virtual status_t GetSupportedSuites(BMessage* data); virtual void DispatchMessage(BMessage* message, BHandler* handler); virtual void Quit(); @@ -71,9 +71,9 @@ class BAlert : public BWindow { static BPoint AlertPosition(float width, float height); - virtual status_t Perform(perform_code d, void *arg); + virtual status_t Perform(perform_code d, void* arg); - private: +private: friend class _BAlertFilter_; virtual void _ReservedAlert1(); diff --git a/headers/os/interface/Button.h b/headers/os/interface/Button.h index 5cfcd98..703bb09 100644 --- a/headers/os/interface/Button.h +++ b/headers/os/interface/Button.h @@ -66,9 +66,9 @@ public: virtual void ResizeToPreferred(); virtual status_t Invoke(BMessage* message = NULL); virtual void FrameMoved(BPoint newPosition); - virtual void FrameResized(float width, float height); + virtual void FrameResized(float newWidth, float newHeight); - virtual void MakeFocus(bool focused = true); + virtual void MakeFocus(bool focus = true); virtual void AllAttached(); virtual void AllDetached(); @@ -78,7 +78,6 @@ public: virtual status_t GetSupportedSuites(BMessage* message); virtual status_t Perform(perform_code d, void* arg); - virtual BSize MinSize(); virtual BSize MaxSize(); virtual BSize PreferredSize(); diff --git a/headers/os/interface/ChannelControl.h b/headers/os/interface/ChannelControl.h index d457d22..3f9e5c8 100644 --- a/headers/os/interface/ChannelControl.h +++ b/headers/os/interface/ChannelControl.h @@ -5,34 +5,36 @@ #ifndef _CHANNEL_CONTROL_H #define _CHANNEL_CONTROL_H + //! BChannelControl is the base class for controls that have several // independent values, with minima and maxima. #include <Control.h> #include <String.h> + class BChannelControl : public BControl { public: BChannelControl(BRect frame, const char* name, const char* label, BMessage* model, int32 channelCount = 1, - uint32 resizeFlags + uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, - uint32 viewFlags = B_WILL_DRAW); + uint32 flags = B_WILL_DRAW); BChannelControl(const char* name, const char* label, BMessage* model, int32 channelCount = 1, - uint32 viewFlags = B_WILL_DRAW); + uint32 flags = B_WILL_DRAW); BChannelControl(BMessage* archive); virtual ~BChannelControl(); - virtual status_t Archive(BMessage* into, bool deep = true) const; + virtual status_t Archive(BMessage* data, bool deep = true) const; virtual void Draw(BRect updateRect) = 0; virtual void MouseDown(BPoint where) = 0; - virtual void KeyDown(const char* bytes, int32 size) = 0; + virtual void KeyDown(const char* bytes, int32 numBytes) = 0; - virtual void FrameResized(float width, float height); + virtual void FrameResized(float newWidth, float newHeight); virtual void SetFont(const BFont* font, uint32 mask = B_FONT_ALL); @@ -45,14 +47,14 @@ public: virtual void MessageReceived(BMessage* message); virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 form, + BMessage* specifier, int32 what, const char* property); virtual status_t GetSupportedSuites(BMessage* data); virtual void SetModificationMessage(BMessage* message); BMessage* ModificationMessage() const; - - virtual status_t Invoke(BMessage* withMessage = NULL); + + virtual status_t Invoke(BMessage* message = NULL); //! These methods are similar to Invoke() Invoke() and InvokeNotify(), but // include additional information about all of the channels in the control. @@ -112,18 +114,18 @@ private: BChannelControl(const BChannelControl& other); BChannelControl& operator=(const BChannelControl& other); - virtual void _Reserverd_ChannelControl_0(void *, ...); - virtual void _Reserverd_ChannelControl_1(void *, ...); - virtual void _Reserverd_ChannelControl_2(void *, ...); - virtual void _Reserverd_ChannelControl_3(void *, ...); - virtual void _Reserverd_ChannelControl_4(void *, ...); - virtual void _Reserverd_ChannelControl_5(void *, ...); - virtual void _Reserverd_ChannelControl_6(void *, ...); - virtual void _Reserverd_ChannelControl_7(void *, ...); - virtual void _Reserverd_ChannelControl_8(void *, ...); - virtual void _Reserverd_ChannelControl_9(void *, ...); - virtual void _Reserverd_ChannelControl_10(void *, ...); - virtual void _Reserverd_ChannelControl_11(void *, ...); + virtual void _Reserverd_ChannelControl_0(void*, ...); + virtual void _Reserverd_ChannelControl_1(void*, ...); + virtual void _Reserverd_ChannelControl_2(void*, ...); + virtual void _Reserverd_ChannelControl_3(void*, ...); + virtual void _Reserverd_ChannelControl_4(void*, ...); + virtual void _Reserverd_ChannelControl_5(void*, ...); + virtual void _Reserverd_ChannelControl_6(void*, ...); + virtual void _Reserverd_ChannelControl_7(void*, ...); + virtual void _Reserverd_ChannelControl_8(void*, ...); + virtual void _Reserverd_ChannelControl_9(void*, ...); + virtual void _Reserverd_ChannelControl_10(void*, ...); + virtual void _Reserverd_ChannelControl_11(void*, ...); protected: inline int32* const& MinLimitList() const; diff --git a/headers/os/interface/CheckBox.h b/headers/os/interface/CheckBox.h index 15ec2e7..674a701 100644 --- a/headers/os/interface/CheckBox.h +++ b/headers/os/interface/CheckBox.h @@ -36,7 +36,7 @@ public: virtual void AllDetached(); virtual void FrameMoved(BPoint newPosition); - virtual void FrameResized(float width, float height); + virtual void FrameResized(float newWidth, float newHeight); virtual void WindowActivated(bool active); virtual void MessageReceived(BMessage* message); diff --git a/headers/os/interface/ColorControl.h b/headers/os/interface/ColorControl.h index b686177..2bcf0a0 100644 --- a/headers/os/interface/ColorControl.h +++ b/headers/os/interface/ColorControl.h @@ -29,11 +29,11 @@ public: float cellSize, const char* name, BMessage* message = NULL, bool useOffscreen = false); - BColorControl(BMessage* archive); + BColorControl(BMessage* data); virtual ~BColorControl(); - static BArchivable* Instantiate(BMessage* archive); - virtual status_t Archive(BMessage* archive, + static BArchivable* Instantiate(BMessage* data); + virtual status_t Archive(BMessage* data, bool deep = true) const; virtual void SetLayout(BLayout* layout); @@ -91,7 +91,7 @@ private: void _InitData(color_control_layout layout, float size, bool useOffscreen, - BMessage* archive = NULL); + BMessage* data = NULL); void _LayoutView(); void _InitOffscreen(); void _InvalidateSelector(int16 ramp, diff --git a/headers/os/interface/Control.h b/headers/os/interface/Control.h index a62190d..94edfd7 100644 --- a/headers/os/interface/Control.h +++ b/headers/os/interface/Control.h @@ -45,7 +45,7 @@ public: virtual void AllDetached(); virtual void MessageReceived(BMessage* message); - virtual void MakeFocus(bool focused = true); + virtual void MakeFocus(bool focus = true); virtual void KeyDown(const char* bytes, int32 numBytes); virtual void MouseDown(BPoint where); diff --git a/headers/os/interface/ListView.h b/headers/os/interface/ListView.h index bca5b93..311fa77 100644 --- a/headers/os/interface/ListView.h +++ b/headers/os/interface/ListView.h @@ -53,8 +53,8 @@ public: virtual void AllDetached(); virtual void FrameResized(float newWidth, float newHeight); virtual void FrameMoved(BPoint newPosition); - virtual void TargetedByScrollView(BScrollView* scroller); - virtual void WindowActivated(bool state); + virtual void TargetedByScrollView(BScrollView* view); + virtual void WindowActivated(bool active); virtual void MessageReceived(BMessage* message); virtual void KeyDown(const char* bytes, int32 numBytes); @@ -142,7 +142,7 @@ public: virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, - int32 form, const char* property); + int32 what, const char* property); virtual status_t GetSupportedSuites(BMessage* data); virtual status_t Perform(perform_code code, void* arg); diff --git a/headers/os/interface/MenuField.h b/headers/os/interface/MenuField.h index 55491d3..bbc95ab 100644 --- a/headers/os/interface/MenuField.h +++ b/headers/os/interface/MenuField.h @@ -45,7 +45,7 @@ public: virtual void KeyDown(const char* bytes, int32 numBytes); virtual void MakeFocus(bool focused); virtual void MessageReceived(BMessage* message); - virtual void WindowActivated(bool state); + virtual void WindowActivated(bool active); virtual void MouseUp(BPoint where); virtual void MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage); diff --git a/headers/os/interface/OutlineListView.h b/headers/os/interface/OutlineListView.h index 08de397..2dc58ce 100644 --- a/headers/os/interface/OutlineListView.h +++ b/headers/os/interface/OutlineListView.h @@ -24,7 +24,7 @@ public: uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); BOutlineListView(BMessage* archive); - virtual ~BOutlineListView(); + virtual ~BOutlineListView(); static BArchivable* Instantiate(BMessage* archive); virtual status_t Archive(BMessage* archive, @@ -36,16 +36,16 @@ public: virtual void FrameResized(float newWidth, float newHeight); virtual void MouseUp(BPoint where); - virtual bool AddUnder(BListItem* item, BListItem* superItem); + virtual bool AddUnder(BListItem* item, BListItem* superItem); - virtual bool AddItem(BListItem* item); - virtual bool AddItem(BListItem* item, int32 fullListIndex); - virtual bool AddList(BList* newItems); - virtual bool AddList(BList* newItems, int32 fullListIndex); + virtual bool AddItem(BListItem* item); + virtual bool AddItem(BListItem* item, int32 fullListIndex); + virtual bool AddList(BList* newItems); + virtual bool AddList(BList* newItems, int32 fullListIndex); - virtual bool RemoveItem(BListItem* item); - virtual BListItem* RemoveItem(int32 fullListIndex); - virtual bool RemoveItems(int32 fullListIndex, int32 count); + virtual bool RemoveItem(BListItem* item); + virtual BListItem* RemoveItem(int32 fullListIndex); + virtual bool RemoveItems(int32 fullListIndex, int32 count); BListItem* FullListItemAt(int32 fullListIndex) const; int32 FullListIndexOf(BPoint where) const; @@ -70,19 +70,19 @@ public: bool IsExpanded(int32 fullListIndex); - virtual BHandler* ResolveSpecifier(BMessage* message, + virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, int32 what, const char* property); - virtual status_t GetSupportedSuites(BMessage* data); - virtual status_t Perform(perform_code code, void* data); + virtual status_t GetSupportedSuites(BMessage* data); + virtual status_t Perform(perform_code code, void* data); - virtual void ResizeToPreferred(); - virtual void GetPreferredSize(float* _width, + virtual void ResizeToPreferred(); + virtual void GetPreferredSize(float* _width, float* _height); - virtual void MakeFocus(bool focus = true); - virtual void AllAttached(); - virtual void AllDetached(); - virtual void DetachedFromWindow(); + virtual void MakeFocus(bool focus = true); + virtual void AllAttached(); + virtual void AllDetached(); + virtual void DetachedFromWindow(); void FullListSortItems(int (*compareFunc)( const BListItem* first, diff --git a/headers/os/interface/PictureButton.h b/headers/os/interface/PictureButton.h index bf70650..904ff46 100644 --- a/headers/os/interface/PictureButton.h +++ b/headers/os/interface/PictureButton.h @@ -41,11 +41,11 @@ public: virtual void ResizeToPreferred(); virtual void GetPreferredSize(float* _width, float* _height); - virtual void FrameMoved(BPoint position); - virtual void FrameResized(float width, float height); + virtual void FrameMoved(BPoint newPosition); + virtual void FrameResized(float newWidth, float newHeight); - virtual void WindowActivated(bool state); - virtual void MakeFocus(bool state = true); + virtual void WindowActivated(bool active); + virtual void MakeFocus(bool focus = true); virtual void Draw(BRect updateRect); @@ -53,8 +53,8 @@ public: virtual void KeyDown(const char* bytes, int32 numBytes); virtual void MouseDown(BPoint where); virtual void MouseUp(BPoint where); - virtual void MouseMoved(BPoint where, uint32 transit, - const BMessage* message); + virtual void MouseMoved(BPoint where, uint32 code, + const BMessage* dragMessage); virtual void SetEnabledOn(BPicture* picture); virtual void SetEnabledOff(BPicture* picture); @@ -74,7 +74,7 @@ public: virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, - int32 form, const char* property); + int32 what, const char* property); virtual status_t GetSupportedSuites(BMessage* data); virtual status_t Perform(perform_code code, void* data); diff --git a/headers/os/interface/RadioButton.h b/headers/os/interface/RadioButton.h index 0f8b037..6a218db 100644 --- a/headers/os/interface/RadioButton.h +++ b/headers/os/interface/RadioButton.h @@ -46,13 +46,13 @@ public: const BMessage* dragMessage); virtual void DetachedFromWindow(); virtual void FrameMoved(BPoint newPosition); - virtual void FrameResized(float width, float height); + virtual void FrameResized(float newWidth, float newHeight); virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, int32 what, const char* property); - virtual void MakeFocus(bool focused = true); + virtual void MakeFocus(bool focus = true); virtual void AllAttached(); virtual void AllDetached(); virtual status_t GetSupportedSuites(BMessage* message); diff --git a/headers/os/interface/Region.h b/headers/os/interface/Region.h index 8872b4f..9c1e1b0 100644 --- a/headers/os/interface/Region.h +++ b/headers/os/interface/Region.h @@ -34,8 +34,8 @@ public: BRegion& operator=(const BRegion& other); bool operator==(const BRegion& other) const; - void Set(BRect newBounds); - void Set(clipping_rect newBounds); + void Set(BRect rect); + void Set(clipping_rect clipping); BRect Frame() const; clipping_rect FrameInt() const; diff --git a/headers/os/interface/ScrollBar.h b/headers/os/interface/ScrollBar.h index 65a62e7..873ab84 100644 --- a/headers/os/interface/ScrollBar.h +++ b/headers/os/interface/ScrollBar.h @@ -33,11 +33,33 @@ public: virtual status_t Archive(BMessage* archive, bool deep = true) const; + virtual void AllAttached(); + virtual void AllDetached(); + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + + virtual void Draw(BRect updateRect); + virtual void FrameMoved(BPoint new_position); + virtual void FrameResized(float newWidth, float newHeight); + + virtual void MessageReceived(BMessage* message); + + virtual void MouseDown(BPoint where); + virtual void MouseUp(BPoint where); + virtual void MouseMoved(BPoint where, uint32 code, + const BMessage* dragMessage); + +#if DISABLES_ON_WINDOW_DEACTIVATION + virtual void WindowActivated(bool active); +#endif + void SetValue(float value); float Value() const; + void SetProportion(float); float Proportion() const; + virtual void ValueChanged(float newValue); void SetRange(float min, float max); @@ -45,10 +67,12 @@ public: void SetSteps(float smallStep, float largeStep); void GetSteps(float* _smallStep, float* _largeStep) const; + void SetTarget(BView *target); void SetTarget(const char* targetName); BView* Target() const; - void SetOrientation(orientation orientation); + + void SetOrientation(orientation direction); orientation Orientation() const; // TODO: Make this a virtual method, it should be one, @@ -56,39 +80,23 @@ public: // to be used in case the BScrollBar should draw part of // the focus indication of the target view for aesthetical // reasons. BScrollView will forward this method. - status_t SetBorderHighlighted(bool state); + status_t SetBorderHighlighted(bool highlight); - virtual void MessageReceived(BMessage* message); - virtual void MouseDown(BPoint pt); - virtual void MouseUp(BPoint pt); - virtual void MouseMoved(BPoint pt, uint32 code, - const BMessage* dragMessage); - virtual void DetachedFromWindow(); - virtual void Draw(BRect updateRect); - virtual void FrameMoved(BPoint new_position); - virtual void FrameResized(float newWidth, float newHeight); - - virtual BHandler* ResolveSpecifier(BMessage* message, - int32 index, BMessage* specifier, - int32 form, const char* property); - - virtual void ResizeToPreferred(); virtual void GetPreferredSize(float* _width, float* _height); - virtual void MakeFocus(bool state = true); - virtual void AllAttached(); - virtual void AllDetached(); - virtual status_t GetSupportedSuites(BMessage* data); + virtual void ResizeToPreferred(); + virtual void MakeFocus(bool focus = true); virtual BSize MinSize(); virtual BSize MaxSize(); virtual BSize PreferredSize(); - virtual status_t Perform(perform_code d, void* arg); + virtual status_t GetSupportedSuites(BMessage* message); + virtual BHandler* ResolveSpecifier(BMessage* message, + int32 index, BMessage* specifier, + int32 what, const char* property); -#if DISABLES_ON_WINDOW_DEACTIVATION - virtual void WindowActivated(bool active); -#endif + virtual status_t Perform(perform_code d, void* arg); private: class Private; diff --git a/headers/os/interface/ScrollView.h b/headers/os/interface/ScrollView.h index 8a0214e..8caf7cf 100644 --- a/headers/os/interface/ScrollView.h +++ b/headers/os/interface/ScrollView.h @@ -1,6 +1,11 @@ /* - * Copyright 2004-2009, Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2004-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx. + * Copyright 2014 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@xxxxxxxxxxxxxxxx + * John Scipione, jscpione@xxxxxxxxx */ #ifndef _SCROLL_VIEW_H #define _SCROLL_VIEW_H @@ -28,55 +33,57 @@ public: virtual ~BScrollView(); static BArchivable* Instantiate(BMessage* archive); - virtual status_t Archive(BMessage* archive, - bool deep = true) const; + virtual status_t Archive(BMessage* archive, bool deep = true) const; - virtual void AttachedToWindow(); - virtual void DetachedFromWindow(); + // Hook methods virtual void AllAttached(); virtual void AllDetached(); - virtual void Draw(BRect updateRect); + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); - virtual void WindowActivated(bool active); - virtual void MakeFocus(bool state = true); + virtual void Draw(BRect updateRect); + virtual void FrameMoved(BPoint newPosition); + virtual void FrameResized(float newWidth, float newHeight); - virtual void GetPreferredSize(float* _width, - float* _height); - virtual BSize MinSize(); - virtual BSize MaxSize(); - virtual BSize PreferredSize(); - virtual void ResizeToPreferred(); + virtual void MessageReceived(BMessage* message); + + virtual void MouseDown(BPoint where); + virtual void MouseMoved(BPoint where, uint32 code, + const BMessage* dragMessage); + virtual void MouseUp(BPoint where); - virtual void FrameMoved(BPoint position); - virtual void FrameResized(float width, float height); + virtual void WindowActivated(bool active); - virtual void MessageReceived(BMessage* message); + // Size + virtual void GetPreferredSize(float* _width, float* _height); + virtual void ResizeToPreferred(); - virtual void MouseDown(BPoint point); - virtual void MouseUp(BPoint point); - virtual void MouseMoved(BPoint point, uint32 code, - const BMessage* dragMessage); + virtual void MakeFocus(bool focus = true); + + virtual BSize MinSize(); + virtual BSize MaxSize(); + virtual BSize PreferredSize(); - // BScrollView + // BScrollBar BScrollBar* ScrollBar(orientation posture) const; - virtual void SetBorder(border_style border); + virtual void SetBorder(border_style border); border_style Border() const; - virtual status_t SetBorderHighlighted(bool state); + virtual status_t SetBorderHighlighted(bool highlight); bool IsBorderHighlighted() const; void SetTarget(BView* target); BView* Target() const; // Scripting - virtual BHandler* ResolveSpecifier(BMessage* message, + virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, - int32 form, const char* property); - virtual status_t GetSupportedSuites(BMessage* data); + int32 what, const char* property); + virtual status_t GetSupportedSuites(BMessage* message); - virtual status_t Perform(perform_code d, void* arg); + virtual status_t Perform(perform_code d, void* arg); protected: virtual void LayoutInvalidated(bool descendants = false); diff --git a/headers/os/interface/TextView.h b/headers/os/interface/TextView.h index 85f3443..10366a5 100644 --- a/headers/os/interface/TextView.h +++ b/headers/os/interface/TextView.h @@ -75,11 +75,11 @@ public: virtual void MouseUp(BPoint where); virtual void MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage); - virtual void WindowActivated(bool state); + virtual void WindowActivated(bool active); virtual void KeyDown(const char* bytes, int32 numBytes); virtual void Pulse(); - virtual void FrameResized(float width, float height); - virtual void MakeFocus(bool focusState = true); + virtual void FrameResized(float newWidth, float newHeight); + virtual void MakeFocus(bool focus = true); virtual void MessageReceived(BMessage* message); virtual BHandler* ResolveSpecifier(BMessage* message, @@ -114,7 +114,7 @@ public: int32 CountLines() const; int32 CurrentLine() const; - void GoToLine(int32 lineIndex); + void GoToLine(int32 lineNumber); virtual void Cut(BClipboard* clipboard); virtual void Copy(BClipboard* clipboard); @@ -159,8 +159,8 @@ public: virtual bool CanEndLine(int32 offset); - float LineWidth(int32 lineIndex = 0) const; - float LineHeight(int32 lineIndex = 0) const; + float LineWidth(int32 lineNumber = 0) const; + float LineHeight(int32 lineNumber = 0) const; float TextHeight(int32 startLine, int32 endLine) const; diff --git a/headers/os/interface/View.h b/headers/os/interface/View.h index 75cf80b..49e7519 100644 --- a/headers/os/interface/View.h +++ b/headers/os/interface/View.h @@ -170,7 +170,7 @@ public: virtual void MouseUp(BPoint where); virtual void MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage); - virtual void WindowActivated(bool state); + virtual void WindowActivated(bool active); virtual void KeyDown(const char* bytes, int32 numBytes); virtual void KeyUp(const char* bytes, int32 numBytes); virtual void Pulse(); @@ -285,7 +285,7 @@ public: void SetFillRule(int32 rule); int32 FillRule() const; - void SetOrigin(BPoint pt); + void SetOrigin(BPoint where); void SetOrigin(float x, float y); BPoint Origin() const; @@ -522,7 +522,7 @@ public: void ScrollBy(float dh, float dv); void ScrollTo(float x, float y); virtual void ScrollTo(BPoint where); - virtual void MakeFocus(bool focusState = true); + virtual void MakeFocus(bool focus = true); bool IsFocus() const; virtual void Show(); @@ -536,7 +536,7 @@ public: virtual void GetPreferredSize(float* _width, float* _height); virtual void ResizeToPreferred(); - BScrollBar* ScrollBar(orientation posture) const; + BScrollBar* ScrollBar(orientation direction) const; virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, int32 form, diff --git a/headers/os/interface/Window.h b/headers/os/interface/Window.h index bc8eb16..2caec31 100644 --- a/headers/os/interface/Window.h +++ b/headers/os/interface/Window.h @@ -149,7 +149,7 @@ public: BView* CurrentFocus() const; void Activate(bool = true); - virtual void WindowActivated(bool state); + virtual void WindowActivated(bool focus); void ConvertToScreen(BPoint* point) const; BPoint ConvertToScreen(BPoint point) const; diff --git a/src/kits/interface/Alert.cpp b/src/kits/interface/Alert.cpp index 16231f5..19d093a 100644 --- a/src/kits/interface/Alert.cpp +++ b/src/kits/interface/Alert.cpp @@ -1,13 +1,16 @@ /* - * Copyright 2001-2008, Haiku. + * Copyright 2001-2015 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: - * Erik Jaesler (erik@xxxxxxxxxxxxxx) * Axel Dörfler, axeld@xxxxxxxxxxxxxxxx + * Erik Jaesler, erik@xxxxxxxxxxxxxx + * John Scipione, jscipione@xxxxxxxxx */ -//! BAlert displays a modal alert window. + +// BAlert displays a modal alert window. + #include <new> #include <stdio.h> @@ -304,13 +307,13 @@ BAlert::Go(BInvoker* invoker) void -BAlert::MessageReceived(BMessage* msg) +BAlert::MessageReceived(BMessage* message) { - if (msg->what != kAlertButtonMsg) - return BWindow::MessageReceived(msg); + if (message->what != kAlertButtonMsg) + return BWindow::MessageReceived(message); int32 which; - if (msg->FindInt32("which", &which) == B_OK) { + if (message->FindInt32("which", &which) == B_OK) { if (fAlertSem < B_OK) { // Semaphore hasn't been created; we're running asynchronous if (fInvoker) { @@ -361,10 +364,11 @@ BAlert::TextView() const BHandler* -BAlert::ResolveSpecifier(BMessage* msg, int32 index, - BMessage* specifier, int32 form, const char* property) +BAlert::ResolveSpecifier(BMessage* message, int32 index, + BMessage* specifier, int32 what, const char* property) { - return BWindow::ResolveSpecifier(msg, index, specifier, form, property); + return BWindow::ResolveSpecifier(message, index, specifier, what, + property); } diff --git a/src/kits/interface/Button.cpp b/src/kits/interface/Button.cpp index db149c6..fc1dc41 100644 --- a/src/kits/interface/Button.cpp +++ b/src/kits/interface/Button.cpp @@ -469,16 +469,16 @@ BButton::FrameMoved(BPoint newPosition) void -BButton::FrameResized(float width, float height) +BButton::FrameResized(float newWidth, float newHeight) { - BControl::FrameResized(width, height); + BControl::FrameResized(newWidth, newHeight); } void -BButton::MakeFocus(bool focused) +BButton::MakeFocus(bool focus) { - BControl::MakeFocus(focused); + BControl::MakeFocus(focus); } diff --git a/src/kits/interface/ChannelControl.cpp b/src/kits/interface/ChannelControl.cpp index 39170cd..1d1ccfa 100644 --- a/src/kits/interface/ChannelControl.cpp +++ b/src/kits/interface/ChannelControl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2009, Haiku Inc. All Rights Reserved. + * Copyright 2005-2014 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -14,29 +14,31 @@ sPropertyInfo[] = { { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_INT32_TYPE } }, - + { "CurrentChannel", { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, - { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_INT32_TYPE } + { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_INT32_TYPE } }, - + { "MaxLimitLabel", { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, - { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_STRING_TYPE } + { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_STRING_TYPE } }, - + { "MinLimitLabel", { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, - { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_STRING_TYPE } + { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_STRING_TYPE } }, - + { 0 } }; -BChannelControl::BChannelControl(BRect frame, const char *name, const char *label, - BMessage *model, int32 channel_count, uint32 resizeMode, uint32 flags) - : BControl(frame, name, label, model, resizeMode, flags), +BChannelControl::BChannelControl(BRect frame, const char* name, + const char* label, BMessage* model, int32 channel_count, + uint32 resizingMode, uint32 flags) + : + BControl(frame, name, label, model, resizingMode, flags), fChannelCount(channel_count), fCurrentChannel(0), fChannelMin(NULL), @@ -47,7 +49,7 @@ BChannelControl::BChannelControl(BRect frame, const char *name, const char *labe { fChannelMin = new int32[channel_count]; memset(fChannelMin, 0, sizeof(int32) * channel_count); - + fChannelMax = new int32[channel_count]; for (int32 i = 0; i < channel_count; i++) fChannelMax[i] = 100; @@ -57,10 +59,11 @@ BChannelControl::BChannelControl(BRect frame, const char *name, const char *labe } -BChannelControl::BChannelControl(const char *name, const char *label, - BMessage *model, int32 channel_count, uint32 flags) - : BControl(name, label, model, flags), - fChannelCount(channel_count), +BChannelControl::BChannelControl(const char* name, const char* label, + BMessage* model, int32 channelCount, uint32 flags) + : + BControl(name, label, model, flags), + fChannelCount(channelCount), fCurrentChannel(0), fChannelMin(NULL), fChannelMax(NULL), @@ -68,20 +71,21 @@ BChannelControl::BChannelControl(const char *name, const char *label, fMultiLabels(NULL), fModificationMsg(NULL) { - fChannelMin = new int32[channel_count]; - memset(fChannelMin, 0, sizeof(int32) * channel_count); + fChannelMin = new int32[channelCount]; + memset(fChannelMin, 0, sizeof(int32) * channelCount); - fChannelMax = new int32[channel_count]; - for (int32 i = 0; i < channel_count; i++) + fChannelMax = new int32[channelCount]; + for (int32 i = 0; i < channelCount; i++) fChannelMax[i] = 100; - fChannelValues = new int32[channel_count]; - memset(fChannelValues, 0, sizeof(int32) * channel_count); + fChannelValues = new int32[channelCount]; + memset(fChannelValues, 0, sizeof(int32) * channelCount); } -BChannelControl::BChannelControl(BMessage *archive) - : BControl(archive), +BChannelControl::BChannelControl(BMessage* archive) + : + BControl(archive), fChannelCount(0), fCurrentChannel(0), fChannelMin(NULL), @@ -92,37 +96,37 @@ BChannelControl::BChannelControl(BMessage *archive) { archive->FindInt32("be:_m_channel_count", &fChannelCount); archive->FindInt32("be:_m_value_channel", &fCurrentChannel); - + if (fChannelCount > 0) { fChannelMin = new int32[fChannelCount]; memset(fChannelMin, 0, sizeof(int32) * fChannelCount); - + fChannelMax = new int32[fChannelCount]; for (int32 i = 0; i < fChannelCount; i++) fChannelMax[i] = 100; - + fChannelValues = new int32[fChannelCount]; memset(fChannelValues, 0, sizeof(int32) * fChannelCount); - + for (int32 c = 0; c < fChannelCount; c++) { archive->FindInt32("be:_m_channel_min", c, &fChannelMin[c]); archive->FindInt32("be:_m_channel_max", c, &fChannelMax[c]); archive->FindInt32("be:_m_channel_val", c, &fChannelValues[c]); } } - - const char *label = NULL; + + const char* label = NULL; if (archive->FindString("be:_m_min_label", &label) == B_OK) fMinLabel = label; + if (archive->FindString("be:_m_max_label", &label) == B_OK) fMaxLabel = label; - - BMessage *modificationMessage = new BMessage; + + BMessage* modificationMessage = new BMessage; if (archive->FindMessage("_mod_msg", modificationMessage) == B_OK) fModificationMsg = modificationMessage; else delete modificationMessage; - } @@ -136,28 +140,33 @@ BChannelControl::~BChannelControl() status_t -BChannelControl::Archive(BMessage *message, bool deep) const +BChannelControl::Archive(BMessage* data, bool deep) const { - status_t status = BControl::Archive(message, deep); + status_t status = BControl::Archive(data, deep); if (status == B_OK) - status = message->AddInt32("be:_m_channel_count", fChannelCount); + status = data->AddInt32("be:_m_channel_count", fChannelCount); + if (status == B_OK) - status = message->AddInt32("be:_m_value_channel", fCurrentChannel); + status = data->AddInt32("be:_m_value_channel", fCurrentChannel); + if (status == B_OK) - status = message->AddString("be:_m_min_label", fMinLabel.String()); + status = data->AddString("be:_m_min_label", fMinLabel.String()); + if (status == B_OK) - status = message->AddString("be:_m_max_label", fMaxLabel.String()); - + status = data->AddString("be:_m_max_label", fMaxLabel.String()); + if (status == B_OK && fChannelValues != NULL && fChannelMax != NULL && fChannelMin != NULL) { for (int32 i = 0; i < fChannelCount; i++) { - status = message->AddInt32("be:_m_channel_min", fChannelMin[i]); + status = data->AddInt32("be:_m_channel_min", fChannelMin[i]); if (status < B_OK) break; - status = message->AddInt32("be:_m_channel_max", fChannelMax[i]); + + status = data->AddInt32("be:_m_channel_max", fChannelMax[i]); if (status < B_OK) break; - status = message->AddInt32("be:_m_channel_val", fChannelValues[i]); + + status = data->AddInt32("be:_m_channel_val", fChannelValues[i]); if (status < B_OK) break; } @@ -168,14 +177,14 @@ BChannelControl::Archive(BMessage *message, bool deep) const void -BChannelControl::FrameResized(float width, float height) +BChannelControl::FrameResized(float newWidth, float newHeight) { - BView::FrameResized(width, height); + BView::FrameResized(newWidth, newHeight); } void -BChannelControl::SetFont(const BFont *font, uint32 mask) +BChannelControl::SetFont(const BFont* font, uint32 mask) { BView::SetFont(font, mask); } @@ -203,31 +212,34 @@ BChannelControl::ResizeToPreferred() void -BChannelControl::MessageReceived(BMessage *message) +BChannelControl::MessageReceived(BMessage* message) { BControl::MessageReceived(message); } -BHandler * -BChannelControl::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier, - int32 form, const char *property) +BHandler* +BChannelControl::ResolveSpecifier(BMessage* message, int32 index, + BMessage* specifier, int32 what, const char* property) { - BHandler *target = this; + BHandler* target = this; BPropertyInfo propertyInfo(sPropertyInfo); - if (propertyInfo.FindMatch(msg, index, specifier, form, property) < B_OK) - target = BControl::ResolveSpecifier(msg, index, specifier, form, property); - + if (propertyInfo.FindMatch(message, index, specifier, what, property) + < B_OK) { + target = BControl::ResolveSpecifier(message, index, specifier, + what, property); + } + return target; } status_t -BChannelControl::GetSupportedSuites(BMessage *data) +BChannelControl::GetSupportedSuites(BMessage* data) { if (data == NULL) return B_BAD_VALUE; - + status_t err = data->AddString("suites", "suite/vnd.Be-channel-control"); BPropertyInfo propertyInfo(sPropertyInfo); @@ -236,19 +248,20 @@ BChannelControl::GetSupportedSuites(BMessage *data) if (err == B_OK) return BControl::GetSupportedSuites(data); + return err; } void -BChannelControl::SetModificationMessage(BMessage *message) +BChannelControl::SetModificationMessage(BMessage* message) { delete fModificationMsg; fModificationMsg = message; } -BMessage * +BMessage* BChannelControl::ModificationMessage() const { return fModificationMsg; @@ -256,13 +269,13 @@ BChannelControl::ModificationMessage() const status_t -BChannelControl::Invoke(BMessage *msg) +BChannelControl::Invoke(BMessage* message) { bool notify = false; BMessage invokeMessage(InvokeKind(¬ify)); - if (msg != NULL) - invokeMessage = *msg; + if (message != NULL) + invokeMessage = *message; else if (Message() != NULL) invokeMessage = *Message(); @@ -273,39 +286,39 @@ BChannelControl::Invoke(BMessage *msg) status_t -BChannelControl::InvokeChannel(BMessage *msg, int32 fromChannel, - int32 channelCount, const bool *inMask) +BChannelControl::InvokeChannel(BMessage* message, int32 fromChannel, + int32 channelCount, const bool* _mask) { bool notify = false; BMessage invokeMessage(InvokeKind(¬ify)); - if (msg != NULL) - invokeMessage = *msg; + if (message != NULL) + invokeMessage = *message; else if (Message() != NULL) invokeMessage = *Message(); - + invokeMessage.AddInt32("be:current_channel", fCurrentChannel); - if (channelCount < 0) channelCount = fChannelCount - fromChannel; - + for (int32 i = 0; i < channelCount; i++) { - invokeMessage.AddInt32("be:channel_value", fChannelValues[fromChannel + i]); - invokeMessage.AddBool("be:channel_changed", inMask ? inMask[i] : true); + invokeMessage.AddInt32("be:channel_value", + fChannelValues[fromChannel + i]); + invokeMessage.AddBool("be:channel_changed", _mask ? _mask[i] : true); } - + return BControl::Invoke(&invokeMessage); } status_t -BChannelControl::InvokeNotifyChannel(BMessage *msg, uint32 kind, - int32 fromChannel, int32 channelCount, const bool *inMask) +BChannelControl::InvokeNotifyChannel(BMessage* message, uint32 kind, + int32 fromChannel, int32 channelCount, const bool* _mask) { BeginInvokeNotify(kind); - status_t status = InvokeChannel(msg, fromChannel, channelCount, inMask); + status_t status = InvokeChannel(message, fromChannel, channelCount, _mask); EndInvokeNotify(); - + return status; } @@ -316,10 +329,10 @@ BChannelControl::SetValue(int32 value) // Get real if (value > fChannelMax[fCurrentChannel]) value = fChannelMax[fCurrentChannel]; - + if (value < fChannelMin[fCurrentChannel]) value = fChannelMin[fCurrentChannel]; - + if (value != fChannelValues[fCurrentChannel]) { StuffValues(fCurrentChannel, 1, &value); BControl::SetValue(value); @@ -332,12 +345,12 @@ BChannelControl::SetCurrentChannel(int32 channel) { if (channel < 0 || channel >= fChannelCount) return B_BAD_INDEX; - + if (channel != fCurrentChannel) { fCurrentChannel = channel; BControl::SetValue(fChannelValues[fCurrentChannel]); } - + return B_OK; } @@ -364,25 +377,25 @@ BChannelControl::SetChannelCount(int32 channel_count) // TODO: Currently we only grow the buffer. Test what BeOS does if (channel_count > fChannelCount) { - int32 *newMin = new int32[channel_count]; - int32 *newMax = new int32[channel_count]; - int32 *newVal = new int32[channel_count]; - + int32* newMin = new int32[channel_count]; + int32* newMax = new int32[channel_count]; + int32* newVal = new int32[channel_count]; + memcpy(newMin, fChannelMin, fChannelCount); memcpy(newMax, fChannelMax, fChannelCount); memcpy(newVal, fChannelValues, fChannelCount); - + delete[] fChannelMin; delete[] fChannelMax; delete[] fChannelValues; - + fChannelMin = newMin; fChannelMax = newMax; fChannelValues = newVal; } - + fChannelCount = channel_count; - + return B_OK; } @@ -393,13 +406,13 @@ BChannelControl::ValueFor(int32 channel) const int32 value = 0; if (GetValue(&value, channel, 1) <= 0) return -1; - + return value; } int32 -BChannelControl::GetValue(int32 *outValues, int32 fromChannel, +BChannelControl::GetValue(int32* outValues, int32 fromChannel, int32 channelCount) const { int32 i = 0; @@ -419,23 +432,23 @@ BChannelControl::SetValueFor(int32 channel, int32 value) status_t BChannelControl::SetValue(int32 fromChannel, int32 channelCount, - const int32 *inValues) + const int32* values) { - return StuffValues(fromChannel, channelCount, inValues); + return StuffValues(fromChannel, channelCount, values); } status_t BChannelControl::SetAllValue(int32 values) { - int32 *newValues = new int32[fChannelCount]; + int32* newValues = new int32[fChannelCount]; for (int32 i = 0; i < fChannelCount; i++) { int32 limitedValue = max_c(values, MinLimitList()[i]); limitedValue = min_c(limitedValue, MaxLimitList()[i]); - + newValues[i] = limitedValue; } - + delete[] fChannelValues; fChannelValues = newValues; BControl::SetValue(fChannelValues[fCurrentChannel]); @@ -452,7 +465,8 @@ BChannelControl::SetLimitsFor(int32 channel, int32 minimum, int32 maximum) status_t -BChannelControl::GetLimitsFor(int32 channel, int32 *minimum, int32 *maximum) const +BChannelControl::GetLimitsFor(int32 channel, int32* minimum, + int32* maximum) const { return GetLimitsFor(channel, 1, minimum, maximum); } @@ -460,13 +474,15 @@ BChannelControl::GetLimitsFor(int32 channel, int32 *minimum, int32 *maximum) con status_t BChannelControl::SetLimitsFor(int32 fromChannel, int32 channelCount, - const int32 *minimum, const int32 *maximum) + const int32* minimum, const int32* maximum) { if (fromChannel + channelCount > CountChannels()) channelCount = CountChannels() - fromChannel; - for (int i=0; i<channelCount; i++) { + + for (int i = 0; i < channelCount; i++) { if (minimum[i] > maximum[i]) return B_BAD_VALUE; + fChannelMin[fromChannel + i] = minimum[i]; fChannelMax[fromChannel + i] = maximum[i]; if (fChannelValues[fromChannel + i] < minimum[i]) @@ -474,13 +490,14 @@ BChannelControl::SetLimitsFor(int32 fromChannel, int32 channelCount, else if (fChannelValues[fromChannel + i] > maximum[i]) fChannelValues[fromChannel + i] = maximum[i]; } + return B_OK; } status_t BChannelControl::GetLimitsFor(int32 fromChannel, int32 channelCount, - int32 *minimum, int32 *maximum) const + int32* minimum, int32* maximum) const { if (minimum == NULL || maximum == NULL) return B_BAD_VALUE; @@ -489,11 +506,12 @@ BChannelControl::GetLimitsFor(int32 fromChannel, int32 channelCount, return B_ERROR; if (fromChannel + channelCount > CountChannels()) channelCount = CountChannels() - fromChannel; - for (int i=0; i<channelCount; i++) { + + for (int i = 0; i < channelCount; i++) { minimum[i] = fChannelMin[fromChannel + i]; maximum[i] = fChannelMax[fromChannel + i]; } - + return B_OK; } @@ -503,7 +521,7 @@ BChannelControl::SetLimits(int32 minimum, int32 maximum) { if (minimum > maximum) return B_BAD_VALUE; - + int32 numChannels = CountChannels(); for (int32 c = 0; c < numChannels; c++) { @@ -520,7 +538,7 @@ BChannelControl::SetLimits(int32 minimum, int32 maximum) status_t -BChannelControl::GetLimits(int32 *outMinimum, int32 *outMaximum) const +BChannelControl::GetLimits(int32* outMinimum, int32* outMaximum) const { if (outMinimum == NULL || outMaximum == NULL) return B_BAD_VALUE; @@ -539,11 +557,11 @@ BChannelControl::GetLimits(int32 *outMinimum, int32 *outMaximum) const status_t -BChannelControl::SetLimitLabels(const char *minLabel, const char *maxLabel) +BChannelControl::SetLimitLabels(const char* minLabel, const char* maxLabel) { if (minLabel != fMinLabel) fMinLabel = minLabel; - + if (maxLabel != fMaxLabel) fMaxLabel = maxLabel; @@ -553,14 +571,14 @@ BChannelControl::SetLimitLabels(const char *minLabel, const char *maxLabel) } -const char * +const char* BChannelControl::MinLimitLabel() const { return fMinLabel.String(); } -const char * +const char* BChannelControl::MaxLimitLabel() const { return fMaxLabel.String(); @@ -568,67 +586,73 @@ BChannelControl::MaxLimitLabel() const status_t -BChannelControl::SetLimitLabelsFor(int32 channel, const char *minLabel, const char *maxLabel) +BChannelControl::SetLimitLabelsFor(int32 channel, const char* minLabel, + const char* maxLabel) { return B_ERROR; } status_t -BChannelControl::SetLimitLabelsFor(int32 from_channel, int32 channel_count, const char *minLabel, const char *maxLabel) +BChannelControl::SetLimitLabelsFor(int32 fromChannel, int32 channelCount, + const char* minLabel, const char* maxLabel) { return B_ERROR; } -const char * +const char* BChannelControl::MinLimitLabelFor(int32 channel) const { return NULL; } -const char * +const char* BChannelControl::MaxLimitLabelFor(int32 channel) const { return NULL; } -status_t +status_t BChannelControl::StuffValues(int32 fromChannel, int32 channelCount, - const int32 *inValues) + const int32* values) { - if (inValues == NULL) + if (values == NULL) return B_BAD_VALUE; if (fromChannel < 0 || fromChannel > fChannelCount - || fromChannel + channelCount > fChannelCount) + || fromChannel + channelCount > fChannelCount) { return B_BAD_INDEX; + } for (int32 i = 0; i < channelCount; i++) { - if (inValues[i] <= fChannelMax[fromChannel + i] - && inValues[i] >= fChannelMin[fromChannel + i]) - fChannelValues[fromChannel + i] = inValues[i]; + if (values[i] <= fChannelMax[fromChannel + i] + && values[i] >= fChannelMin[fromChannel + i]) { + fChannelValues[fromChannel + i] = values[i]; + } } - // If the current channel was updated, update also the control value - if (fCurrentChannel >= fromChannel && fCurrentChannel <= fromChannel + channelCount) + // if the current channel was updated, update also the control value + if (fCurrentChannel >= fromChannel + && fCurrentChannel <= fromChannel + channelCount) { BControl::SetValue(fChannelValues[fCurrentChannel]); + } return B_OK; } -void BChannelControl::_Reserverd_ChannelControl_0(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_1(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_2(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_3(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_4(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_5(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_6(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_7(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_8(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_9(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_10(void *, ...) {} -void BChannelControl::_Reserverd_ChannelControl_11(void *, ...) {} +void BChannelControl::_Reserverd_ChannelControl_0(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_1(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_2(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_3(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_4(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_5(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_6(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_7(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_8(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_9(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_10(void*, ...) {} +void BChannelControl::_Reserverd_ChannelControl_11(void*, ...) {} diff --git a/src/kits/interface/CheckBox.cpp b/src/kits/interface/CheckBox.cpp index a537852..c8fb055 100644 --- a/src/kits/interface/CheckBox.cpp +++ b/src/kits/interface/CheckBox.cpp @@ -161,9 +161,9 @@ BCheckBox::FrameMoved(BPoint newPosition) void -BCheckBox::FrameResized(float width, float height) +BCheckBox::FrameResized(float newWidth, float newHeight) { - BControl::FrameResized(width, height); + BControl::FrameResized(newWidth, newHeight); } diff --git a/src/kits/interface/ColorControl.cpp b/src/kits/interface/ColorControl.cpp index 245bb91..777413f 100644 --- a/src/kits/interface/ColorControl.cpp +++ b/src/kits/interface/ColorControl.cpp @@ -56,19 +56,19 @@ BColorControl::BColorControl(BPoint leftTop, color_control_layout layout, } -BColorControl::BColorControl(BMessage* archive) +BColorControl::BColorControl(BMessage* data) : - BControl(archive) + BControl(data) { int32 layout; float cellSize; bool useOffscreen; - archive->FindInt32("_layout", &layout); - archive->FindFloat("_csize", &cellSize); - archive->FindBool("_use_off", &useOffscreen); + data->FindInt32("_layout", &layout); + data->FindFloat("_csize", &cellSize); + data->FindBool("_use_off", &useOffscreen); - _InitData((color_control_layout)layout, cellSize, useOffscreen, archive); + _InitData((color_control_layout)layout, cellSize, useOffscreen, data); } @@ -80,7 +80,7 @@ BColorControl::~BColorControl() void BColorControl::_InitData(color_control_layout layout, float size, - bool useOffscreen, BMessage* archive) + bool useOffscreen, BMessage* data) { fPaletteMode = BScreen(B_MAIN_SCREEN_ID).ColorSpace() == B_CMAP8; //TODO: we don't support workspace and colorspace changing for now @@ -102,13 +102,13 @@ BColorControl::_InitData(color_control_layout layout, float size, green = gSystemCatalog.GetString(green, "ColorControl"); blue = gSystemCatalog.GetString(blue, "ColorControl"); - if (archive != NULL) { + if (data != NULL) { fRedText = (BTextControl*)FindView("_red"); fGreenText = (BTextControl*)FindView("_green"); fBlueText = (BTextControl*)FindView("_blue"); int32 value = 0; - archive->FindInt32("_val", &value); + data->FindInt32("_val", &value); SetValue(value); } else { @@ -219,26 +219,28 @@ BColorControl::_LayoutView() BArchivable* -BColorControl::Instantiate(BMessage* archive) +BColorControl::Instantiate(BMessage* data) { - if (validate_instantiation(archive, "BColorControl")) - return new BColorControl(archive); + if (validate_instantiation(data, "BColorControl")) + return new BColorControl(data); return NULL; } status_t -BColorControl::Archive(BMessage* archive, bool deep) const +BColorControl::Archive(BMessage* data, bool deep) const { - status_t status = BControl::Archive(archive, deep); + status_t status = BControl::Archive(data, deep); if (status == B_OK) - status = archive->AddInt32("_layout", Layout()); + status = data->AddInt32("_layout", Layout()); + if (status == B_OK) - status = archive->AddFloat("_csize", fCellSize); + status = data->AddFloat("_csize", fCellSize); + if (status == B_OK) - status = archive->AddBool("_use_off", fOffscreenView != NULL); + status = data->AddBool("_use_off", fOffscreenView != NULL); return status; } @@ -985,16 +987,16 @@ BColorControl::Invoke(BMessage* message) void -BColorControl::FrameMoved(BPoint new_position) +BColorControl::FrameMoved(BPoint newPosition) { - BControl::FrameMoved(new_position); + BControl::FrameMoved(newPosition); } void -BColorControl::FrameResized(float new_width, float new_height) +BColorControl::FrameResized(float newWidth, float newHeight) { - BControl::FrameResized(new_width, new_height); + BControl::FrameResized(newWidth, newHeight); } diff --git a/src/kits/interface/Control.cpp b/src/kits/interface/Control.cpp index a5b9f23..6cef099 100644 --- a/src/kits/interface/Control.cpp +++ b/src/kits/interface/Control.cpp @@ -258,14 +258,14 @@ BControl::MessageReceived(BMessage* message) void -BControl::MakeFocus(bool focused) +BControl::MakeFocus(bool focus) { - if (focused == IsFocus()) + if (focus == IsFocus()) return; - BView::MakeFocus(focused); + BView::MakeFocus(focus); - if (Window()) { + if (Window() != NULL) { fFocusChanging = true; Invalidate(Bounds()); Flush(); diff --git a/src/kits/interface/ListView.cpp b/src/kits/interface/ListView.cpp index a13e5fe..c2bdbd2 100644 --- a/src/kits/interface/ListView.cpp +++ b/src/kits/interface/ListView.cpp @@ -160,22 +160,22 @@ BListView::Instantiate(BMessage* archive) status_t -BListView::Archive(BMessage* archive, bool deep) const +BListView::Archive(BMessage* data, bool deep) const { - status_t status = BView::Archive(archive, deep); + status_t status = BView::Archive(data, deep); if (status < B_OK) return status; - status = archive->AddInt32("_lv_type", fListType); + status = data->AddInt32("_lv_type", fListType); if (status == B_OK && deep) { BListItem* item; int32 i = 0; - while ((item = ItemAt(i++))) { + while ((item = ItemAt(i++)) != NULL) { BMessage subData; status = item->Archive(&subData, true); if (status >= B_OK) - status = archive->AddMessage("_l_items", &subData); + status = data->AddMessage("_l_items", &subData); if (status < B_OK) break; @@ -183,10 +183,10 @@ BListView::Archive(BMessage* archive, bool deep) const } if (status >= B_OK && InvocationMessage() != NULL) - status = archive->AddMessage("_msg", InvocationMessage()); + status = data->AddMessage("_msg", InvocationMessage()); if (status == B_OK && fSelectMessage != NULL) - status = archive->AddMessage("_2nd_msg", fSelectMessage); + status = data->AddMessage("_2nd_msg", fSelectMessage); return status; } @@ -250,21 +250,21 @@ BListView::AllDetached() void -BListView::FrameResized(float width, float height) +BListView::FrameResized(float newWidth, float newHeight) { _FixupScrollBar(); } void -BListView::FrameMoved(BPoint new_position) +BListView::FrameMoved(BPoint newPosition) { - BView::FrameMoved(new_position); + BView::FrameMoved(newPosition); } void -BListView::TargetedByScrollView(BScrollView *view) +BListView::TargetedByScrollView(BScrollView* view) { fScrollView = view; // TODO: We could SetFlags(Flags() | B_FRAME_EVENTS) here, but that @@ -274,9 +274,9 @@ BListView::TargetedByScrollView(BScrollView *view) void -BListView::WindowActivated(bool state) +BListView::WindowActivated(bool active) { - BView::WindowActivated(state); + BView::WindowActivated(active); } @@ -1306,12 +1306,12 @@ BListView::ItemFrame(int32 index) BHandler* BListView::ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 form, const char* property) + BMessage* specifier, int32 what, const char* property) { BPropertyInfo propInfo(sProperties); - if (propInfo.FindMatch(message, 0, specifier, form, property) < 0) { - return BView::ResolveSpecifier(message, index, specifier, form, + if (propInfo.FindMatch(message, 0, specifier, what, property) < 0) { + return BView::ResolveSpecifier(message, index, specifier, what, property); } diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index 476fadc..8f3e4ed 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -531,9 +531,9 @@ BMenuField::MessageReceived(BMessage* message) void -BMenuField::WindowActivated(bool state) +BMenuField::WindowActivated(bool active) { - BView::WindowActivated(state); + BView::WindowActivated(active); if (IsFocus()) Invalidate(); @@ -548,9 +548,9 @@ BMenuField::MouseMoved(BPoint point, uint32 code, const BMessage* message) void -BMenuField::MouseUp(BPoint point) +BMenuField::MouseUp(BPoint where) { - BView::MouseUp(point); + BView::MouseUp(where); } diff --git a/src/kits/interface/OutlineListView.cpp b/src/kits/interface/OutlineListView.cpp index e232878..e396148 100644 --- a/src/kits/interface/OutlineListView.cpp +++ b/src/kits/interface/OutlineListView.cpp @@ -505,10 +505,11 @@ BOutlineListView::IsExpanded(int32 fullListIndex) BHandler* -BOutlineListView::ResolveSpecifier(BMessage* msg, int32 index, +BOutlineListView::ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, int32 what, const char* property) { - return BListView::ResolveSpecifier(msg, index, specifier, what, property); + return BListView::ResolveSpecifier(message, index, specifier, what, + property); } diff --git a/src/kits/interface/PictureButton.cpp b/src/kits/interface/PictureButton.cpp index 613b893..060e20c 100644 --- a/src/kits/interface/PictureButton.cpp +++ b/src/kits/interface/PictureButton.cpp @@ -175,16 +175,16 @@ BPictureButton::FrameResized(float newWidth, float newHeight) void -BPictureButton::WindowActivated(bool state) +BPictureButton::WindowActivated(bool active) { - BControl::WindowActivated(state); + BControl::WindowActivated(active); } void -BPictureButton::MakeFocus(bool state) +BPictureButton::MakeFocus(bool focus) { - BControl::MakeFocus(state); + BControl::MakeFocus(focus); } @@ -291,16 +291,16 @@ BPictureButton::MouseUp(BPoint where) void -BPictureButton::MouseMoved(BPoint where, uint32 transit, - const BMessage* message) +BPictureButton::MouseMoved(BPoint where, uint32 code, + const BMessage* dragMessage) { if (IsEnabled() && IsTracking()) { - if (transit == B_EXITED_VIEW) + if (code == B_EXITED_VIEW) SetValue(B_CONTROL_OFF); - else if (transit == B_ENTERED_VIEW) + else if (code == B_ENTERED_VIEW) SetValue(B_CONTROL_ON); } else - BControl::MouseMoved(where, transit, message); + BControl::MouseMoved(where, code, dragMessage); } @@ -397,9 +397,10 @@ BPictureButton::Invoke(BMessage* message) BHandler* BPictureButton::ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 form, const char* property) + BMessage* specifier, int32 what, const char* property) { - return BControl::ResolveSpecifier(message, index, specifier, form, property); + return BControl::ResolveSpecifier(message, index, specifier, + what, property); } diff --git a/src/kits/interface/RadioButton.cpp b/src/kits/interface/RadioButton.cpp index b593b5a..6893ea4 100644 --- a/src/kits/interface/RadioButton.cpp +++ b/src/kits/interface/RadioButton.cpp @@ -351,10 +351,10 @@ BRadioButton::FrameMoved(BPoint newPosition) void -BRadioButton::FrameResized(float width, float height) +BRadioButton::FrameResized(float newWidth, float newHeight) { Invalidate(); - BControl::FrameResized(width, height); + BControl::FrameResized(newWidth, newHeight); } @@ -368,9 +368,9 @@ BRadioButton::ResolveSpecifier(BMessage* message, int32 index, void -BRadioButton::MakeFocus(bool focused) +BRadioButton::MakeFocus(bool focus) { - BControl::MakeFocus(focused); + BControl::MakeFocus(focus); } diff --git a/src/kits/interface/Region.cpp b/src/kits/interface/Region.cpp index fd59aee..678d34b 100644 --- a/src/kits/interface/Region.cpp +++ b/src/kits/interface/Region.cpp @@ -117,24 +117,24 @@ BRegion::operator==(const BRegion& other) const // Set the region to contain just the given BRect. void -BRegion::Set(BRect newBounds) +BRegion::Set(BRect rect) { - Set(_Convert(newBounds)); + Set(_Convert(rect)); } //Set the region to contain just the given clipping_rect. void -BRegion::Set(clipping_rect newBounds) +BRegion::Set(clipping_rect clipping) { _SetSize(1); - if (valid_rect(newBounds) && fData) { + if (valid_rect(clipping) && fData != NULL) { fCount = 1; // cheap convert to internal rect format - newBounds.right++; - newBounds.bottom++; - fData[0] = fBounds = newBounds; + clipping.right++; + clipping.bottom++; + fData[0] = fBounds = clipping; } else MakeEmpty(); } @@ -425,7 +425,12 @@ BRegion::ExclusiveInclude(const BRegion* region) // #pragma mark - BRegion private methods -// Takes over the data of a region and marks that region empty. +/*! + \fn void BRegion::_AdoptRegionData(BRegion& region) + \brief Takes over the data of \a region and empties it. + + \param region The \a region to adopt data from. +*/ void BRegion::_AdoptRegionData(BRegion& region) { @@ -447,7 +452,13 @@ BRegion::_AdoptRegionData(BRegion& region) } -// Reallocate the memory in the region. +/*! + \fn bool BRegion::_SetSize(int32 newSize) + \brief Reallocate the memory in the region. + + \param newSize The amount of rectangles that the region should be + able to hold. +*/ bool BRegion::_SetSize(int32 newSize) { diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index eb2d9aa..8049b99 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -316,324 +316,281 @@ BScrollBar::Archive(BMessage* data, bool deep) const status_t err = BView::Archive(data, deep); if (err != B_OK) return err; + err = data->AddFloat("_range", fMin); if (err != B_OK) return err; + err = data->AddFloat("_range", fMax); if (err != B_OK) return err; + err = data->AddFloat("_steps", fSmallStep); if (err != B_OK) return err; + err = data->AddFloat("_steps", fLargeStep); if (err != B_OK) return err; + err = data->AddFloat("_val", fValue); if (err != B_OK) return err; + err = data->AddInt32("_orient", (int32)fOrientation); if (err != B_OK) return err; + err = data->AddFloat("_prop", fProportion); return err; } -// #pragma mark - - - void -BScrollBar::AttachedToWindow() +BScrollBar::AllAttached() { + BView::AllAttached(); } -/* - From the BeBook (on ValueChanged()): - -Responds to a notification that the value of the scroll bar has changed to -newValue. For a horizontal scroll bar, this function interprets newValue -as the coordinate value that should be at the left side of the target -view's bounds rectangle. For a vertical scroll bar, it interprets -newValue as the coordinate value that should be at the top of the rectangle. -It calls ScrollTo() to scroll the target's contents into position, unless -they have already been scrolled. - -ValueChanged() is called as the result both of user actions -(B_VALUE_CHANGED messages received from the Application Server) and of -programmatic ones. Programmatically, scrolling can be initiated by the -target view (calling ScrollTo()) or by the BScrollBar -(calling SetValue() or SetRange()). - -In all these cases, the target view and the scroll bars need to be kept -in synch. This is done by a chain of function calls: ValueChanged() calls -ScrollTo(), which in turn calls SetValue(), which then calls -ValueChanged() again. It's up to ValueChanged() to get off this -merry-go-round, which it does by checking the target view's bounds -rectangle. If newValue already matches the left or top side of the -bounds rectangle, if forgoes calling ScrollTo(). - -ValueChanged() does nothing if a target BView hasn't been set—or -if the target has been set by name, but the name doesn't correspond to -an actual BView within the scroll bar's window. - -*/ - void -BScrollBar::SetValue(float value) +BScrollBar::AllDetached() { - if (value > fMax) - value = fMax; - else if (value < fMin) - value = fMin; - else if (isnan(value)) - return; - - value = roundf(value); - if (value == fValue) - return; - - TRACE("BScrollBar(%s)::SetValue(%.1f)\n", Name(), value); - - fValue = value; - - _UpdateThumbFrame(); - _UpdateArrowButtons(); - - ValueChanged(fValue); + BView::AllDetached(); } -float -BScrollBar::Value() const +void +BScrollBar::AttachedToWindow() { - return fValue; + BView::AttachedToWindow(); } void -BScrollBar::ValueChanged(float newValue) +BScrollBar::DetachedFromWindow() { - TRACE("BScrollBar(%s)::ValueChanged(%.1f)\n", Name(), newValue); - - if (fTarget != NULL) { - // cache target bounds - BRect targetBounds = fTarget->Bounds(); - // if vertical, check bounds top and scroll if different from newValue - if (fOrientation == B_VERTICAL && targetBounds.top != newValue) - fTarget->ScrollBy(0.0, newValue - targetBounds.top); - - // if horizontal, check bounds left and scroll if different from newValue - if (fOrientation == B_HORIZONTAL && targetBounds.left != newValue) - fTarget->ScrollBy(newValue - targetBounds.left, 0.0); - } - - TRACE(" -> %.1f\n", newValue); - - SetValue(newValue); + BView::DetachedFromWindow(); } void -BScrollBar::SetProportion(float value) +BScrollBar::Draw(BRect updateRect) { - if (value < 0.0f) - value = 0.0f; - else if (value > 1.0f) - value = 1.0f; - - if (value == fProportion) - return; + BRect bounds = Bounds(); - TRACE("BScrollBar(%s)::SetProportion(%.1f)\n", Name(), value); + rgb_color normal = ui_color(B_PANEL_BACKGROUND_COLOR); - bool oldEnabled = fPrivateData->fEnabled && fMin < fMax - && fProportion < 1.0f && fProportion >= 0.0f; + // stroke a dark frame around the entire scrollbar + // (independent of enabled state) + // take care of border highlighting (scroll target is focus view) + SetHighColor(tint_color(normal, B_DARKEN_2_TINT)); + if (fPrivateData->fBorderHighlighted && fPrivateData->fEnabled) { + rgb_color borderColor = HighColor(); + rgb_color highlightColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR); + BeginLineArray(4); + AddLine(BPoint(bounds.left + 1, bounds.bottom), + BPoint(bounds.right, bounds.bottom), borderColor); + AddLine(BPoint(bounds.right, bounds.top + 1), + BPoint(bounds.right, bounds.bottom - 1), borderColor); + if (fOrientation == B_HORIZONTAL) { + AddLine(BPoint(bounds.left, bounds.top + 1), + BPoint(bounds.left, bounds.bottom), borderColor); + } else { + AddLine(BPoint(bounds.left, bounds.top), + BPoint(bounds.left, bounds.bottom), highlightColor); + } + if (fOrientation == B_HORIZONTAL) { + AddLine(BPoint(bounds.left, bounds.top), + BPoint(bounds.right, bounds.top), highlightColor); + } else { + AddLine(BPoint(bounds.left + 1, bounds.top), + BPoint(bounds.right, bounds.top), borderColor); + } + EndLineArray(); + } else + StrokeRect(bounds); - fProportion = value; + bounds.InsetBy(1.0f, 1.0f); - bool newEnabled = fPrivateData->fEnabled && fMin < fMax + bool enabled = fPrivateData->fEnabled && fMin < fMax && fProportion < 1.0f && fProportion >= 0.0f; - _UpdateThumbFrame(); - - if (oldEnabled != newEnabled) - Invalidate(); -} - + rgb_color light, dark, dark1, dark2; + if (enabled) { + light = tint_color(normal, B_LIGHTEN_MAX_TINT); + dark = tint_color(normal, B_DARKEN_3_TINT); + dark1 = tint_color(normal, B_DARKEN_1_TINT); + dark2 = tint_color(normal, B_DARKEN_2_TINT); + } else { + light = tint_color(normal, B_LIGHTEN_MAX_TINT); + dark = tint_color(normal, B_DARKEN_2_TINT); + dark1 = tint_color(normal, B_LIGHTEN_2_TINT); + dark2 = tint_color(normal, B_LIGHTEN_1_TINT); + } -float -BScrollBar::Proportion() const -{ - return fProportion; -} + SetDrawingMode(B_OP_OVER); + BRect thumbBG = bounds; + bool doubleArrows = _DoubleArrows(); -void -BScrollBar::SetRange(float min, float max) -{ - if (min > max || isnanf(min) || isnanf(max) - || isinff(min) || isinff(max)) { - min = 0.0f; - max = 0.0f; - } + // Draw arrows + if (fOrientation == B_HORIZONTAL) { + BRect buttonFrame(bounds.left, bounds.top, + bounds.left + bounds.Height(), bounds.bottom); - min = roundf(min); - max = roundf(max); + _DrawArrowButton(ARROW_LEFT, doubleArrows, buttonFrame, updateRect, + enabled, fPrivateData->fButtonDown == ARROW1); - if (fMin == min && fMax == max) - return; - TRACE("BScrollBar(%s)::SetRange(min=%.1f, max=%.1f)\n", Name(), min, max); + if (doubleArrows) { + buttonFrame.OffsetBy(bounds.Height() + 1, 0.0f); + _DrawArrowButton(ARROW_RIGHT, doubleArrows, buttonFrame, updateRect, + enabled, fPrivateData->fButtonDown == ARROW2); - fMin = min; - fMax = max; + buttonFrame.OffsetTo(bounds.right - ((bounds.Height() * 2) + 1), + bounds.top); + _DrawArrowButton(ARROW_LEFT, doubleArrows, buttonFrame, updateRect, + enabled, fPrivateData->fButtonDown == ARROW3); - if (fValue < fMin || fValue > fMax) - SetValue(fValue); - else { - _UpdateThumbFrame(); - Invalidate(); - } -} + thumbBG.left += bounds.Height() * 2 + 2; + thumbBG.right -= bounds.Height() * 2 + 2; + } else { + thumbBG.left += bounds.Height() + 1; + thumbBG.right -= bounds.Height() + 1; + } + buttonFrame.OffsetTo(bounds.right - bounds.Height(), bounds.top); + _DrawArrowButton(ARROW_RIGHT, doubleArrows, buttonFrame, updateRect, + enabled, fPrivateData->fButtonDown == ARROW4); + } else { + BRect buttonFrame(bounds.left, bounds.top, bounds.right, + bounds.top + bounds.Width()); -void -BScrollBar::GetRange(float* min, float* max) const -{ - if (min != NULL) - *min = fMin; - if (max != NULL) - *max = fMax; -} + _DrawArrowButton(ARROW_UP, doubleArrows, buttonFrame, updateRect, + enabled, fPrivateData->fButtonDown == ARROW1); + if (doubleArrows) { + buttonFrame.OffsetBy(0.0f, bounds.Width() + 1); + _DrawArrowButton(ARROW_DOWN, doubleArrows, buttonFrame, updateRect, + enabled, fPrivateData->fButtonDown == ARROW2); -void -BScrollBar::SetSteps(float smallStep, float largeStep) -{ - // Under R5, steps can be set only after being attached to a window, - // probably because the data is kept server-side. We'll just remove - // that limitation... :P + buttonFrame.OffsetTo(bounds.left, bounds.bottom + - ((bounds.Width() * 2) + 1)); + _DrawArrowButton(ARROW_UP, doubleArrows, buttonFrame, updateRect, + enabled, fPrivateData->fButtonDown == ARROW3); - // The BeBook also says that we need to specify an integer value even - // though the step values are floats. For the moment, we'll just make - // sure that they are integers - smallStep = roundf(smallStep); - largeStep = roundf(largeStep); - if (fSmallStep == smallStep && fLargeStep == largeStep) - return; + thumbBG.top += bounds.Width() * 2 + 2; + thumbBG.bottom -= bounds.Width() * 2 + 2; + } else { + thumbBG.top += bounds.Width() + 1; + thumbBG.bottom -= bounds.Width() + 1; + } - TRACE("BScrollBar(%s)::SetSteps(small=%.1f, large=%.1f)\n", Name(), - smallStep, largeStep); + buttonFrame.OffsetTo(bounds.left, bounds.bottom - bounds.Width()); + _DrawArrowButton(ARROW_DOWN, doubleArrows, buttonFrame, updateRect, + enabled, fPrivateData->fButtonDown == ARROW4); + } - fSmallStep = smallStep; - fLargeStep = largeStep; + SetDrawingMode(B_OP_COPY); - if (fProportion == 0.0) { - // special case, proportion is based on fLargeStep if it was never - // set, so it means we need to invalidate here - _UpdateThumbFrame(); - Invalidate(); - } + // background for thumb area + BRect rect(fPrivateData->fThumbFrame); - // TODO: test use of fractional values and make them work properly if - // they don't -} + SetHighColor(dark1); + uint32 flags = 0; + if (!enabled) + flags |= BControlLook::B_DISABLED; -void -BScrollBar::GetSteps(float* smallStep, float* largeStep) const -{ - if (smallStep != NULL) - *smallStep = fSmallStep; + // fill background besides the thumb + if (fOrientation == B_HORIZONTAL) { + BRect leftOfThumb(thumbBG.left, thumbBG.top, rect.left - 1, + thumbBG.bottom); + BRect rightOfThumb(rect.right + 1, thumbBG.top, thumbBG.right, + thumbBG.bottom); - if (largeStep != NULL) - *largeStep = fLargeStep; -} + be_control_look->DrawScrollBarBackground(this, leftOfThumb, + rightOfThumb, updateRect, normal, flags, fOrientation); + } else { + BRect topOfThumb(thumbBG.left, thumbBG.top, + thumbBG.right, rect.top - 1); + BRect bottomOfThumb(thumbBG.left, rect.bottom + 1, + thumbBG.right, thumbBG.bottom); -void -BScrollBar::SetTarget(BView* target) -{ - if (fTarget) { - // unset the previous target's scrollbar pointer - if (fOrientation == B_VERTICAL) - fTarget->fVerScroller = NULL; - else - fTarget->fHorScroller = NULL; + be_control_look->DrawScrollBarBackground(this, topOfThumb, + bottomOfThumb, updateRect, normal, flags, fOrientation); } - fTarget = target; - if (fTarget) { - if (fOrientation == B_VERTICAL) - fTarget->fVerScroller = this; - else - fTarget->fHorScroller = this; + rgb_color thumbColor = ui_color(B_SCROLL_BAR_THUMB_COLOR); + + // Draw scroll thumb + if (enabled) { + // fill the clickable surface of the thumb + be_control_look->DrawButtonBackground(this, rect, updateRect, + thumbColor, 0, BControlLook::B_ALL_BORDERS, fOrientation); + // TODO: Add the other thumb styles - dots and lines + } else { + if (fMin >= fMax || fProportion >= 1.0f || fProportion < 0.0f) { + // we cannot scroll at all + _DrawDisabledBackground(thumbBG, light, dark, dark1); + } else { + // we could scroll, but we're simply disabled + float bgTint = 1.06; + rgb_color bgLight = tint_color(light, bgTint * 3); + rgb_color bgShadow = tint_color(dark, bgTint); + rgb_color bgFill = tint_color(dark1, bgTint); + if (fOrientation == B_HORIZONTAL) { + // left of thumb + BRect besidesThumb(thumbBG); + besidesThumb.right = rect.left - 1; + _DrawDisabledBackground(besidesThumb, bgLight, bgShadow, bgFill); + // right of thumb + besidesThumb.left = rect.right + 1; + besidesThumb.right = thumbBG.right; + _DrawDisabledBackground(besidesThumb, bgLight, bgShadow, bgFill); + } else { + // above thumb + BRect besidesThumb(thumbBG); + besidesThumb.bottom = rect.top - 1; + _DrawDisabledBackground(besidesThumb, bgLight, bgShadow, bgFill); + // below thumb + besidesThumb.top = rect.bottom + 1; + besidesThumb.bottom = thumbBG.bottom; + _DrawDisabledBackground(besidesThumb, bgLight, bgShadow, bgFill); + } + // thumb bevel + BeginLineArray(4); + AddLine(BPoint(rect.left, rect.bottom), + BPoint(rect.left, rect.top), light); + AddLine(BPoint(rect.left + 1, rect.top), + BPoint(rect.right, rect.top), light); + AddLine(BPoint(rect.right, rect.top + 1), + BPoint(rect.right, rect.bottom), dark2); + AddLine(BPoint(rect.right - 1, rect.bottom), + BPoint(rect.left + 1, rect.bottom), dark2); + EndLineArray(); + // thumb fill + rect.InsetBy(1.0, 1.0); + SetHighColor(dark1); + FillRect(rect); + } } } void -BScrollBar::SetTarget(const char* targetName) -{ - // NOTE 1: BeOS implementation crashes for targetName == NULL - // NOTE 2: BeOS implementation also does not modify the target - // if it can't be found - if (!targetName) - return; - - if (!Window()) - debugger("Method requires window and doesn't have one"); - - BView* target = Window()->FindView(targetName); - if (target) - SetTarget(target); -} - - -BView* -BScrollBar::Target() const +BScrollBar::FrameMoved(BPoint newPosition) { - return fTarget; + BView::FrameMoved(newPosition); } void -BScrollBar::SetOrientation(orientation orientation) -{ - if (fOrientation == orientation) - return; - - fOrientation = orientation; - InvalidateLayout(); - Invalidate(); -} - - -orientation -BScrollBar::Orientation() const -{ - return fOrientation; -} - - -status_t -BScrollBar::SetBorderHighlighted(bool state) +BScrollBar::FrameResized(float newWidth, float newHeight) { - if (fPrivateData->fBorderHighlighted == state) - return B_OK; - - fPrivateData->fBorderHighlighted = state; - - BRect dirty(Bounds()); - if (fOrientation == B_HORIZONTAL) - dirty.bottom = dirty.top; - else - dirty.right = dirty.left; - - Invalidate(dirty); - - return B_OK; + _UpdateThumbFrame(); } @@ -760,9 +717,9 @@ BScrollBar::MouseDown(BPoint where) fPrivateData->fRepeaterDelay = system_time() + kRepeatDelay; fPrivateData->fThumbInc = scrollValue; fPrivateData->fDoRepeat = true; - fPrivateData->fRepeaterThread - = spawn_thread(fPrivateData->button_repeater_thread, - "scroll repeater", B_NORMAL_PRIORITY, fPrivateData); + fPrivateData->fRepeaterThread = spawn_thread( + fPrivateData->button_repeater_thread, "scroll repeater", + B_NORMAL_PRIORITY, fPrivateData); resume_thread(fPrivateData->fRepeaterThread); } else { fPrivateData->fExitRepeater = false; @@ -774,21 +731,7 @@ BScrollBar::MouseDown(BPoint where) void -BScrollBar::MouseUp(BPoint pt) -{ - if (fPrivateData->fButtonDown == THUMB) - Invalidate(fPrivateData->fThumbFrame); - else - Invalidate(_ButtonRectFor(fPrivateData->fButtonDown)); - - fPrivateData->fButtonDown = NOARROW; - fPrivateData->fExitRepeater = true; - fPrivateData->fDoRepeat = false; -} - - -void -BScrollBar::MouseMoved(BPoint where, uint32 transit, const BMessage* message) +BScrollBar::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage) { if (!fPrivateData->fEnabled || fMin >= fMax || fProportion >= 1.0f || fProportion < 0.0f) { @@ -824,243 +767,285 @@ BScrollBar::MouseMoved(BPoint where, uint32 transit, const BMessage* message) [ *** diff truncated: 1343 lines dropped *** ] ############################################################################ Revision: hrev47369 Commit: 47852bff02be873c48ec9399e7cc119502bb8c67 URL: http://cgit.haiku-os.org/haiku/commit/?id=47852bf Author: John Scipione <jscipione@xxxxxxxxx> Date: Fri Jun 13 21:25:02 2014 UTC IK documentation update * Add \since directive to each method. * Add documentation for BScrollBar and BScrollView classes. * Title Case group titles. * Some other minor documentation updates. ----------------------------------------------------------------------------