diff --git a/headers/os/interface/AbstractLayoutItem.h b/headers/os/interface/AbstractLayoutItem.h index 49fbdf916a..8ba3c219e7 100644 --- a/headers/os/interface/AbstractLayoutItem.h +++ b/headers/os/interface/AbstractLayoutItem.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _ABSTRACT_LAYOUT_ITEM_H diff --git a/headers/os/interface/Alert.h b/headers/os/interface/Alert.h index b27873df58..18a24c5f81 100644 --- a/headers/os/interface/Alert.h +++ b/headers/os/interface/Alert.h @@ -1,9 +1,6 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Erik Jaesler (erik@cgsoftware.com) */ #ifndef _ALERT_H #define _ALERT_H diff --git a/headers/os/interface/Alignment.h b/headers/os/interface/Alignment.h index 55bc6fcf10..76dc30ef81 100644 --- a/headers/os/interface/Alignment.h +++ b/headers/os/interface/Alignment.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _ALIGNMENT_H diff --git a/headers/os/interface/Bitmap.h b/headers/os/interface/Bitmap.h index 0e8d373de0..1a45ba75b5 100644 --- a/headers/os/interface/Bitmap.h +++ b/headers/os/interface/Bitmap.h @@ -1,9 +1,6 @@ /* - * Copyright 2001-2007, Haiku. + * Copyright 2001-2007, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Ingo Weinhold (bonefish@users.sf.net) */ #ifndef _BITMAP_H #define _BITMAP_H diff --git a/headers/os/interface/Button.h b/headers/os/interface/Button.h index 2f3bc8247d..2c37f5bf90 100644 --- a/headers/os/interface/Button.h +++ b/headers/os/interface/Button.h @@ -1,10 +1,6 @@ /* - * Copyright 2001-2009 Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. - * - * Authors: - * Marc Flerackers - * Stephan Aßmus + * Copyright 2001-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _BUTTON_H #define _BUTTON_H diff --git a/headers/os/interface/CardLayout.h b/headers/os/interface/CardLayout.h index 3fee7b905e..e31c3ff2fb 100644 --- a/headers/os/interface/CardLayout.h +++ b/headers/os/interface/CardLayout.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _CARD_LAYOUT_H diff --git a/headers/os/interface/ChannelControl.h b/headers/os/interface/ChannelControl.h index 82383c1342..d457d22ec0 100644 --- a/headers/os/interface/ChannelControl.h +++ b/headers/os/interface/ChannelControl.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2008-2009 Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2008-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _CHANNEL_CONTROL_H #define _CHANNEL_CONTROL_H diff --git a/headers/os/interface/ChannelSlider.h b/headers/os/interface/ChannelSlider.h index 59d3029231..b628801fa4 100644 --- a/headers/os/interface/ChannelSlider.h +++ b/headers/os/interface/ChannelSlider.h @@ -1,6 +1,6 @@ /* - * Copyright 2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _CHANNEL_SLIDER_H #define _CHANNEL_SLIDER_H diff --git a/headers/os/interface/CheckBox.h b/headers/os/interface/CheckBox.h index a41d9da61a..54fb4f899c 100644 --- a/headers/os/interface/CheckBox.h +++ b/headers/os/interface/CheckBox.h @@ -1,6 +1,6 @@ /* - * Copyright 2001-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _CHECK_BOX_H #define _CHECK_BOX_H diff --git a/headers/os/interface/Control.h b/headers/os/interface/Control.h index e90bcc503a..b797c1661b 100644 --- a/headers/os/interface/Control.h +++ b/headers/os/interface/Control.h @@ -1,6 +1,6 @@ /* * Copyright 2001-2009, Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Distributed under the terms of the MIT License. */ #ifndef _CONTROL_H #define _CONTROL_H diff --git a/headers/os/interface/ControlLook.h b/headers/os/interface/ControlLook.h index 1529a6a8f2..63b5f1673d 100644 --- a/headers/os/interface/ControlLook.h +++ b/headers/os/interface/ControlLook.h @@ -1,5 +1,5 @@ /* - * Copyright 2009, Stephan Aßmus + * Copyright 2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _CONTROL_LOOK_H @@ -16,6 +16,10 @@ class BGradientLinear; class BView; +// WARNING! This is experimental API and may change! Be prepared to +// recompile your software in a next version of haiku. + + namespace BPrivate { diff --git a/headers/os/interface/Deskbar.h b/headers/os/interface/Deskbar.h index c6367a3353..7af240fc8a 100644 --- a/headers/os/interface/Deskbar.h +++ b/headers/os/interface/Deskbar.h @@ -1,6 +1,6 @@ /* - * Copyright 2006-2009, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT license. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _DESKBAR_H #define _DESKBAR_H diff --git a/headers/os/interface/Dragger.h b/headers/os/interface/Dragger.h index 94a596d280..f98c07d538 100644 --- a/headers/os/interface/Dragger.h +++ b/headers/os/interface/Dragger.h @@ -1,6 +1,6 @@ /* - * Copyright 2006-2009, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT license. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _DRAGGER_H #define _DRAGGER_H diff --git a/headers/os/interface/Font.h b/headers/os/interface/Font.h index b1c1d5b641..9ff299c8f7 100644 --- a/headers/os/interface/Font.h +++ b/headers/os/interface/Font.h @@ -1,6 +1,6 @@ /* - * Copyright 2005-2009, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT license. + * Copyright 2005-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _FONT_H_ #define _FONT_H_ diff --git a/headers/os/interface/Gradient.h b/headers/os/interface/Gradient.h index c21c113f74..f84a348ea1 100644 --- a/headers/os/interface/Gradient.h +++ b/headers/os/interface/Gradient.h @@ -1,6 +1,6 @@ /* - * Copyright 2006-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _GRADIENT_H #define _GRADIENT_H diff --git a/headers/os/interface/GradientConic.h b/headers/os/interface/GradientConic.h index 2ed6fb3ede..d41c801fe5 100644 --- a/headers/os/interface/GradientConic.h +++ b/headers/os/interface/GradientConic.h @@ -1,6 +1,6 @@ /* - * Copyright 2006-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _GRADIENT_CONIC_H #define _GRADIENT_CONIC_H diff --git a/headers/os/interface/GradientDiamond.h b/headers/os/interface/GradientDiamond.h index 294a753fe1..37c4b03164 100644 --- a/headers/os/interface/GradientDiamond.h +++ b/headers/os/interface/GradientDiamond.h @@ -1,6 +1,6 @@ /* - * Copyright 2006-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _GRADIENT_DIAMOND_H #define _GRADIENT_DIAMOND_H diff --git a/headers/os/interface/GradientLinear.h b/headers/os/interface/GradientLinear.h index b6317a1237..e37a9c2cab 100644 --- a/headers/os/interface/GradientLinear.h +++ b/headers/os/interface/GradientLinear.h @@ -1,6 +1,6 @@ /* - * Copyright 2006-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _GRADIENT_LINEAR_H #define _GRADIENT_LINEAR_H diff --git a/headers/os/interface/GradientRadial.h b/headers/os/interface/GradientRadial.h index d13a7890ac..eb9e260c2d 100644 --- a/headers/os/interface/GradientRadial.h +++ b/headers/os/interface/GradientRadial.h @@ -1,6 +1,6 @@ /* - * Copyright 2006-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _GRADIENT_RADIAL_H #define _GRADIENT_RADIAL_H diff --git a/headers/os/interface/GradientRadialFocus.h b/headers/os/interface/GradientRadialFocus.h index 5c50ac2dd5..c1fe0b0606 100644 --- a/headers/os/interface/GradientRadialFocus.h +++ b/headers/os/interface/GradientRadialFocus.h @@ -1,6 +1,6 @@ /* - * Copyright 2006-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _GRADIENT_RADIAL_FOCUS_H #define _GRADIENT_RADIAL_FOCUS_H diff --git a/headers/os/interface/GraphicsDefs.h b/headers/os/interface/GraphicsDefs.h index 83b9aabb33..5355033393 100644 --- a/headers/os/interface/GraphicsDefs.h +++ b/headers/os/interface/GraphicsDefs.h @@ -1,5 +1,5 @@ /* - * Copyright 2008, Haiku Inc. All Rights Reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _GRAPHICS_DEFS_H diff --git a/headers/os/interface/GridLayout.h b/headers/os/interface/GridLayout.h index 8365d63b4c..f31b8816ce 100644 --- a/headers/os/interface/GridLayout.h +++ b/headers/os/interface/GridLayout.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _GRID_LAYOUT_H diff --git a/headers/os/interface/GridLayoutBuilder.h b/headers/os/interface/GridLayoutBuilder.h index 036e874369..42ab6995e3 100644 --- a/headers/os/interface/GridLayoutBuilder.h +++ b/headers/os/interface/GridLayoutBuilder.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _GRID_LAYOUT_BUILDER_H diff --git a/headers/os/interface/GridView.h b/headers/os/interface/GridView.h index 9ffeee9b99..4749fe756d 100644 --- a/headers/os/interface/GridView.h +++ b/headers/os/interface/GridView.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _GRID_VIEW_H diff --git a/headers/os/interface/GroupLayout.h b/headers/os/interface/GroupLayout.h index df6d08c552..dd83febbb9 100644 --- a/headers/os/interface/GroupLayout.h +++ b/headers/os/interface/GroupLayout.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _GROUP_LAYOUT_H diff --git a/headers/os/interface/GroupLayoutBuilder.h b/headers/os/interface/GroupLayoutBuilder.h index eadc721dbf..ff451051b3 100644 --- a/headers/os/interface/GroupLayoutBuilder.h +++ b/headers/os/interface/GroupLayoutBuilder.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _GROUP_LAYOUT_BUILDER_H diff --git a/headers/os/interface/GroupView.h b/headers/os/interface/GroupView.h index 9c86ad82c8..aead0f62d3 100644 --- a/headers/os/interface/GroupView.h +++ b/headers/os/interface/GroupView.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _GROUP_VIEW_H diff --git a/headers/os/interface/Input.h b/headers/os/interface/Input.h index 9522e38378..6a0494158a 100644 --- a/headers/os/interface/Input.h +++ b/headers/os/interface/Input.h @@ -1,6 +1,6 @@ /* - * Copyright 2008, Haiku, Inc. - * Distributed under the terms of the MIT license. + * Copyright 2008, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. * */ #ifndef _INPUT_H diff --git a/headers/os/interface/InterfaceDefs.h b/headers/os/interface/InterfaceDefs.h index e2851b97dd..62e7609bea 100644 --- a/headers/os/interface/InterfaceDefs.h +++ b/headers/os/interface/InterfaceDefs.h @@ -1,9 +1,6 @@ /* - * Copyright (c) 2001-2008, Haiku, Inc. - * Distributed under the terms of the MIT license. - * - * Authors: - * Erik Jaesler (erik@cgsoftware.com) + * Copyright 2001-2008, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _INTERFACE_DEFS_H #define _INTERFACE_DEFS_H diff --git a/headers/os/interface/Layout.h b/headers/os/interface/Layout.h index 66f580afd5..80fc504787 100644 --- a/headers/os/interface/Layout.h +++ b/headers/os/interface/Layout.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _LAYOUT_H diff --git a/headers/os/interface/LayoutBuilder.h b/headers/os/interface/LayoutBuilder.h index 480e5dcd28..372b82fae6 100644 --- a/headers/os/interface/LayoutBuilder.h +++ b/headers/os/interface/LayoutBuilder.h @@ -1,5 +1,5 @@ /* - * Copyright 2009, Haiku Inc. + * Copyright 2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _LAYOUT_BUILDER_H diff --git a/headers/os/interface/LayoutContext.h b/headers/os/interface/LayoutContext.h index 8470a3baf5..96f2ca91a1 100644 --- a/headers/os/interface/LayoutContext.h +++ b/headers/os/interface/LayoutContext.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _LAYOUT_CONTEXT_H diff --git a/headers/os/interface/LayoutItem.h b/headers/os/interface/LayoutItem.h index fc838d1b63..a02fc52a55 100644 --- a/headers/os/interface/LayoutItem.h +++ b/headers/os/interface/LayoutItem.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _LAYOUT_ITEM_H diff --git a/headers/os/interface/LayoutUtils.h b/headers/os/interface/LayoutUtils.h index 71ce2bf78c..997a04c75e 100644 --- a/headers/os/interface/LayoutUtils.h +++ b/headers/os/interface/LayoutUtils.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _LAYOUT_UTILS_H diff --git a/headers/os/interface/ListItem.h b/headers/os/interface/ListItem.h index a8e7813c07..89d614a65a 100644 --- a/headers/os/interface/ListItem.h +++ b/headers/os/interface/ListItem.h @@ -1,6 +1,6 @@ /* * Copyright 2006-2009, Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Distributed under the terms of the MIT License. */ #ifndef _LIST_ITEM_H #define _LIST_ITEM_H diff --git a/headers/os/interface/ListView.h b/headers/os/interface/ListView.h index 2973e5e760..bc3a6175f0 100644 --- a/headers/os/interface/ListView.h +++ b/headers/os/interface/ListView.h @@ -1,6 +1,6 @@ /* * Copyright 2002-2009, Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Distributed under the terms of the MIT License. */ #ifndef _LIST_VIEW_H #define _LIST_VIEW_H diff --git a/headers/os/interface/Menu.h b/headers/os/interface/Menu.h index de92318344..4940266a32 100644 --- a/headers/os/interface/Menu.h +++ b/headers/os/interface/Menu.h @@ -1,6 +1,6 @@ /* - * Copyright 2007-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2007-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _MENU_H #define _MENU_H diff --git a/headers/os/interface/MenuBar.h b/headers/os/interface/MenuBar.h index bf6f21a73c..5812d88129 100644 --- a/headers/os/interface/MenuBar.h +++ b/headers/os/interface/MenuBar.h @@ -1,6 +1,6 @@ /* - * Copyright 2003-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2003-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _MENU_BAR_H #define _MENU_BAR_H diff --git a/headers/os/interface/MenuField.h b/headers/os/interface/MenuField.h index 652e768aab..cb07b6c9ac 100644 --- a/headers/os/interface/MenuField.h +++ b/headers/os/interface/MenuField.h @@ -1,6 +1,6 @@ /* - * Copyright 2006-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _MENU_FIELD_H #define _MENU_FIELD_H diff --git a/headers/os/interface/MenuItem.h b/headers/os/interface/MenuItem.h index 8e3fe9664f..a484a83032 100644 --- a/headers/os/interface/MenuItem.h +++ b/headers/os/interface/MenuItem.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2007, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _MENU_ITEM_H @@ -16,92 +16,96 @@ class BWindow; class BMenuItem : public BArchivable, public BInvoker { - public: - BMenuItem(const char* label, BMessage* message, - char shortcut = 0, uint32 modifiers = 0); - BMenuItem(BMenu* menu, BMessage* message = NULL); - BMenuItem(BMessage* data); - virtual ~BMenuItem(); +public: + BMenuItem(const char* label, BMessage* message, + char shortcut = 0, uint32 modifiers = 0); + BMenuItem(BMenu* menu, + BMessage* message = NULL); + BMenuItem(BMessage* data); + virtual ~BMenuItem(); - static BArchivable* Instantiate(BMessage* archive); - virtual status_t Archive(BMessage* archive, bool deep = true) const; + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; - virtual void SetLabel(const char* name); - virtual void SetEnabled(bool enabled); - virtual void SetMarked(bool marked); - virtual void SetTrigger(char trigger); - virtual void SetShortcut(char shortcut, uint32 modifiers); + virtual void SetLabel(const char* name); + virtual void SetEnabled(bool enabled); + virtual void SetMarked(bool marked); + virtual void SetTrigger(char trigger); + virtual void SetShortcut(char shortcut, uint32 modifiers); - const char* Label() const; - bool IsEnabled() const; - bool IsMarked() const; - char Trigger() const; - char Shortcut(uint32* _modifiers = NULL) const; + const char* Label() const; + bool IsEnabled() const; + bool IsMarked() const; + char Trigger() const; + char Shortcut(uint32* _modifiers = NULL) const; - BMenu* Submenu() const; - BMenu* Menu() const; - BRect Frame() const; + BMenu* Submenu() const; + BMenu* Menu() const; + BRect Frame() const; - protected: - virtual void GetContentSize(float* _width, float* _height); - virtual void TruncateLabel(float maxWidth, char* newLabel); - virtual void DrawContent(); - virtual void Draw(); - virtual void Highlight(bool enabled); - bool IsSelected() const; - BPoint ContentLocation() const; +protected: + virtual void GetContentSize(float* _width, float* _height); + virtual void TruncateLabel(float maxWidth, char* newLabel); + virtual void DrawContent(); + virtual void Draw(); + virtual void Highlight(bool enabled); + bool IsSelected() const; + BPoint ContentLocation() const; - private: - friend class BMenu; - friend class BPopUpMenu; - friend class BMenuBar; +private: + friend class BMenu; + friend class BPopUpMenu; + friend class BMenuBar; - virtual void _ReservedMenuItem1(); - virtual void _ReservedMenuItem2(); - virtual void _ReservedMenuItem3(); - virtual void _ReservedMenuItem4(); + virtual void _ReservedMenuItem1(); + virtual void _ReservedMenuItem2(); + virtual void _ReservedMenuItem3(); + virtual void _ReservedMenuItem4(); - void Install(BWindow* window); - void Uninstall(); - void SetSuper(BMenu* superMenu); - void Select(bool select); - void SetAutomaticTrigger(int32 index, uint32 trigger); + void Install(BWindow* window); + void Uninstall(); + void SetSuper(BMenu* superMenu); + void Select(bool select); + void SetAutomaticTrigger(int32 index, + uint32 trigger); - protected: - virtual status_t Invoke(BMessage *msg = NULL); +protected: + virtual status_t Invoke(BMessage* message = NULL); - private: - BMenuItem(const BMenuItem& other); - BMenuItem& operator=(const BMenuItem& other); +private: + BMenuItem(const BMenuItem& other); + BMenuItem& operator=(const BMenuItem& other); - void _InitData(); - void _InitMenuData(BMenu* menu); + void _InitData(); + void _InitMenuData(BMenu* menu); - void _DrawMarkSymbol(rgb_color backgroundColor); - void _DrawShortcutSymbol(); - void _DrawSubmenuSymbol(rgb_color backgroundColor); - void _DrawControlChar(char shortcut, BPoint where); + void _DrawMarkSymbol(rgb_color backgroundColor); + void _DrawShortcutSymbol(); + void _DrawSubmenuSymbol(rgb_color backgroundColor); + void _DrawControlChar(char shortcut, BPoint where); - char* fLabel; - BMenu* fSubmenu; - BWindow* fWindow; - BMenu* fSuper; - BRect fBounds; - uint32 fModifiers; - float fCachedWidth; - int16 fTriggerIndex; - char fUserTrigger; - char fShortcutChar; - bool fMark; - bool fEnabled; - bool fSelected; - uint32 fTrigger; +private: + char* fLabel; + BMenu* fSubmenu; + BWindow* fWindow; + BMenu* fSuper; + BRect fBounds; + uint32 fModifiers; + float fCachedWidth; + int16 fTriggerIndex; + char fUserTrigger; + char fShortcutChar; + bool fMark; + bool fEnabled; + bool fSelected; + uint32 fTrigger; - uint32 _reserved[3]; + uint32 _reserved[3]; }; // BSeparatorItem now has its own declaration file, but for source // compatibility we're exporting that class from here too. #include -#endif /* _MENU_ITEM_H */ +#endif // _MENU_ITEM_H diff --git a/headers/os/interface/MultiChannelControl.h b/headers/os/interface/MultiChannelControl.h index f6cffc630f..49733d654e 100644 --- a/headers/os/interface/MultiChannelControl.h +++ b/headers/os/interface/MultiChannelControl.h @@ -1,6 +1,6 @@ /* - * Copyright 2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _MULTI_CHANNEL_CONTROL_H #define _MULTI_CHANNEL_CONTROL_H diff --git a/headers/os/interface/OptionControl.h b/headers/os/interface/OptionControl.h index e9cff8acc9..29d9bbf76f 100644 --- a/headers/os/interface/OptionControl.h +++ b/headers/os/interface/OptionControl.h @@ -1,6 +1,6 @@ /* - * Copyright 2001-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _OPTION_CONTROL_H #define _OPTION_CONTROL_H diff --git a/headers/os/interface/OptionPopUp.h b/headers/os/interface/OptionPopUp.h index 0d83fa5520..edc597b762 100644 --- a/headers/os/interface/OptionPopUp.h +++ b/headers/os/interface/OptionPopUp.h @@ -1,6 +1,6 @@ /* - * Copyright 2001-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _OPTION_POP_UP_H #define _OPTION_POP_UP_H diff --git a/headers/os/interface/OutlineListView.h b/headers/os/interface/OutlineListView.h index 183c64b6ff..e553bd345e 100644 --- a/headers/os/interface/OutlineListView.h +++ b/headers/os/interface/OutlineListView.h @@ -1,6 +1,6 @@ /* - * Copyright 2006-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _OUTLINE_LIST_VIEW_H #define _OUTLINE_LIST_VIEW_H diff --git a/headers/os/interface/Picture.h b/headers/os/interface/Picture.h index d85b186dbf..677eb64ce7 100644 --- a/headers/os/interface/Picture.h +++ b/headers/os/interface/Picture.h @@ -1,12 +1,11 @@ /* - * Copyright 2001-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _PICTURE_H #define _PICTURE_H -#include #include #include #include diff --git a/headers/os/interface/PictureButton.h b/headers/os/interface/PictureButton.h index 3f6286866f..e060ccfa08 100644 --- a/headers/os/interface/PictureButton.h +++ b/headers/os/interface/PictureButton.h @@ -1,6 +1,6 @@ /* - * Copyright 2001-2008, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2001-2008, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _PICTURE_BUTTON_H #define _PICTURE_BUTTON_H diff --git a/headers/os/interface/Point.h b/headers/os/interface/Point.h index 9ad7df133b..d11bd6c0b6 100644 --- a/headers/os/interface/Point.h +++ b/headers/os/interface/Point.h @@ -1,87 +1,88 @@ /* - * Copyright 2001-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Frans van Nispen */ #ifndef _POINT_H #define _POINT_H -#include #include class BRect; + class BPoint { public: - float x; - float y; + float x; + float y; - BPoint(); - BPoint(float X, float Y); - BPoint(const BPoint &p); + BPoint(); + BPoint(float x, float y); + BPoint(const BPoint& p); - BPoint &operator=(const BPoint &p); - void Set(float X, float Y); + BPoint& operator=(const BPoint& other); + void Set(float x, float y); - void ConstrainTo(BRect r); - void PrintToStream() const; + void ConstrainTo(BRect rect); + void PrintToStream() const; - BPoint operator-() const; - BPoint operator+(const BPoint &p) const; - BPoint operator-(const BPoint &p) const; - BPoint& operator+=(const BPoint &p); - BPoint& operator-=(const BPoint &p); + BPoint operator-() const; + BPoint operator+(const BPoint& other) const; + BPoint operator-(const BPoint& other) const; + BPoint& operator+=(const BPoint& other); + BPoint& operator-=(const BPoint& other); - bool operator!=(const BPoint &p) const; - bool operator==(const BPoint &p) const; + bool operator!=(const BPoint& other) const; + bool operator==(const BPoint& other) const; }; extern const BPoint B_ORIGIN; - // returns (0,0) + // returns (0, 0) inline BPoint::BPoint() + : + x(0.0f), + y(0.0f) { - x = y = 0; } inline -BPoint::BPoint(float X, float Y) +BPoint::BPoint(float x, float y) + : + x(x), + y(y) { - x = X; - y = Y; } inline -BPoint::BPoint(const BPoint& pt) +BPoint::BPoint(const BPoint& other) + : + x(other.x), + y(other.y) { - x = pt.x; - y = pt.y; } -inline BPoint & -BPoint::operator=(const BPoint& from) +inline BPoint& +BPoint::operator=(const BPoint& other) { - x = from.x; - y = from.y; + x = other.x; + y = other.y; return *this; } inline void -BPoint::Set(float X, float Y) +BPoint::Set(float x, float y) { - x = X; - y = Y; + this->x = x; + this->y = y; } -#endif // _POINT_H +#endif // _POINT_H diff --git a/headers/os/interface/Polygon.h b/headers/os/interface/Polygon.h index fd9a3dc1f8..d520050884 100644 --- a/headers/os/interface/Polygon.h +++ b/headers/os/interface/Polygon.h @@ -1,6 +1,6 @@ /* - * Copyright 2001-2009, Haiku Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _POLYGON_H #define _POLYGON_H diff --git a/headers/os/interface/Rect.h b/headers/os/interface/Rect.h index ecb83f6a19..86712ff98c 100644 --- a/headers/os/interface/Rect.h +++ b/headers/os/interface/Rect.h @@ -1,15 +1,11 @@ /* - * Copyright 2001-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Frans van Nispen */ #ifndef _RECT_H #define _RECT_H -#include #include #include @@ -17,77 +13,79 @@ class BRect { - public: - float left; - float top; - float right; - float bottom; +public: + float left; + float top; + float right; + float bottom; - BRect(); - BRect(const BRect &r); - BRect(float l, float t, float r, float b); - BRect(BPoint lt, BPoint rb); - BRect(BPoint leftTop, BSize size); + BRect(); + BRect(const BRect& other); + BRect(float left, float top, float right, + float bottom); + BRect(BPoint leftTop, BPoint rightBottom); + BRect(BPoint leftTop, BSize size); - BRect &operator=(const BRect &r); - void Set(float l, float t, float r, float b); + BRect& operator=(const BRect& other); + void Set(float left, float top, float right, + float bottom); - void PrintToStream() const; + void PrintToStream() const; - BPoint LeftTop() const; - BPoint RightBottom() const; - BPoint LeftBottom() const; - BPoint RightTop() const; + BPoint LeftTop() const; + BPoint RightBottom() const; + BPoint LeftBottom() const; + BPoint RightTop() const; - void SetLeftTop(const BPoint p); - void SetRightBottom(const BPoint p); - void SetLeftBottom(const BPoint p); - void SetRightTop(const BPoint p); + void SetLeftTop(const BPoint leftTop); + void SetRightBottom(const BPoint rightBottom); + void SetLeftBottom(const BPoint leftBottom); + void SetRightTop(const BPoint rightTop); - // transformation - void InsetBy(BPoint p); - void InsetBy(float dx, float dy); - void OffsetBy(BPoint p); - void OffsetBy(float dx, float dy); - void OffsetTo(BPoint p); - void OffsetTo(float x, float y); + // Transformation + void InsetBy(BPoint inset); + void InsetBy(float dx, float dy); + void OffsetBy(BPoint delta); + void OffsetBy(float dx, float dy); + void OffsetTo(BPoint offset); + void OffsetTo(float x, float y); - // expression transformations - BRect& InsetBySelf(BPoint); - BRect& InsetBySelf(float dx, float dy); - BRect InsetByCopy(BPoint); - BRect InsetByCopy(float dx, float dy); - BRect& OffsetBySelf(BPoint); - BRect& OffsetBySelf(float dx, float dy); - BRect OffsetByCopy(BPoint); - BRect OffsetByCopy(float dx, float dy); - BRect& OffsetToSelf(BPoint); - BRect& OffsetToSelf(float dx, float dy); - BRect OffsetToCopy(BPoint); - BRect OffsetToCopy(float dx, float dy); + // Expression transformations + BRect& InsetBySelf(BPoint inset); + BRect& InsetBySelf(float dx, float dy); + BRect InsetByCopy(BPoint inset); + BRect InsetByCopy(float dx, float dy); + BRect& OffsetBySelf(BPoint offset); + BRect& OffsetBySelf(float dx, float dy); + BRect OffsetByCopy(BPoint offset); + BRect OffsetByCopy(float dx, float dy); + BRect& OffsetToSelf(BPoint offset); + BRect& OffsetToSelf(float dx, float dy); + BRect OffsetToCopy(BPoint offset); + BRect OffsetToCopy(float dx, float dy); - // comparison - bool operator==(BRect r) const; - bool operator!=(BRect r) const; + // Comparison + bool operator==(BRect r) const; + bool operator!=(BRect r) const; - // intersection and union - BRect operator&(BRect r) const; - BRect operator|(BRect r) const; + // Intersection and union + BRect operator&(BRect r) const; + BRect operator|(BRect r) const; - bool IsValid() const; - float Width() const; - int32 IntegerWidth() const; - float Height() const; - int32 IntegerHeight() const; - BSize Size() const; + bool IsValid() const; + float Width() const; + int32 IntegerWidth() const; + float Height() const; + int32 IntegerHeight() const; + BSize Size() const; - bool Intersects(BRect r) const; - bool Contains(BPoint p) const; - bool Contains(BRect r) const; + bool Intersects(BRect r) const; + bool Contains(BPoint p) const; + bool Contains(BRect r) const; }; -// inline definitions ---------------------------------------------------------- +// #pragma mark - inline definitions inline BPoint BRect::LeftTop() const @@ -136,7 +134,7 @@ BRect::BRect(float l, float t, float r, float b) inline -BRect::BRect(const BRect &r) +BRect::BRect(const BRect& r) { left = r.left; top = r.top; @@ -165,7 +163,7 @@ BRect::BRect(BPoint leftTop, BSize size) } -inline BRect & +inline BRect& BRect::operator=(const BRect& from) { left = from.left; diff --git a/headers/os/interface/Region.h b/headers/os/interface/Region.h index 8ac8e3169f..d7878e90e3 100644 --- a/headers/os/interface/Region.h +++ b/headers/os/interface/Region.h @@ -1,5 +1,5 @@ /* - * Copyright 2007, Haiku. All rights reserved. + * Copyright 2007, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ diff --git a/headers/os/interface/Screen.h b/headers/os/interface/Screen.h index 87662d9ad6..58cb2e4147 100644 --- a/headers/os/interface/Screen.h +++ b/headers/os/interface/Screen.h @@ -1,5 +1,5 @@ /* - * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _SCREEN_H @@ -19,71 +19,83 @@ namespace BPrivate { class BPrivateScreen; } + class BScreen { - public: - BScreen(screen_id id = B_MAIN_SCREEN_ID); - BScreen(BWindow* window); - ~BScreen(); +public: + BScreen(screen_id id = B_MAIN_SCREEN_ID); + BScreen(BWindow* window); + ~BScreen(); - bool IsValid(); - status_t SetToNext(); + bool IsValid(); + status_t SetToNext(); - color_space ColorSpace(); - BRect Frame(); - screen_id ID(); + color_space ColorSpace(); + BRect Frame(); + screen_id ID(); - status_t WaitForRetrace(); - status_t WaitForRetrace(bigtime_t timeout); + status_t WaitForRetrace(); + status_t WaitForRetrace(bigtime_t timeout); - uint8 IndexForColor(rgb_color color); - uint8 IndexForColor(uint8 red, uint8 green, uint8 blue, - uint8 alpha = 255); - rgb_color ColorForIndex(uint8 index); - uint8 InvertIndex(uint8 index); + uint8 IndexForColor(rgb_color color); + uint8 IndexForColor(uint8 red, uint8 green, + uint8 blue, uint8 alpha = 255); + rgb_color ColorForIndex(uint8 index); + uint8 InvertIndex(uint8 index); - const color_map* ColorMap(); + const color_map* ColorMap(); - status_t GetBitmap(BBitmap** _bitmap, bool drawCursor = true, - BRect* frame = NULL); - status_t ReadBitmap(BBitmap* bitmap, bool drawCursor = true, - BRect* frame = NULL); + status_t GetBitmap(BBitmap** _bitmap, + bool drawCursor = true, + BRect* frame = NULL); + status_t ReadBitmap(BBitmap* bitmap, + bool drawCursor = true, + BRect* frame = NULL); - rgb_color DesktopColor(); - rgb_color DesktopColor(uint32 index); - void SetDesktopColor(rgb_color color, bool makeDefault = true); - void SetDesktopColor(rgb_color color, uint32 index, - bool makeDefault = true); + rgb_color DesktopColor(); + rgb_color DesktopColor(uint32 index); + void SetDesktopColor(rgb_color color, + bool makeDefault = true); + void SetDesktopColor(rgb_color color, + uint32 index, bool makeDefault = true); - status_t ProposeMode(display_mode* target, const display_mode* low, - const display_mode* high); - status_t GetModeList(display_mode** _modeList, uint32* _count); - status_t GetMode(display_mode* mode); - status_t GetMode(uint32 workspace, display_mode* mode); - status_t SetMode(display_mode* mode, bool makeDefault = false); - status_t SetMode(uint32 workspace, display_mode* mode, - bool makeDefault = false); - status_t GetDeviceInfo(accelerant_device_info* info); - status_t GetMonitorInfo(monitor_info* info); - status_t GetPixelClockLimits(display_mode* mode, uint32* low, - uint32* high); - status_t GetTimingConstraints( - display_timing_constraints* timingConstraints); - status_t SetDPMS(uint32 state); - uint32 DPMSState(); - uint32 DPMSCapabilites(); + status_t ProposeMode(display_mode* target, + const display_mode* low, + const display_mode* high); + status_t GetModeList(display_mode** _modeList, + uint32* _count); + status_t GetMode(display_mode* _mode); + status_t GetMode(uint32 workspace, + display_mode* _mode); + status_t SetMode(display_mode* mode, + bool makeDefault = false); + status_t SetMode(uint32 workspace, + display_mode* mode, + bool makeDefault = false); + status_t GetDeviceInfo(accelerant_device_info* info); + status_t GetMonitorInfo(monitor_info* info); + status_t GetPixelClockLimits(display_mode* mode, + uint32* low, uint32* high); + status_t GetTimingConstraints( + display_timing_constraints* + timingConstraints); + status_t SetDPMS(uint32 state); + uint32 DPMSState(); + uint32 DPMSCapabilites(); - private: - BScreen& operator=(const BScreen& other); - BScreen(const BScreen& other); +private: + // Forbidden and deprecated methods + BScreen(const BScreen& other); + BScreen& operator=(const BScreen& other); - // old and deprecated methods - should be faded out - BPrivate::BPrivateScreen* private_screen(); - status_t ProposeDisplayMode(display_mode* target, - const display_mode* low, const display_mode* high); - void* BaseAddress(); - uint32 BytesPerRow(); + BPrivate::BPrivateScreen* private_screen(); + status_t ProposeDisplayMode(display_mode* target, + const display_mode* low, + const display_mode* high); + void* BaseAddress(); + uint32 BytesPerRow(); - BPrivate::BPrivateScreen* fScreen; +private: + BPrivate::BPrivateScreen* fScreen; }; @@ -93,4 +105,4 @@ BScreen::IndexForColor(rgb_color color) return IndexForColor(color.red, color.green, color.blue, color.alpha); } -#endif // _SCREEN_H +#endif // _SCREEN_H diff --git a/headers/os/interface/ScrollBar.h b/headers/os/interface/ScrollBar.h index 51fc199d6a..3b0e3e73fc 100644 --- a/headers/os/interface/ScrollBar.h +++ b/headers/os/interface/ScrollBar.h @@ -1,12 +1,6 @@ /* - * Copyright (c) 2001-2008, Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. - * - * Authors: - * Marc Flerackers (mflerackers@androme.be) - * DarkWyrm (bpmagic@columbus.rr.com) - * Stefano Ceccherini (burton666@libero.it) - * Stephan Aßmus + * Copyright 2001-2008, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _SCROLL_BAR_H #define _SCROLL_BAR_H @@ -32,11 +26,13 @@ public: BView* target, float min, float max, orientation direction); BScrollBar(const char* name, BView* target, - float min, float max, orientation direction); - BScrollBar(BMessage* data); + float min, float max, + enum orientation orientation); + BScrollBar(BMessage* archive); virtual ~BScrollBar(); - static BArchivable* Instantiate(BMessage* data); - virtual status_t Archive(BMessage *data, bool deep = true) const; + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; virtual void AttachedToWindow(); void SetValue(float value); @@ -56,7 +52,7 @@ public: void SetOrientation(enum orientation orientation); orientation Orientation() const; - // TODO: make this a virtual method, it should be one, + // TODO: Make this a virtual method, it should be one, // but it's not important right now. This is supposed // to be used in case the BScrollBar should draw part of // the focus indication of the target view for aesthetical @@ -78,7 +74,8 @@ public: int32 form, const char* property); virtual void ResizeToPreferred(); - virtual void GetPreferredSize(float* _width, float* _height); + virtual void GetPreferredSize(float* _width, + float* _height); virtual void MakeFocus(bool state = true); virtual void AllAttached(); virtual void AllDetached(); @@ -128,6 +125,7 @@ private: BSize _MinSize() const; +private: float fMin; float fMax; float fSmallStep; diff --git a/headers/os/interface/ScrollView.h b/headers/os/interface/ScrollView.h index 9901bb4d4d..f927d540ca 100644 --- a/headers/os/interface/ScrollView.h +++ b/headers/os/interface/ScrollView.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2009, Haiku Inc. All Rights Reserved. + * Copyright 2004-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT license. */ #ifndef _SCROLL_VIEW_H @@ -14,104 +14,109 @@ */ class BScrollView : public BView { public: - BScrollView(const char* name, BView* target, - uint32 resizingMode - = B_FOLLOW_LEFT | B_FOLLOW_TOP, - uint32 flags = 0, bool horizontal = false, - bool vertical = false, - border_style border = B_FANCY_BORDER); - BScrollView(const char* name, BView* target, - uint32 flags, bool horizontal, bool vertical, - border_style border = B_FANCY_BORDER); - BScrollView(BMessage* archive); - virtual ~BScrollView(); + BScrollView(const char* name, BView* target, + uint32 resizingMode + = B_FOLLOW_LEFT | B_FOLLOW_TOP, + uint32 flags = 0, bool horizontal = false, + bool vertical = false, + border_style border = B_FANCY_BORDER); + BScrollView(const char* name, BView* target, + uint32 flags, bool horizontal, + bool vertical, border_style border + = B_FANCY_BORDER); + BScrollView(BMessage* archive); + virtual ~BScrollView(); - static BArchivable* Instantiate(BMessage* archive); - virtual status_t Archive(BMessage* archive, bool deep = true) const; + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; - virtual void Draw(BRect updateRect); - virtual void AttachedToWindow(); + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + virtual void AllAttached(); + virtual void AllDetached(); - BScrollBar* ScrollBar(orientation posture) const; + virtual void Draw(BRect updateRect); - virtual void SetBorder(border_style border); - border_style Border() const; + virtual void WindowActivated(bool active); + virtual void MakeFocus(bool state = true); - virtual status_t SetBorderHighlighted(bool state); - bool IsBorderHighlighted() const; + virtual void GetPreferredSize(float* _width, + float* _height); + virtual BSize MinSize(); + virtual BSize MaxSize(); + virtual BSize PreferredSize(); + virtual void ResizeToPreferred(); - void SetTarget(BView* target); - BView* Target() const; + virtual void InvalidateLayout(bool descendants = false); + virtual void DoLayout(); + virtual void FrameMoved(BPoint position); + virtual void FrameResized(float width, float height); - virtual void MessageReceived(BMessage* message); - virtual void MouseDown(BPoint point); + virtual void MessageReceived(BMessage* message); - virtual void WindowActivated(bool active); - virtual void MouseUp(BPoint point); - virtual void MouseMoved(BPoint point, uint32 code, - const BMessage* dragMessage); + virtual void MouseDown(BPoint point); + virtual void MouseUp(BPoint point); + virtual void MouseMoved(BPoint point, uint32 code, + const BMessage* dragMessage); - virtual void DetachedFromWindow(); - virtual void AllAttached(); - virtual void AllDetached(); + // BScrollView + BScrollBar* ScrollBar(orientation posture) const; - virtual void FrameMoved(BPoint position); - virtual void FrameResized(float width, float height); + virtual void SetBorder(border_style border); + border_style Border() const; - virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 form, - const char* property); + virtual status_t SetBorderHighlighted(bool state); + bool IsBorderHighlighted() const; - virtual void ResizeToPreferred(); - virtual void GetPreferredSize(float* _width, float* _height); - virtual void MakeFocus(bool state = true); - virtual status_t GetSupportedSuites(BMessage* data); + void SetTarget(BView* target); + BView* Target() const; - virtual BSize MinSize(); - virtual BSize MaxSize(); - virtual BSize PreferredSize(); + // Scripting + virtual BHandler* ResolveSpecifier(BMessage* message, + int32 index, BMessage* specifier, + int32 form, const char* property); + virtual status_t GetSupportedSuites(BMessage* data); - virtual void InvalidateLayout(bool descendants = false); - virtual void DoLayout(); + virtual status_t Perform(perform_code d, void* arg); - // private or reserved methods are following +private: + // FBC padding and forbidden methods + virtual void _ReservedScrollView1(); + virtual void _ReservedScrollView2(); + virtual void _ReservedScrollView3(); + virtual void _ReservedScrollView4(); - virtual status_t Perform(perform_code d, void* arg); + BScrollView& operator=(const BScrollView& other); private: friend class BView; - virtual void _ReservedScrollView1(); - virtual void _ReservedScrollView2(); - virtual void _ReservedScrollView3(); - virtual void _ReservedScrollView4(); + void _Init(bool horizontal, bool vertical); + float _BorderSize() const; + BRect _InnerFrame() const; + BSize _ComputeSize(BSize targetSize) const; + BRect _ComputeFrame(BRect targetRect) const; + void _AlignScrollBars(bool horizontal, + bool vertical, BRect targetFrame); - BScrollView& operator=(const BScrollView& other); + static BRect _ComputeFrame(BRect frame, bool horizontal, + bool vertical, border_style border); + static BRect _ComputeFrame(BView* target, bool horizontal, + bool vertical, border_style border); + static float _BorderSize(border_style border); + static int32 _ModifyFlags(int32 flags, border_style border); - void _Init(bool horizontal, bool vertical); - float _BorderSize() const; - BRect _InnerFrame() const; - BSize _ComputeSize(BSize targetSize) const; - BRect _ComputeFrame(BRect targetRect) const; - void _AlignScrollBars(bool horizontal, bool vertical, - BRect targetFrame); +private: + BView* fTarget; + BScrollBar* fHorizontalScrollBar; + BScrollBar* fVerticalScrollBar; + border_style fBorder; + uint16 fPreviousWidth; + uint16 fPreviousHeight; + bool fHighlighted; - static BRect _ComputeFrame(BRect frame, bool horizontal, - bool vertical, border_style border); - static BRect _ComputeFrame(BView* target, bool horizontal, - bool vertical, border_style border); - static float _BorderSize(border_style border); - static int32 _ModifyFlags(int32 flags, border_style border); - - BView* fTarget; - BScrollBar* fHorizontalScrollBar; - BScrollBar* fVerticalScrollBar; - border_style fBorder; - uint16 fPreviousWidth; - uint16 fPreviousHeight; - bool fHighlighted; - - uint32 _reserved[3]; + uint32 _reserved[3]; }; -#endif /* _SCROLL_VIEW_H */ +#endif // _SCROLL_VIEW_H diff --git a/headers/os/interface/SeparatorItem.h b/headers/os/interface/SeparatorItem.h index da9b609b35..4405f28597 100644 --- a/headers/os/interface/SeparatorItem.h +++ b/headers/os/interface/SeparatorItem.h @@ -1,37 +1,41 @@ /* - * Copyright 2001-2007, Haiku, Inc. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * */ #ifndef _SEPARATOR_ITEM_H #define _SEPARATOR_ITEM_H + #include class BMessage; + + class BSeparatorItem : public BMenuItem { public: - BSeparatorItem(); - BSeparatorItem(BMessage *data); - - virtual ~BSeparatorItem(); - virtual status_t Archive(BMessage *data, bool deep = true) const; + BSeparatorItem(); + BSeparatorItem(BMessage* archive); + virtual ~BSeparatorItem(); - static BArchivable *Instantiate(BMessage *data); - virtual void SetEnabled(bool state); + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; + + virtual void SetEnabled(bool state); protected: - virtual void GetContentSize(float *width, float *height); - virtual void Draw(); + virtual void GetContentSize(float* _width, float* _height); + virtual void Draw(); private: - virtual void _ReservedSeparatorItem1(); - virtual void _ReservedSeparatorItem2(); + // FBC padding, reserved and forbidden + virtual void _ReservedSeparatorItem1(); + virtual void _ReservedSeparatorItem2(); - BSeparatorItem &operator=(const BSeparatorItem &); + BSeparatorItem& operator=(const BSeparatorItem& other); - uint32 _reserved[1]; + uint32 _reserved[1]; }; -#endif /* _SEPARATOR_ITEM_H */ +#endif // _SEPARATOR_ITEM_H diff --git a/headers/os/interface/SeparatorView.h b/headers/os/interface/SeparatorView.h index d0479f707d..86fb3bb545 100644 --- a/headers/os/interface/SeparatorView.h +++ b/headers/os/interface/SeparatorView.h @@ -1,11 +1,11 @@ /* - * Copyright 2001-2009, Stephan Aßmus - * Copyright 2001-2009, Ingo Weinhold - * All rights reserved. Distributed under the terms of the MIT license. + * Copyright 2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _SEPARATOR_VIEW_H #define _SEPARATOR_VIEW_H + #include #include #include @@ -55,8 +55,8 @@ public: bool deep = true) const; virtual void Draw(BRect updateRect); - virtual void GetPreferredSize(float* width, float* height); + virtual void GetPreferredSize(float* width, float* height); virtual BSize MinSize(); virtual BSize MaxSize(); virtual BSize PreferredSize(); @@ -74,6 +74,7 @@ protected: virtual void DoLayout(); private: + // FBC padding virtual void _ReservedSeparatorView1(); virtual void _ReservedSeparatorView2(); virtual void _ReservedSeparatorView3(); @@ -93,6 +94,7 @@ private: float _BorderSize() const; BRect _MaxLabelBounds() const; +private: BString fLabel; BView* fLabelView; diff --git a/headers/os/interface/Shape.h b/headers/os/interface/Shape.h index 53c4f1030c..874318b1d6 100644 --- a/headers/os/interface/Shape.h +++ b/headers/os/interface/Shape.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2007, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _SHAPE_H @@ -21,70 +21,80 @@ namespace BPrivate { class BShapeIterator { public: - BShapeIterator(); - virtual ~BShapeIterator(); + BShapeIterator(); + virtual ~BShapeIterator(); - virtual status_t IterateMoveTo(BPoint *point); - virtual status_t IterateLineTo(int32 lineCount, BPoint *linePts); - virtual status_t IterateBezierTo(int32 bezierCount, BPoint *bezierPts); - virtual status_t IterateClose(); + virtual status_t IterateMoveTo(BPoint* point); + virtual status_t IterateLineTo(int32 lineCount, + BPoint* linePts); + virtual status_t IterateBezierTo(int32 bezierCount, + BPoint* bezierPts); + virtual status_t IterateClose(); - status_t Iterate(BShape *shape); + status_t Iterate(BShape* shape); private: - virtual void _ReservedShapeIterator1(); - virtual void _ReservedShapeIterator2(); - virtual void _ReservedShapeIterator3(); - virtual void _ReservedShapeIterator4(); + virtual void _ReservedShapeIterator1(); + virtual void _ReservedShapeIterator2(); + virtual void _ReservedShapeIterator3(); + virtual void _ReservedShapeIterator4(); - uint32 reserved[4]; + uint32 reserved[4]; }; class BShape : public BArchivable { public: - BShape(); - BShape(const BShape ©From); - BShape(BMessage *data); - virtual ~BShape(); + BShape(); + BShape(const BShape& other); + BShape(BMessage* archive); + virtual ~BShape(); - virtual status_t Archive(BMessage *into, bool deep = true) const; - static BArchivable *Instantiate(BMessage *data); + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; - void Clear(); - BRect Bounds() const; + void Clear(); + BRect Bounds() const; - status_t AddShape(const BShape *other); + status_t AddShape(const BShape* other); - status_t MoveTo(BPoint point); - status_t LineTo(BPoint linePoint); - status_t BezierTo(BPoint controlPoints[3]); - status_t Close(); + status_t MoveTo(BPoint point); + status_t LineTo(BPoint linePoint); + status_t BezierTo(BPoint controlPoints[3]); + status_t Close(); private: - virtual status_t Perform(perform_code d, void *arg); + // FBC padding + virtual status_t Perform(perform_code code, void* data); - virtual void _ReservedShape1(); - virtual void _ReservedShape2(); - virtual void _ReservedShape3(); - virtual void _ReservedShape4(); + virtual void _ReservedShape1(); + virtual void _ReservedShape2(); + virtual void _ReservedShape3(); + virtual void _ReservedShape4(); +private: friend class BShapeIterator; friend class BView; friend class BFont; friend class BPrivate::PicturePlayer; friend class BPrivate::ServerLink; - void GetData(int32 *opCount, int32 *ptCount, uint32 **opList, BPoint **ptList); - void SetData(int32 opCount, int32 ptCount, const uint32 *opList, const BPoint *ptList); - void InitData(); - bool AllocatePts(int32 count); - bool AllocateOps(int32 count); + void GetData(int32* opCount, int32* ptCount, + uint32** opList, BPoint** ptList); + void SetData(int32 opCount, int32 ptCount, + const uint32* opList, + const BPoint* ptList); + void InitData(); + bool AllocatePts(int32 count); + bool AllocateOps(int32 count); - uint32 fState; - uint32 fBuildingOp; - void* fPrivateData; - uint32 reserved[4]; +private: + uint32 fState; + uint32 fBuildingOp; + void* fPrivateData; + + uint32 reserved[4]; }; -#endif // _SHAPE_H +#endif // _SHAPE_H diff --git a/headers/os/interface/Shelf.h b/headers/os/interface/Shelf.h index 6183f90b38..c2cc5cb6d8 100644 --- a/headers/os/interface/Shelf.h +++ b/headers/os/interface/Shelf.h @@ -1,15 +1,17 @@ /* - * Copyright 2001-2009, Haiku Inc. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _SHELF_H #define _SHELF_H + #include #include #include #include + class BDataIO; class BPoint; class BView; @@ -24,106 +26,123 @@ namespace BPrivate { class BShelf : public BHandler { - public: - BShelf(BView* view, bool allowDrags = true, const char* shelfType = NULL); - BShelf(const entry_ref* ref, BView* view, bool allowDrags = true, - const char* shelfType = NULL); - BShelf(BDataIO* stream, BView* view, bool allowDrags = true, - const char* shelfType = NULL); - BShelf(BMessage *data); - virtual ~BShelf(); +public: + BShelf(BView* view, bool allowDrags = true, + const char* shelfType = NULL); + BShelf(const entry_ref* ref, BView* view, + bool allowDrags = true, + const char* shelfType = NULL); + BShelf(BDataIO* stream, BView* view, + bool allowDrags = true, + const char* shelfType = NULL); + BShelf(BMessage* archive); + virtual ~BShelf(); - virtual status_t Archive(BMessage* data, bool deep = true) const; - static BArchivable* Instantiate(BMessage* archive); + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; - virtual void MessageReceived(BMessage *msg); - status_t Save(); - virtual void SetDirty(bool state); - bool IsDirty() const; + virtual void MessageReceived(BMessage* message); + status_t Save(); + virtual void SetDirty(bool state); + bool IsDirty() const; - virtual BHandler* ResolveSpecifier(BMessage *msg, - int32 index, BMessage *specifier, - int32 form, const char *property); - virtual status_t GetSupportedSuites(BMessage* data); + virtual BHandler* ResolveSpecifier(BMessage* message, + int32 index, BMessage* specifier, + int32 form, const char* property); + virtual status_t GetSupportedSuites(BMessage* data); - virtual status_t Perform(perform_code d, void *arg); - bool AllowsDragging() const; - void SetAllowsDragging(bool state); - bool AllowsZombies() const; - void SetAllowsZombies(bool state); - bool DisplaysZombies() const; - void SetDisplaysZombies(bool state); - bool IsTypeEnforced() const; - void SetTypeEnforced(bool state); + virtual status_t Perform(perform_code code, void* data); - status_t SetSaveLocation(BDataIO *data_io); - status_t SetSaveLocation(const entry_ref *ref); - BDataIO* SaveLocation(entry_ref *ref) const; + bool AllowsDragging() const; + void SetAllowsDragging(bool state); + bool AllowsZombies() const; + void SetAllowsZombies(bool state); + bool DisplaysZombies() const; + void SetDisplaysZombies(bool state); + bool IsTypeEnforced() const; + void SetTypeEnforced(bool state); - status_t AddReplicant(BMessage *data, BPoint location); - status_t DeleteReplicant(BView *replicant); - status_t DeleteReplicant(BMessage *data); - status_t DeleteReplicant(int32 index); - int32 CountReplicants() const; - BMessage* ReplicantAt(int32 index, - BView **view = NULL, - uint32 *uid = NULL, - status_t *perr = NULL) const; - int32 IndexOf(const BView *replicantView) const; - int32 IndexOf(const BMessage *archive) const; - int32 IndexOf(uint32 id) const; + status_t SetSaveLocation(BDataIO* stream); + status_t SetSaveLocation(const entry_ref* ref); + BDataIO* SaveLocation(entry_ref* ref) const; - protected: - virtual bool CanAcceptReplicantMessage(BMessage*) const; - virtual bool CanAcceptReplicantView(BRect, BView*, BMessage*) const; - virtual BPoint AdjustReplicantBy(BRect, BMessage*) const; + status_t AddReplicant(BMessage* archive, + BPoint location); + status_t DeleteReplicant(BView* replicant); + status_t DeleteReplicant(BMessage* archive); + status_t DeleteReplicant(int32 index); + int32 CountReplicants() const; + BMessage* ReplicantAt(int32 index, BView** view = NULL, + uint32* uid = NULL, + status_t* perr = NULL) const; + int32 IndexOf(const BView* replicantView) const; + int32 IndexOf(const BMessage* archive) const; + int32 IndexOf(uint32 id) const; - virtual void ReplicantDeleted(int32 index, const BMessage *archive, - const BView *replicant); +protected: + virtual bool CanAcceptReplicantMessage( + BMessage* archive) const; + virtual bool CanAcceptReplicantView(BRect, + BView*, BMessage*) const; + virtual BPoint AdjustReplicantBy(BRect, BMessage*) const; - private: - friend class BPrivate::ShelfContainerViewFilter; + virtual void ReplicantDeleted(int32 index, + const BMessage* archive, + const BView *replicant); - virtual void _ReservedShelf2(); - virtual void _ReservedShelf3(); - virtual void _ReservedShelf4(); - virtual void _ReservedShelf5(); - virtual void _ReservedShelf6(); - virtual void _ReservedShelf7(); - virtual void _ReservedShelf8(); +private: + // FBC padding and forbidden methods + virtual void _ReservedShelf2(); + virtual void _ReservedShelf3(); + virtual void _ReservedShelf4(); + virtual void _ReservedShelf5(); + virtual void _ReservedShelf6(); + virtual void _ReservedShelf7(); + virtual void _ReservedShelf8(); - BShelf(const BShelf& other); - BShelf& operator=(const BShelf& other); + BShelf(const BShelf& other); + BShelf& operator=(const BShelf& other); - status_t _Archive(BMessage* data) const; - void _InitData(BEntry* entry, BDataIO* stream, - BView* view, bool allowDrags); - status_t _DeleteReplicant(BPrivate::replicant_data* replicant); - status_t _AddReplicant(BMessage* data, - BPoint* location, uint32 uniqueID); - BView *_GetReplicant(BMessage *data, BView *view, const BPoint &point, - BDragger *&dragger, BDragger::relation &relation); - _BZombieReplicantView_ *_CreateZombie(BMessage *data, BDragger *&dragger); - - status_t _GetProperty(BMessage* message, BMessage* reply); - static void _GetReplicantData(BMessage *message, BView *view, BView *&replicant, - BDragger *&dragger, BDragger::relation &relation); - static BArchivable* _InstantiateObject(BMessage *archive, image_id *image); +private: + friend class BPrivate::ShelfContainerViewFilter; - private: - BView* fContainerView; - BDataIO* fStream; - BEntry* fEntry; - BList fReplicants; - BPrivate::ShelfContainerViewFilter* fFilter; - uint32 fGenCount; - bool fAllowDragging; - bool fDirty; - bool fDisplayZombies; - bool fAllowZombies; - bool fTypeEnforced; + status_t _Archive(BMessage* data) const; + void _InitData(BEntry* entry, BDataIO* stream, + BView* view, bool allowDrags); + status_t _DeleteReplicant( + BPrivate::replicant_data* replicant); + status_t _AddReplicant(BMessage* data, + BPoint* location, uint32 uniqueID); + BView* _GetReplicant(BMessage* data, BView* view, + const BPoint& point, BDragger*& dragger, + BDragger::relation& relation); + _BZombieReplicantView_* _CreateZombie(BMessage *data, + BDragger *&dragger); + + status_t _GetProperty(BMessage* message, + BMessage* reply); + static void _GetReplicantData(BMessage* message, + BView* view, BView*& replicant, + BDragger*& dragger, + BDragger::relation& relation); + static BArchivable* _InstantiateObject(BMessage* archive, + image_id* image); - uint32 _reserved[8]; +private: + BView* fContainerView; + BDataIO* fStream; + BEntry* fEntry; + BList fReplicants; + BPrivate::ShelfContainerViewFilter* fFilter; + uint32 fGenCount; + bool fAllowDragging; + bool fDirty; + bool fDisplayZombies; + bool fAllowZombies; + bool fTypeEnforced; + + uint32 _reserved[8]; }; #endif /* _SHELF_H */ diff --git a/headers/os/interface/Size.h b/headers/os/interface/Size.h index 8c19f48346..ebe3ae2827 100644 --- a/headers/os/interface/Size.h +++ b/headers/os/interface/Size.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _SIZE_H @@ -45,7 +45,6 @@ public: }; -// constructor inline BSize::BSize() : width(B_SIZE_UNSET), @@ -54,7 +53,6 @@ BSize::BSize() } -// copy constructor inline BSize::BSize(const BSize& other) : width(other.width), @@ -63,7 +61,6 @@ BSize::BSize(const BSize& other) } -// constructor inline BSize::BSize(float width, float height) : width(width), @@ -72,7 +69,6 @@ BSize::BSize(float width, float height) } -// Width inline float BSize::Width() const { @@ -80,7 +76,6 @@ BSize::Width() const } -// Height inline float BSize::Height() const { @@ -88,7 +83,6 @@ BSize::Height() const } -// Set inline void BSize::Set(float width, float height) { @@ -97,7 +91,6 @@ BSize::Set(float width, float height) } -// SetWidth inline void BSize::SetWidth(float width) { @@ -105,7 +98,6 @@ BSize::SetWidth(float width) } -// SetHeight inline void BSize::SetHeight(float height) { @@ -113,7 +105,6 @@ BSize::SetHeight(float height) } -// IntegerWidth inline int32 BSize::IntegerWidth() const { @@ -121,7 +112,6 @@ BSize::IntegerWidth() const } -// IntegerHeight inline int32 BSize::IntegerHeight() const { @@ -129,7 +119,6 @@ BSize::IntegerHeight() const } -// IsWidthSet inline bool BSize::IsWidthSet() const { @@ -137,7 +126,6 @@ BSize::IsWidthSet() const } -// IsHeightSet inline bool BSize::IsHeightSet() const { @@ -145,7 +133,6 @@ BSize::IsHeightSet() const } -// == inline bool BSize::operator==(const BSize& other) const { @@ -153,7 +140,6 @@ BSize::operator==(const BSize& other) const } -// != inline bool BSize::operator!=(const BSize& other) const { @@ -161,7 +147,6 @@ BSize::operator!=(const BSize& other) const } -// = inline BSize& BSize::operator=(const BSize& other) { @@ -170,4 +155,4 @@ BSize::operator=(const BSize& other) return *this; } -#endif // _SIZE_H +#endif // _SIZE_H diff --git a/headers/os/interface/Slider.h b/headers/os/interface/Slider.h index 2e2fdf2536..e90404ad61 100644 --- a/headers/os/interface/Slider.h +++ b/headers/os/interface/Slider.h @@ -1,9 +1,6 @@ /* - * Copyright 2001-2009, Haiku. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Marc Flerackers (mflerackers@androme.be) */ #ifndef _SLIDER_H #define _SLIDER_H @@ -56,11 +53,12 @@ public: uint32 flags = B_NAVIGABLE | B_WILL_DRAW | B_FRAME_EVENTS); - BSlider(BMessage* data); + BSlider(BMessage* archive); virtual ~BSlider(); - static BArchivable* Instantiate(BMessage* data); - virtual status_t Archive(BMessage* data, bool deep = true) const; + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; virtual status_t Perform(perform_code code, void* data); virtual void WindowActivated(bool state); @@ -89,7 +87,8 @@ public: virtual void SetPosition(float); float Position() const; virtual void SetEnabled(bool on); - void GetLimits(int32* minimum, int32* maximum) const; + void GetLimits(int32* minimum, + int32* maximum) const; virtual void Draw(BRect); virtual void DrawSlider(); @@ -108,13 +107,14 @@ public: virtual void SetFlags(uint32 flags); virtual void SetResizingMode(uint32 mode); - virtual void GetPreferredSize(float* width, float* height); + virtual void GetPreferredSize(float* _width, + float* _height); virtual void ResizeToPreferred(); virtual status_t Invoke(BMessage* message = NULL); - virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 form, - const char* property); + virtual BHandler* ResolveSpecifier(BMessage* message, + int32 index, BMessage* specifier, + int32 form, const char* property); virtual status_t GetSupportedSuites(BMessage* data); virtual void SetModificationMessage(BMessage* message); @@ -176,6 +176,11 @@ private: BSize _ValidateMinSize(); + void _InitBarColor(); + void _InitObject(); + +private: + // FBC padding and forbidden methods virtual void _ReservedSlider6(); virtual void _ReservedSlider7(); virtual void _ReservedSlider8(); @@ -186,9 +191,6 @@ private: BSlider& operator=(const BSlider& other); - void _InitBarColor(); - void _InitObject(); - private: BMessage* fModificationMessage; int32 fSnoozeAmount; diff --git a/headers/os/interface/SpaceLayoutItem.h b/headers/os/interface/SpaceLayoutItem.h index 2c5234d805..282b01639e 100644 --- a/headers/os/interface/SpaceLayoutItem.h +++ b/headers/os/interface/SpaceLayoutItem.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _SPACE_LAYOUT_ITEM_H diff --git a/headers/os/interface/SplitLayoutBuilder.h b/headers/os/interface/SplitLayoutBuilder.h index 05b6a258e6..7ae53ade0b 100644 --- a/headers/os/interface/SplitLayoutBuilder.h +++ b/headers/os/interface/SplitLayoutBuilder.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _SPLIT_LAYOUT_BUILDER_H diff --git a/headers/os/interface/SplitView.h b/headers/os/interface/SplitView.h index 5d2f687e20..2db9067cf4 100644 --- a/headers/os/interface/SplitView.h +++ b/headers/os/interface/SplitView.h @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _SPLIT_VIEW_H @@ -13,14 +13,15 @@ class BSplitLayout; class BSplitView : public BView { public: BSplitView( - enum orientation orientation = B_HORIZONTAL, + enum orientation orientation + = B_HORIZONTAL, float spacing = 0.0f); virtual ~BSplitView(); void SetInsets(float left, float top, float right, float bottom); - void GetInsets(float* left, float* top, float* right, - float* bottom) const; + void GetInsets(float* left, float* top, + float* right, float* bottom) const; float Spacing() const; void SetSpacing(float spacing); @@ -61,12 +62,14 @@ public: protected: virtual void DrawSplitter(BRect frame, const BRect& updateRect, - enum orientation orientation, bool pressed); + enum orientation orientation, + bool pressed); private: static void _DrawDefaultSplitter(BView* view, BRect frame, const BRect& updateRect, - enum orientation orientation, bool pressed); + enum orientation orientation, + bool pressed); private: BSplitLayout* fSplitLayout; diff --git a/headers/os/interface/StatusBar.h b/headers/os/interface/StatusBar.h index 066dad53cc..aebf4207cd 100644 --- a/headers/os/interface/StatusBar.h +++ b/headers/os/interface/StatusBar.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _STATUS_BAR_H @@ -26,9 +26,32 @@ public: bool deep = true) const; virtual void AttachedToWindow(); - virtual void MessageReceived(BMessage* message); + virtual void DetachedFromWindow(); + virtual void AllAttached(); + virtual void AllDetached(); + + virtual void WindowActivated(bool state); + virtual void MakeFocus(bool focus = true); + + virtual void GetPreferredSize(float* _width, + float* _height); + virtual BSize MinSize(); + virtual BSize MaxSize(); + virtual BSize PreferredSize(); + virtual void ResizeToPreferred(); + virtual void FrameMoved(BPoint newPosition); + virtual void FrameResized(float newWidth, float newHeight); + virtual void Draw(BRect updateRect); + virtual void MessageReceived(BMessage* message); + + virtual void MouseDown(BPoint where); + virtual void MouseUp(BPoint where); + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* dragMessage); + + // BStatusBar virtual void SetBarColor(rgb_color color); virtual void SetBarHeight(float height); @@ -53,33 +76,13 @@ public: const char* Label() const; const char* TrailingLabel() const; - virtual void MouseDown(BPoint where); - virtual void MouseUp(BPoint where); - virtual void WindowActivated(bool state); - virtual void MouseMoved(BPoint where, uint32 transit, - const BMessage* dragMessage); - virtual void DetachedFromWindow(); - virtual void FrameMoved(BPoint newPosition); - virtual void FrameResized(float newWidth, float newHeight); - - virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 what, - const char* property); - - virtual void ResizeToPreferred(); - virtual void GetPreferredSize(float* _width, float* _height); - virtual void MakeFocus(bool focus = true); - virtual void AllAttached(); - virtual void AllDetached(); + 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 d, void* arg); - // Layout methods - virtual BSize MinSize(); - virtual BSize MaxSize(); - virtual BSize PreferredSize(); - private: // FBC memebers virtual void _ReservedStatusBar2(); diff --git a/headers/os/interface/StringItem.h b/headers/os/interface/StringItem.h index c82dc85ebd..a6708ade83 100644 --- a/headers/os/interface/StringItem.h +++ b/headers/os/interface/StringItem.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _STRING_ITEM_H @@ -11,33 +11,37 @@ class BStringItem : public BListItem { public: - BStringItem(const char* text, - uint32 outlineLevel = 0, bool expanded = true); - BStringItem(BMessage* archive); - virtual ~BStringItem(); + BStringItem(const char* text, + uint32 outlineLevel = 0, + bool expanded = true); + BStringItem(BMessage* archive); + virtual ~BStringItem(); - static BArchivable* Instantiate(BMessage* archive); - virtual status_t Archive(BMessage* archive, bool deep = true) const; + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; - virtual void DrawItem(BView* owner, BRect frame, - bool complete = false); - virtual void SetText(const char* text); - const char* Text() const; + virtual void DrawItem(BView* owner, BRect frame, + bool complete = false); + virtual void SetText(const char* text); + const char* Text() const; - virtual void Update(BView* owner, const BFont* font); + virtual void Update(BView* owner, const BFont* font); - virtual status_t Perform(perform_code code, void* arg); + virtual status_t Perform(perform_code code, void* arg); private: - virtual void _ReservedStringItem1(); - virtual void _ReservedStringItem2(); + // FBC padding and forbidden methods + virtual void _ReservedStringItem1(); + virtual void _ReservedStringItem2(); - BStringItem(const BStringItem& item); - BStringItem& operator=(const BStringItem& item); + BStringItem(const BStringItem& item); + BStringItem& operator=(const BStringItem& item); - char* fText; - float fBaselineOffset; - uint32 _reserved[2]; +private: + char* fText; + float fBaselineOffset; + uint32 _reserved[2]; }; #endif // _STRING_ITEM_H diff --git a/headers/os/interface/StringView.h b/headers/os/interface/StringView.h index 393cf32c67..6b800cd9c4 100644 --- a/headers/os/interface/StringView.h +++ b/headers/os/interface/StringView.h @@ -1,9 +1,6 @@ /* - * Copyright 2001-2005, Haiku Inc. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Frans van Nispen (xlr8@tref.nl) */ #ifndef _STRING_VIEW_H #define _STRING_VIEW_H @@ -14,70 +11,78 @@ class BStringView : public BView{ - public: - BStringView(BRect bounds, const char* name, - const char* text, - uint32 resizeFlags = B_FOLLOW_LEFT | B_FOLLOW_TOP, - uint32 flags = B_WILL_DRAW); - BStringView(const char* name, const char* text, - uint32 flags = B_WILL_DRAW); - BStringView(BMessage* data); - virtual ~BStringView(); +public: + BStringView(BRect bounds, const char* name, + const char* text, uint32 resizeFlags + = B_FOLLOW_LEFT | B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW); + BStringView(const char* name, const char* text, + uint32 flags = B_WILL_DRAW); + BStringView(BMessage* archive); + virtual ~BStringView(); - static BArchivable* Instantiate(BMessage* data); - virtual status_t Archive(BMessage* data, bool deep = true) const; + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; - void SetText(const char* text); - const char* Text() const; - void SetAlignment(alignment flag); - alignment Alignment() const; + void SetText(const char* text); + const char* Text() const; + void SetAlignment(alignment flag); + alignment Alignment() const; - virtual void AttachedToWindow(); - virtual void Draw(BRect bounds); + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + virtual void AllAttached(); + virtual void AllDetached(); - virtual void MessageReceived(BMessage* message); - virtual void MouseDown(BPoint point); - virtual void MouseUp(BPoint point); - virtual void MouseMoved(BPoint point, uint32 transit, - const BMessage* dragMessage); - virtual void DetachedFromWindow(); - virtual void FrameMoved(BPoint newPosition); - virtual void FrameResized(float newWidth, float newHeight); + virtual void MakeFocus(bool state = true); - virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, - BMessage* specifier, int32 form, - const char* property); + virtual void GetPreferredSize(float* _width, + float* _height); + virtual BSize MinSize(); + virtual BSize MaxSize(); + virtual BSize PreferredSize(); + virtual void InvalidateLayout(bool descendants = false); + virtual void ResizeToPreferred(); + virtual void FrameMoved(BPoint newPosition); + virtual void FrameResized(float newWidth, float newHeight); - 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 Draw(BRect bounds); - virtual void SetFont(const BFont* font, - uint32 mask = B_FONT_ALL); + virtual void MessageReceived(BMessage* message); + virtual void MouseDown(BPoint point); + virtual void MouseUp(BPoint point); + virtual void MouseMoved(BPoint point, uint32 transit, + const BMessage* dragMessage); - virtual void InvalidateLayout(bool descendants = false); - - virtual BSize MinSize(); - virtual BSize MaxSize(); - virtual BSize PreferredSize(); + virtual BHandler* ResolveSpecifier(BMessage* message, + int32 index, BMessage* specifier, + int32 form, const char* property); + virtual status_t GetSupportedSuites(BMessage* data); - private: - virtual status_t Perform(perform_code d, void* arg); - virtual void _ReservedStringView1(); - virtual void _ReservedStringView2(); - virtual void _ReservedStringView3(); + virtual void SetFont(const BFont* font, + uint32 mask = B_FONT_ALL); - BSize _ValidatePreferredSize(); - BStringView &operator=(const BStringView&); +private: + // FBC padding and forbidden methods + virtual status_t Perform(perform_code code, void* data); - char* fText; - alignment fAlign; - BSize fPreferredSize; - uint32 _reserved[1]; + virtual void _ReservedStringView1(); + virtual void _ReservedStringView2(); + virtual void _ReservedStringView3(); + + BStringView& operator=(const BStringView& other); + +private: + BSize _ValidatePreferredSize(); + +private: + char* fText; + alignment fAlign; + BSize fPreferredSize; + + uint32 _reserved[1]; }; -#endif // _STRING_VIEW_H +#endif // _STRING_VIEW_H diff --git a/headers/os/interface/TabView.h b/headers/os/interface/TabView.h index 9e10697b64..c68dd637b2 100644 --- a/headers/os/interface/TabView.h +++ b/headers/os/interface/TabView.h @@ -1,6 +1,6 @@ /* * Copyright 2001-2009, Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Distributed under the terms of the MIT License. */ #ifndef _TAB_VIEW_H #define _TAB_VIEW_H @@ -51,6 +51,7 @@ public: tab_position position, bool full = true); private: + // FBC padding and forbidden methods virtual void _ReservedTab1(); virtual void _ReservedTab2(); virtual void _ReservedTab3(); @@ -66,6 +67,7 @@ private: BTab& operator=(const BTab&); +private: bool fEnabled; bool fSelected; bool fFocus; @@ -79,15 +81,15 @@ class BTabView : public BView { public: BTabView(const char* name, button_width width = B_WIDTH_AS_USUAL, - uint32 flags = B_FULL_UPDATE_ON_RESIZE | - B_WILL_DRAW | B_NAVIGABLE_JUMP | - B_FRAME_EVENTS | B_NAVIGABLE); + uint32 flags = B_FULL_UPDATE_ON_RESIZE + | B_WILL_DRAW | B_NAVIGABLE_JUMP + | B_FRAME_EVENTS | B_NAVIGABLE); BTabView(BRect frame, const char* name, button_width width = B_WIDTH_AS_USUAL, uint32 resizingMode = B_FOLLOW_ALL, - uint32 flags = B_FULL_UPDATE_ON_RESIZE | - B_WILL_DRAW | B_NAVIGABLE_JUMP | - B_FRAME_EVENTS | B_NAVIGABLE); + uint32 flags = B_FULL_UPDATE_ON_RESIZE + | B_WILL_DRAW | B_NAVIGABLE_JUMP + | B_FRAME_EVENTS | B_NAVIGABLE); virtual ~BTabView(); BTabView(BMessage* archive); @@ -96,15 +98,12 @@ public: bool deep = true) const; virtual status_t Perform(perform_code d, void* arg); - virtual void WindowActivated(bool active); virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); virtual void AllAttached(); virtual void AllDetached(); - virtual void DetachedFromWindow(); virtual void MessageReceived(BMessage* message); - virtual void FrameMoved(BPoint newLocation); - virtual void FrameResized(float width,float height); virtual void KeyDown(const char* bytes, int32 numBytes); virtual void MouseDown(BPoint point); virtual void MouseUp(BPoint point); @@ -115,6 +114,7 @@ public: virtual void Select(int32 tab); int32 Selection() const; + virtual void WindowActivated(bool active); virtual void MakeFocus(bool focused = true); virtual void SetFocusTab(int32 tab, bool focused); int32 FocusTab() const; @@ -135,11 +135,15 @@ public: virtual BSize MaxSize(); virtual BSize PreferredSize(); + virtual void FrameMoved(BPoint newLocation); + virtual void FrameResized(float width,float height); + virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier, int32 what, const char* property); virtual status_t GetSupportedSuites(BMessage* message); + // BTabView virtual void AddTab(BView* target, BTab* tab = NULL); virtual BTab* RemoveTab(int32 tabIndex); @@ -157,9 +161,7 @@ public: BView* ViewForTab(int32 tabIndex) const; private: - void _InitObject(bool layouted, button_width width); - BSize _TabsMinSize() const; - + // FBC padding and forbidden methods virtual void _ReservedTabView1(); virtual void _ReservedTabView2(); virtual void _ReservedTabView3(); @@ -176,6 +178,11 @@ private: BTabView(const BTabView&); BTabView& operator=(const BTabView&); +private: + void _InitObject(bool layouted, button_width width); + BSize _TabsMinSize() const; + +private: BList* fTabList; BView* fContainerView; button_width fTabWidthSetting; diff --git a/headers/os/interface/TextControl.h b/headers/os/interface/TextControl.h index a244aba026..b99072c8d7 100644 --- a/headers/os/interface/TextControl.h +++ b/headers/os/interface/TextControl.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2008, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _TEXT_CONTROL_H @@ -11,9 +11,10 @@ class BLayoutItem; namespace BPrivate { -class _BTextInput_; + class _BTextInput_; } + class BTextControl : public BControl { public: BTextControl(BRect frame, const char* name, @@ -62,13 +63,14 @@ public: virtual void FrameResized(float newWidth, float newHeight); virtual void WindowActivated(bool active); - virtual void GetPreferredSize(float* _width, float* _height); + virtual void GetPreferredSize(float* _width, + float* _height); virtual void ResizeToPreferred(); virtual void MessageReceived(BMessage* message); - virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 what, - const char* property); + virtual BHandler* ResolveSpecifier(BMessage* message, + int32 index, BMessage* specifier, + int32 what, const char* property); virtual void MouseUp(BPoint point); virtual void MouseMoved(BPoint point, uint32 transit, @@ -93,14 +95,7 @@ protected: virtual void DoLayout(); private: - class LabelLayoutItem; - class TextViewLayoutItem; - struct LayoutData; - - friend class _BTextInput_; - friend class LabelLayoutItem; - friend class TextViewLayoutItem; - + // FBC padding and forbidden methods virtual status_t Perform(perform_code d, void* arg); virtual void _ReservedTextControl1(); @@ -110,9 +105,19 @@ private: BTextControl& operator=(const BTextControl& other); +private: + class LabelLayoutItem; + class TextViewLayoutItem; + struct LayoutData; + + friend class _BTextInput_; + friend class LabelLayoutItem; + friend class TextViewLayoutItem; + void _CommitValue(); void _UpdateTextViewColors(bool enabled); - void _InitData(const char* label, const char* initialText, + void _InitData(const char* label, + const char* initialText, BMessage* archive = NULL); void _ValidateLayout(); void _LayoutTextView(); diff --git a/headers/os/interface/TextView.h b/headers/os/interface/TextView.h index 1351787536..7042b44b5d 100644 --- a/headers/os/interface/TextView.h +++ b/headers/os/interface/TextView.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2007-2008, Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Copyright 2007-2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _TEXTVIEW_H #define _TEXTVIEW_H @@ -38,7 +38,8 @@ enum undo_state { namespace BPrivate { class TextGapBuffer; -} // namespace BPrivate +} + class BTextView : public BView { public: @@ -59,12 +60,13 @@ public: const rgb_color* initialColor, uint32 flags); - BTextView(BMessage* data); + BTextView(BMessage* archive); virtual ~BTextView(); - static BArchivable* Instantiate(BMessage* data); - virtual status_t Archive(BMessage* data, bool deep = true) const; + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; virtual void AttachedToWindow(); virtual void DetachedFromWindow(); @@ -80,11 +82,10 @@ public: virtual void MakeFocus(bool focusState = true); virtual void MessageReceived(BMessage* message); - virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 form, - const char* property); + virtual BHandler* ResolveSpecifier(BMessage* message, + int32 index, BMessage* specifier, + int32 form, const char* property); virtual status_t GetSupportedSuites(BMessage* data); - virtual status_t Perform(perform_code d, void* arg); void SetText(const char* inText, const text_run_array* inRuns = NULL); @@ -224,9 +225,6 @@ public: protected: virtual void DoLayout(); -private: - void _ValidateLayoutData(); - public: virtual void AllAttached(); virtual void AllDetached(); @@ -256,6 +254,22 @@ protected: BBitmap** _bitmap, BPoint* point, BHandler** _handler); + // FBC padding and forbidden methods +public: + virtual status_t Perform(perform_code code, void* data); + +private: + virtual void _ReservedTextView3(); + virtual void _ReservedTextView4(); + virtual void _ReservedTextView5(); + virtual void _ReservedTextView6(); + virtual void _ReservedTextView7(); + virtual void _ReservedTextView8(); + virtual void _ReservedTextView9(); + virtual void _ReservedTextView10(); + virtual void _ReservedTextView11(); + virtual void _ReservedTextView12(); + private: class InlineInput; struct LayoutData; @@ -273,21 +287,12 @@ private: friend class TextTrackState; - virtual void _ReservedTextView3(); - virtual void _ReservedTextView4(); - virtual void _ReservedTextView5(); - virtual void _ReservedTextView6(); - virtual void _ReservedTextView7(); - virtual void _ReservedTextView8(); - virtual void _ReservedTextView9(); - virtual void _ReservedTextView10(); - virtual void _ReservedTextView11(); - virtual void _ReservedTextView12(); - void _InitObject(BRect textRect, const BFont* initialFont, const rgb_color* initialColor); + void _ValidateLayoutData(); + void _HandleBackspace(); void _HandleArrowKey(uint32 inArrowKey); void _HandleDelete(); @@ -316,14 +321,17 @@ private: int32 inLength, int32 inOffset, const text_run_array* inRuns); - void _DoDeleteText(int32 fromOffset, int32 toOffset); + void _DoDeleteText(int32 fromOffset, + int32 toOffset); void _DrawLine(BView* view, const int32 &startLine, - const int32& startOffset, const bool& erase, - BRect& eraseRect, BRegion& inputRegion); + const int32& startOffset, + const bool& erase, BRect& eraseRect, + BRegion& inputRegion); void _DrawLines(int32 startLine, int32 endLine, - int32 startOffset = -1, bool erase = false); + int32 startOffset = -1, + bool erase = false); void _RequestDrawLines(int32 startLine, int32 endLine, int32 startOffset = -1, bool erase = false); @@ -398,6 +406,7 @@ private: float verticalStep); void _ScrollTo(float x, float y); +private: BPrivate::TextGapBuffer* fText; LineBuffer* fLines; StyleBuffer* fStyles; diff --git a/headers/os/interface/TwoDimensionalLayout.h b/headers/os/interface/TwoDimensionalLayout.h index fc9878f196..d756c08e57 100644 --- a/headers/os/interface/TwoDimensionalLayout.h +++ b/headers/os/interface/TwoDimensionalLayout.h @@ -1,10 +1,11 @@ /* - * Copyright 2006, Haiku Inc. + * Copyright 2006, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _TWO_DIMENSIONAL_LAYOUT_H #define _TWO_DIMENSIONAL_LAYOUT_H + #include class BLayoutContext; @@ -90,4 +91,4 @@ private: LocalLayouter* fLocalLayouter; }; -#endif // _TWO_DIMENSIONAL_LAYOUT_H +#endif // _TWO_DIMENSIONAL_LAYOUT_H diff --git a/headers/os/interface/UnicodeBlockObjects.h b/headers/os/interface/UnicodeBlockObjects.h index d3da567f7f..ed5061e378 100644 --- a/headers/os/interface/UnicodeBlockObjects.h +++ b/headers/os/interface/UnicodeBlockObjects.h @@ -1,9 +1,6 @@ /* - * Copyright 2001-2009, Haiku Inc. All Rights Reserved. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Erik Jaesler (erik@cgsoftware.com) */ #ifndef _UNICODEBLOCKOBJECTS_H #define _UNICODEBLOCKOBJECTS_H diff --git a/headers/os/interface/View.h b/headers/os/interface/View.h index e29473f0a3..2d96265f10 100644 --- a/headers/os/interface/View.h +++ b/headers/os/interface/View.h @@ -1,9 +1,6 @@ /* - * Copyright 2001-2009, Haiku. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Erik Jaesler (erik@cgsoftware.com) */ #ifndef _VIEW_H #define _VIEW_H @@ -21,14 +18,14 @@ // mouse button enum { - B_PRIMARY_MOUSE_BUTTON = 0x01, - B_SECONDARY_MOUSE_BUTTON = 0x02, - B_TERTIARY_MOUSE_BUTTON = 0x04 + B_PRIMARY_MOUSE_BUTTON = 0x01, + B_SECONDARY_MOUSE_BUTTON = 0x02, + B_TERTIARY_MOUSE_BUTTON = 0x04 }; // mouse transit enum { - B_ENTERED_VIEW = 0, + B_ENTERED_VIEW = 0, B_INSIDE_VIEW, B_EXITED_VIEW, B_OUTSIDE_VIEW @@ -36,19 +33,19 @@ enum { // event mask enum { - B_POINTER_EVENTS = 0x00000001, - B_KEYBOARD_EVENTS = 0x00000002 + B_POINTER_EVENTS = 0x00000001, + B_KEYBOARD_EVENTS = 0x00000002 }; // event mask options enum { - B_LOCK_WINDOW_FOCUS = 0x00000001, - B_SUSPEND_VIEW_FOCUS = 0x00000002, - B_NO_POINTER_HISTORY = 0x00000004, - // new in Haiku (unless this flag is + B_LOCK_WINDOW_FOCUS = 0x00000001, + B_SUSPEND_VIEW_FOCUS = 0x00000002, + B_NO_POINTER_HISTORY = 0x00000004, + // NOTE: New in Haiku (unless this flag is // specified, both BWindow and BView::GetMouse() // will filter out older mouse moved messages) - B_FULL_POINTER_HISTORY = 0x00000008 + B_FULL_POINTER_HISTORY = 0x00000008 }; enum { @@ -58,16 +55,16 @@ enum { // set font mask enum { - B_FONT_FAMILY_AND_STYLE = 0x00000001, - B_FONT_SIZE = 0x00000002, - B_FONT_SHEAR = 0x00000004, - B_FONT_ROTATION = 0x00000008, - B_FONT_SPACING = 0x00000010, - B_FONT_ENCODING = 0x00000020, - B_FONT_FACE = 0x00000040, - B_FONT_FLAGS = 0x00000080, - B_FONT_FALSE_BOLD_WIDTH = 0x00000100, - B_FONT_ALL = 0x000001FF + B_FONT_FAMILY_AND_STYLE = 0x00000001, + B_FONT_SIZE = 0x00000002, + B_FONT_SHEAR = 0x00000004, + B_FONT_ROTATION = 0x00000008, + B_FONT_SPACING = 0x00000010, + B_FONT_ENCODING = 0x00000020, + B_FONT_FACE = 0x00000040, + B_FONT_FLAGS = 0x00000080, + B_FONT_FALSE_BOLD_WIDTH = 0x00000100, + B_FONT_ALL = 0x000001FF }; // view flags @@ -87,17 +84,18 @@ const uint32 B_INVALIDATE_AFTER_LAYOUT = 0x00080000UL; /* 20 */ #define _RESIZE_MASK_ (0xffff) -const uint32 _VIEW_TOP_ = 1UL; -const uint32 _VIEW_LEFT_ = 2UL; -const uint32 _VIEW_BOTTOM_ = 3UL; -const uint32 _VIEW_RIGHT_ = 4UL; -const uint32 _VIEW_CENTER_ = 5UL; +const uint32 _VIEW_TOP_ = 1UL; +const uint32 _VIEW_LEFT_ = 2UL; +const uint32 _VIEW_BOTTOM_ = 3UL; +const uint32 _VIEW_RIGHT_ = 4UL; +const uint32 _VIEW_CENTER_ = 5UL; inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4) { return ((r1 << 12) | (r2 << 8) | (r3 << 4) | r4); } #define B_FOLLOW_NONE 0 -#define B_FOLLOW_ALL_SIDES _rule_(_VIEW_TOP_, _VIEW_LEFT_, _VIEW_BOTTOM_, _VIEW_RIGHT_) +#define B_FOLLOW_ALL_SIDES _rule_(_VIEW_TOP_, _VIEW_LEFT_, _VIEW_BOTTOM_, \ + _VIEW_RIGHT_) #define B_FOLLOW_ALL B_FOLLOW_ALL_SIDES #define B_FOLLOW_LEFT _rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_) @@ -137,426 +135,456 @@ namespace BPrivate { class BView : public BHandler { public: - BView(const char* name, uint32 flags, - BLayout* layout = NULL); - BView(BRect frame, const char* name, - uint32 resizeMask, uint32 flags); - virtual ~BView(); + BView(const char* name, uint32 flags, + BLayout* layout = NULL); + BView(BRect frame, const char* name, + uint32 resizeMask, uint32 flags); + virtual ~BView(); - BView(BMessage* data); - static BArchivable* Instantiate(BMessage* data); - virtual status_t Archive(BMessage* data, bool deep = true) const; + BView(BMessage* archive); + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; - virtual void AttachedToWindow(); - virtual void AllAttached(); - virtual void DetachedFromWindow(); - virtual void AllDetached(); + virtual void AttachedToWindow(); + virtual void AllAttached(); + virtual void DetachedFromWindow(); + virtual void AllDetached(); - virtual void MessageReceived(BMessage* msg); + virtual void MessageReceived(BMessage* message); - void AddChild(BView* child, BView* before = NULL); - bool AddChild(BLayoutItem* child); - bool RemoveChild(BView* child); - int32 CountChildren() const; - BView* ChildAt(int32 index) const; - BView* NextSibling() const; - BView* PreviousSibling() const; - bool RemoveSelf(); + void AddChild(BView* child, BView* before = NULL); + bool AddChild(BLayoutItem* child); + bool RemoveChild(BView* child); + int32 CountChildren() const; + BView* ChildAt(int32 index) const; + BView* NextSibling() const; + BView* PreviousSibling() const; + bool RemoveSelf(); - BWindow* Window() const; + BWindow* Window() const; - virtual void Draw(BRect updateRect); - virtual void MouseDown(BPoint where); - virtual void MouseUp(BPoint where); - virtual void MouseMoved(BPoint where, uint32 code, - const BMessage* dragMessage); - virtual void WindowActivated(bool state); - virtual void KeyDown(const char* bytes, int32 numBytes); - virtual void KeyUp(const char* bytes, int32 numBytes); - virtual void Pulse(); - virtual void FrameMoved(BPoint newPosition); - virtual void FrameResized(float newWidth, float newHeight); + virtual void Draw(BRect updateRect); + virtual void MouseDown(BPoint where); + virtual void MouseUp(BPoint where); + virtual void MouseMoved(BPoint where, uint32 code, + const BMessage* dragMessage); + virtual void WindowActivated(bool state); + virtual void KeyDown(const char* bytes, int32 numBytes); + virtual void KeyUp(const char* bytes, int32 numBytes); + virtual void Pulse(); + virtual void FrameMoved(BPoint newPosition); + virtual void FrameResized(float newWidth, float newHeight); - virtual void TargetedByScrollView(BScrollView* scrollView); - void BeginRectTracking(BRect startRect, - uint32 style = B_TRACK_WHOLE_RECT); - void EndRectTracking(); + virtual void TargetedByScrollView(BScrollView* scrollView); + void BeginRectTracking(BRect startRect, + uint32 style = B_TRACK_WHOLE_RECT); + void EndRectTracking(); - void GetMouse(BPoint* location, uint32* buttons, - bool checkMessageQueue = true); + void GetMouse(BPoint* location, uint32* buttons, + bool checkMessageQueue = true); - void DragMessage(BMessage* message, BRect dragRect, - BHandler* replyTo = NULL); - void DragMessage(BMessage* message, BBitmap* bitmap, - BPoint offset, BHandler* replyTo = NULL); - void DragMessage(BMessage* message, BBitmap* bitmap, - drawing_mode dragMode, BPoint offset, - BHandler* replyTo = NULL); + void DragMessage(BMessage* message, BRect dragRect, + BHandler* replyTo = NULL); + void DragMessage(BMessage* message, BBitmap* bitmap, + BPoint offset, BHandler* replyTo = NULL); + void DragMessage(BMessage* message, BBitmap* bitmap, + drawing_mode dragMode, BPoint offset, + BHandler* replyTo = NULL); - BView* FindView(const char* name) const; - BView* Parent() const; - BRect Bounds() const; - BRect Frame() const; - void ConvertToScreen(BPoint* pt) const; - BPoint ConvertToScreen(BPoint pt) const; - void ConvertFromScreen(BPoint* pt) const; - BPoint ConvertFromScreen(BPoint pt) const; - void ConvertToScreen(BRect* r) const; - BRect ConvertToScreen(BRect r) const; - void ConvertFromScreen(BRect* r) const; - BRect ConvertFromScreen(BRect r) const; - void ConvertToParent(BPoint* pt) const; - BPoint ConvertToParent(BPoint pt) const; - void ConvertFromParent(BPoint* pt) const; - BPoint ConvertFromParent(BPoint pt) const; - void ConvertToParent(BRect* r) const; - BRect ConvertToParent(BRect r) const; - void ConvertFromParent(BRect* r) const; - BRect ConvertFromParent(BRect r) const; - BPoint LeftTop() const; + BView* FindView(const char* name) const; + BView* Parent() const; + BRect Bounds() const; + BRect Frame() const; + void ConvertToScreen(BPoint* pt) const; + BPoint ConvertToScreen(BPoint pt) const; + void ConvertFromScreen(BPoint* pt) const; + BPoint ConvertFromScreen(BPoint pt) const; + void ConvertToScreen(BRect* r) const; + BRect ConvertToScreen(BRect r) const; + void ConvertFromScreen(BRect* r) const; + BRect ConvertFromScreen(BRect r) const; + void ConvertToParent(BPoint* pt) const; + BPoint ConvertToParent(BPoint pt) const; + void ConvertFromParent(BPoint* pt) const; + BPoint ConvertFromParent(BPoint pt) const; + void ConvertToParent(BRect* r) const; + BRect ConvertToParent(BRect r) const; + void ConvertFromParent(BRect* r) const; + BRect ConvertFromParent(BRect r) const; + BPoint LeftTop() const; - void GetClippingRegion(BRegion* region) const; - virtual void ConstrainClippingRegion(BRegion* region); - void ClipToPicture(BPicture* picture, - BPoint where = B_ORIGIN, bool sync = true); - void ClipToInversePicture(BPicture* picture, - BPoint where = B_ORIGIN, bool sync = true); + void GetClippingRegion(BRegion* region) const; + virtual void ConstrainClippingRegion(BRegion* region); + void ClipToPicture(BPicture* picture, + BPoint where = B_ORIGIN, bool sync = true); + void ClipToInversePicture(BPicture* picture, + BPoint where = B_ORIGIN, bool sync = true); - virtual void SetDrawingMode(drawing_mode mode); - drawing_mode DrawingMode() const; + virtual void SetDrawingMode(drawing_mode mode); + drawing_mode DrawingMode() const; - void SetBlendingMode(source_alpha srcAlpha, - alpha_function alphaFunc); - void GetBlendingMode(source_alpha* srcAlpha, - alpha_function* alphaFunc) const; + void SetBlendingMode(source_alpha srcAlpha, + alpha_function alphaFunc); + void GetBlendingMode(source_alpha* srcAlpha, + alpha_function* alphaFunc) const; - virtual void SetPenSize(float size); - float PenSize() const; + virtual void SetPenSize(float size); + float PenSize() const; - void SetViewCursor(const BCursor* cursor, - bool sync = true); + void SetViewCursor(const BCursor* cursor, + bool sync = true); - virtual void SetViewColor(rgb_color c); - void SetViewColor(uchar r, uchar g, uchar b, - uchar a = 255); - rgb_color ViewColor() const; + virtual void SetViewColor(rgb_color c); + void SetViewColor(uchar r, uchar g, uchar b, + uchar a = 255); + rgb_color ViewColor() const; - void SetViewBitmap(const BBitmap* bitmap, - BRect srcRect, BRect dstRect, - uint32 followFlags - = B_FOLLOW_TOP | B_FOLLOW_LEFT, - uint32 options = B_TILE_BITMAP); - void SetViewBitmap(const BBitmap* bitmap, - uint32 followFlags - = B_FOLLOW_TOP | B_FOLLOW_LEFT, - uint32 options = B_TILE_BITMAP); - void ClearViewBitmap(); + void SetViewBitmap(const BBitmap* bitmap, + BRect srcRect, BRect dstRect, + uint32 followFlags + = B_FOLLOW_TOP | B_FOLLOW_LEFT, + uint32 options = B_TILE_BITMAP); + void SetViewBitmap(const BBitmap* bitmap, + uint32 followFlags + = B_FOLLOW_TOP | B_FOLLOW_LEFT, + uint32 options = B_TILE_BITMAP); + void ClearViewBitmap(); - status_t SetViewOverlay(const BBitmap* overlay, - BRect srcRect, BRect dstRect, - rgb_color* colorKey, - uint32 followFlags - = B_FOLLOW_TOP | B_FOLLOW_LEFT, - uint32 options = 0); - status_t SetViewOverlay(const BBitmap* overlay, - rgb_color* colorKey, - uint32 followFlags - = B_FOLLOW_TOP | B_FOLLOW_LEFT, - uint32 options = 0); - void ClearViewOverlay(); + status_t SetViewOverlay(const BBitmap* overlay, + BRect srcRect, BRect dstRect, + rgb_color* colorKey, + uint32 followFlags + = B_FOLLOW_TOP | B_FOLLOW_LEFT, + uint32 options = 0); + status_t SetViewOverlay(const BBitmap* overlay, + rgb_color* colorKey, + uint32 followFlags + = B_FOLLOW_TOP | B_FOLLOW_LEFT, + uint32 options = 0); + void ClearViewOverlay(); - virtual void SetHighColor(rgb_color a_color); - void SetHighColor(uchar r, uchar g, uchar b, - uchar a = 255); - rgb_color HighColor() const; + virtual void SetHighColor(rgb_color a_color); + void SetHighColor(uchar r, uchar g, uchar b, + uchar a = 255); + rgb_color HighColor() const; - virtual void SetLowColor(rgb_color a_color); - void SetLowColor(uchar r, uchar g, uchar b, - uchar a = 255); - rgb_color LowColor() const; + virtual void SetLowColor(rgb_color a_color); + void SetLowColor(uchar r, uchar g, uchar b, + uchar a = 255); + rgb_color LowColor() const; - void SetLineMode(cap_mode lineCap, join_mode lineJoin, - float miterLimit = B_DEFAULT_MITER_LIMIT); - join_mode LineJoinMode() const; - cap_mode LineCapMode() const; - float LineMiterLimit() const; + void SetLineMode(cap_mode lineCap, + join_mode lineJoin, + float miterLimit = B_DEFAULT_MITER_LIMIT); + join_mode LineJoinMode() const; + cap_mode LineCapMode() const; + float LineMiterLimit() const; - void SetOrigin(BPoint pt); - void SetOrigin(float x, float y); - BPoint Origin() const; + void SetOrigin(BPoint pt); + void SetOrigin(float x, float y); + BPoint Origin() const; - void PushState(); - void PopState(); + void PushState(); + void PopState(); - void MovePenTo(BPoint pt); - void MovePenTo(float x, float y); - void MovePenBy(float x, float y); - BPoint PenLocation() const; - void StrokeLine(BPoint toPt, pattern p = B_SOLID_HIGH); - void StrokeLine(BPoint a, BPoint b, - pattern p = B_SOLID_HIGH); - void BeginLineArray(int32 count); - void AddLine(BPoint a, BPoint b, rgb_color color); - void EndLineArray(); + void MovePenTo(BPoint pt); + void MovePenTo(float x, float y); + void MovePenBy(float x, float y); + BPoint PenLocation() const; + void StrokeLine(BPoint toPt, + pattern p = B_SOLID_HIGH); + void StrokeLine(BPoint a, BPoint b, + pattern p = B_SOLID_HIGH); + void BeginLineArray(int32 count); + void AddLine(BPoint a, BPoint b, rgb_color color); + void EndLineArray(); - void StrokePolygon(const BPolygon* polygon, - bool closed = true, pattern p = B_SOLID_HIGH); - void StrokePolygon(const BPoint* ptArray, int32 numPts, - bool closed = true, pattern p = B_SOLID_HIGH); - void StrokePolygon(const BPoint* ptArray, int32 numPts, - BRect bounds, bool closed = true, - pattern p = B_SOLID_HIGH); - void FillPolygon(const BPolygon* polygon, - pattern p = B_SOLID_HIGH); - void FillPolygon(const BPoint* ptArray, int32 numPts, - pattern p = B_SOLID_HIGH); - void FillPolygon(const BPoint* ptArray, int32 numPts, - BRect bounds, pattern p = B_SOLID_HIGH); - void FillPolygon(const BPolygon* polygon, - const BGradient& gradient); - void FillPolygon(const BPoint* ptArray, int32 numPts, - const BGradient& gradient); - void FillPolygon(const BPoint* ptArray, int32 numPts, - BRect bounds, const BGradient& gradient); + void StrokePolygon(const BPolygon* polygon, + bool closed = true, + pattern p = B_SOLID_HIGH); + void StrokePolygon(const BPoint* ptArray, + int32 numPts, bool closed = true, + pattern p = B_SOLID_HIGH); + void StrokePolygon(const BPoint* ptArray, + int32 numPts, BRect bounds, + bool closed = true, + pattern p = B_SOLID_HIGH); + void FillPolygon(const BPolygon* polygon, + pattern p = B_SOLID_HIGH); + void FillPolygon(const BPoint* ptArray, + int32 numPts, pattern p = B_SOLID_HIGH); + void FillPolygon(const BPoint* ptArray, + int32 numPts, BRect bounds, + pattern p = B_SOLID_HIGH); + void FillPolygon(const BPolygon* polygon, + const BGradient& gradient); + void FillPolygon(const BPoint* ptArray, + int32 numPts, const BGradient& gradient); + void FillPolygon(const BPoint* ptArray, + int32 numPts, BRect bounds, + const BGradient& gradient); - void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, - BRect bounds, pattern p = B_SOLID_HIGH); - void StrokeTriangle(BPoint pt1, BPoint pt2, BPoint pt3, - pattern p = B_SOLID_HIGH); - void FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, - pattern p = B_SOLID_HIGH); - void FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, - BRect bounds, pattern p = B_SOLID_HIGH); - void FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, - const BGradient& gradient); - void FillTriangle(BPoint pt1, BPoint pt2, BPoint pt3, - BRect bounds, const BGradient& gradient); + void StrokeTriangle(BPoint pt1, BPoint pt2, + BPoint pt3, BRect bounds, + pattern p = B_SOLID_HIGH); + void StrokeTriangle(BPoint pt1, BPoint pt2, + BPoint pt3, pattern p = B_SOLID_HIGH); + void FillTriangle(BPoint pt1, BPoint pt2, + BPoint pt3, pattern p = B_SOLID_HIGH); + void FillTriangle(BPoint pt1, BPoint pt2, + BPoint pt3, BRect bounds, + pattern p = B_SOLID_HIGH); + void FillTriangle(BPoint pt1, BPoint pt2, + BPoint pt3, const BGradient& gradient); + void FillTriangle(BPoint pt1, BPoint pt2, + BPoint pt3, BRect bounds, + const BGradient& gradient); - void StrokeRect(BRect r, pattern p = B_SOLID_HIGH); - void FillRect(BRect r, pattern p = B_SOLID_HIGH); - void FillRect(BRect r, const BGradient& gradient); - void FillRegion(BRegion* region, - pattern p = B_SOLID_HIGH); - void FillRegion(BRegion* region, - const BGradient& gradient); - void InvertRect(BRect r); + void StrokeRect(BRect r, pattern p = B_SOLID_HIGH); + void FillRect(BRect r, pattern p = B_SOLID_HIGH); + void FillRect(BRect r, const BGradient& gradient); + void FillRegion(BRegion* region, + pattern p = B_SOLID_HIGH); + void FillRegion(BRegion* region, + const BGradient& gradient); + void InvertRect(BRect r); - void StrokeRoundRect(BRect r, float xRadius, - float yRadius, pattern p = B_SOLID_HIGH); - void FillRoundRect(BRect r, float xRadius, float yRadius, - pattern p = B_SOLID_HIGH); - void FillRoundRect(BRect r, float xRadius, float yRadius, - const BGradient& gradient); + void StrokeRoundRect(BRect r, float xRadius, + float yRadius, pattern p = B_SOLID_HIGH); + void FillRoundRect(BRect r, float xRadius, + float yRadius, pattern p = B_SOLID_HIGH); + void FillRoundRect(BRect r, float xRadius, + float yRadius, const BGradient& gradient); - void StrokeEllipse(BPoint center, float xRadius, - float yRadius, pattern p = B_SOLID_HIGH); - void StrokeEllipse(BRect r, pattern p = B_SOLID_HIGH); - void FillEllipse(BPoint center, float xRadius, - float yRadius, pattern p = B_SOLID_HIGH); - void FillEllipse(BRect r, pattern p = B_SOLID_HIGH); - void FillEllipse(BPoint center, float xRadius, - float yRadius, const BGradient& gradient); - void FillEllipse(BRect r, const BGradient& gradient); + void StrokeEllipse(BPoint center, float xRadius, + float yRadius, pattern p = B_SOLID_HIGH); + void StrokeEllipse(BRect r, + pattern p = B_SOLID_HIGH); + void FillEllipse(BPoint center, float xRadius, + float yRadius, pattern p = B_SOLID_HIGH); + void FillEllipse(BRect r, pattern p = B_SOLID_HIGH); + void FillEllipse(BPoint center, float xRadius, + float yRadius, const BGradient& gradient); + void FillEllipse(BRect r, + const BGradient& gradient); - void StrokeArc(BPoint center, float xRadius, - float yRadius, float startAngle, float arcAngle, - pattern p = B_SOLID_HIGH); - void StrokeArc(BRect r, float startAngle, - float arcAngle, pattern p = B_SOLID_HIGH); - void FillArc(BPoint center, float xRadius, float yRadius, - float startAngle, float arcAngle, - pattern p = B_SOLID_HIGH); - void FillArc(BRect r, float startAngle, float arcAngle, - pattern p = B_SOLID_HIGH); - void FillArc(BPoint center, float xRadius, float yRadius, - float startAngle, float arcAngle, - const BGradient& gradient); - void FillArc(BRect r, float startAngle, float arcAngle, - const BGradient& gradient); + void StrokeArc(BPoint center, float xRadius, + float yRadius, float startAngle, + float arcAngle, pattern p = B_SOLID_HIGH); + void StrokeArc(BRect r, float startAngle, + float arcAngle, pattern p = B_SOLID_HIGH); + void FillArc(BPoint center, float xRadius, + float yRadius, float startAngle, + float arcAngle, pattern p = B_SOLID_HIGH); + void FillArc(BRect r, float startAngle, + float arcAngle, pattern p = B_SOLID_HIGH); + void FillArc(BPoint center, float xRadius, + float yRadius, float startAngle, + float arcAngle, const BGradient& gradient); + void FillArc(BRect r, float startAngle, + float arcAngle, const BGradient& gradient); - void StrokeBezier(BPoint* controlPoints, - pattern p = B_SOLID_HIGH); - void FillBezier(BPoint* controlPoints, - pattern p = B_SOLID_HIGH); - void FillBezier(BPoint* controlPoints, - const BGradient& gradient); + void StrokeBezier(BPoint* controlPoints, + pattern p = B_SOLID_HIGH); + void FillBezier(BPoint* controlPoints, + pattern p = B_SOLID_HIGH); + void FillBezier(BPoint* controlPoints, + const BGradient& gradient); - void StrokeShape(BShape* shape, - pattern p = B_SOLID_HIGH); - void FillShape(BShape* shape, pattern p = B_SOLID_HIGH); - void FillShape(BShape* shape, const BGradient& gradient); + void StrokeShape(BShape* shape, + pattern p = B_SOLID_HIGH); + void FillShape(BShape* shape, + pattern p = B_SOLID_HIGH); + void FillShape(BShape* shape, + const BGradient& gradient); - void CopyBits(BRect src, BRect dst); + void CopyBits(BRect src, BRect dst); - void DrawBitmapAsync(const BBitmap* aBitmap, - BRect bitmapRect, BRect viewRect, - uint32 options); - void DrawBitmapAsync(const BBitmap* aBitmap, - BRect bitmapRect, BRect viewRect); - void DrawBitmapAsync(const BBitmap* aBitmap, - BRect viewRect); - void DrawBitmapAsync(const BBitmap* aBitmap, - BPoint where); - void DrawBitmapAsync(const BBitmap* aBitmap); + void DrawBitmapAsync(const BBitmap* aBitmap, + BRect bitmapRect, BRect viewRect, + uint32 options); + void DrawBitmapAsync(const BBitmap* aBitmap, + BRect bitmapRect, BRect viewRect); + void DrawBitmapAsync(const BBitmap* aBitmap, + BRect viewRect); + void DrawBitmapAsync(const BBitmap* aBitmap, + BPoint where); + void DrawBitmapAsync(const BBitmap* aBitmap); - void DrawBitmap(const BBitmap* aBitmap, - BRect bitmapRect, BRect viewRect, - uint32 options); - void DrawBitmap(const BBitmap* aBitmap, - BRect bitmapRect, BRect viewRect); - void DrawBitmap(const BBitmap* aBitmap, - BRect viewRect); - void DrawBitmap(const BBitmap* aBitmap, - BPoint where); - void DrawBitmap(const BBitmap* aBitmap); + void DrawBitmap(const BBitmap* aBitmap, + BRect bitmapRect, BRect viewRect, + uint32 options); + void DrawBitmap(const BBitmap* aBitmap, + BRect bitmapRect, BRect viewRect); + void DrawBitmap(const BBitmap* aBitmap, + BRect viewRect); + void DrawBitmap(const BBitmap* aBitmap, + BPoint where); + void DrawBitmap(const BBitmap* aBitmap); - void DrawChar(char aChar); - void DrawChar(char aChar, BPoint location); - void DrawString(const char* aString, - escapement_delta* delta = NULL); - void DrawString(const char* aString, BPoint location, - escapement_delta* delta = NULL); - void DrawString(const char* aString, int32 length, - escapement_delta* delta = NULL); - void DrawString(const char* aString, int32 length, - BPoint location, escapement_delta* delta = 0L); + void DrawChar(char aChar); + void DrawChar(char aChar, BPoint location); + void DrawString(const char* aString, + escapement_delta* delta = NULL); + void DrawString(const char* aString, + BPoint location, + escapement_delta* delta = NULL); + void DrawString(const char* aString, int32 length, + escapement_delta* delta = NULL); + void DrawString(const char* aString, int32 length, + BPoint location, + escapement_delta* delta = 0L); - virtual void SetFont(const BFont* font, - uint32 mask = B_FONT_ALL); + virtual void SetFont(const BFont* font, + uint32 mask = B_FONT_ALL); - void GetFont(BFont* font) const; - void TruncateString(BString* in_out, uint32 mode, - float width) const; - float StringWidth(const char* string) const; - float StringWidth(const char* string, int32 length) const; - void GetStringWidths(char* stringArray[], - int32 lengthArray[], int32 numStrings, - float widthArray[]) const; - void SetFontSize(float size); - void ForceFontAliasing(bool enable); - void GetFontHeight(font_height* height) const; + void GetFont(BFont* font) const; + void TruncateString(BString* in_out, uint32 mode, + float width) const; + float StringWidth(const char* string) const; + float StringWidth(const char* string, + int32 length) const; + void GetStringWidths(char* stringArray[], + int32 lengthArray[], int32 numStrings, + float widthArray[]) const; + void SetFontSize(float size); + void ForceFontAliasing(bool enable); + void GetFontHeight(font_height* height) const; - void Invalidate(BRect invalRect); - void Invalidate(const BRegion* invalRegion); - void Invalidate(); + void Invalidate(BRect invalRect); + void Invalidate(const BRegion* invalRegion); + void Invalidate(); - void SetDiskMode(char* filename, long offset); + void SetDiskMode(char* filename, long offset); - void BeginPicture(BPicture* a_picture); - void AppendToPicture(BPicture* a_picture); - BPicture* EndPicture(); + void BeginPicture(BPicture* a_picture); + void AppendToPicture(BPicture* a_picture); + BPicture* EndPicture(); - void DrawPicture(const BPicture* a_picture); - void DrawPicture(const BPicture* a_picture, - BPoint where); - void DrawPicture(const char* filename, long offset, - BPoint where); - void DrawPictureAsync(const BPicture* a_picture); - void DrawPictureAsync(const BPicture* a_picture, - BPoint where); - void DrawPictureAsync(const char* filename, long offset, - BPoint where); + void DrawPicture(const BPicture* a_picture); + void DrawPicture(const BPicture* a_picture, + BPoint where); + void DrawPicture(const char* filename, long offset, + BPoint where); + void DrawPictureAsync(const BPicture* a_picture); + void DrawPictureAsync(const BPicture* a_picture, + BPoint where); + void DrawPictureAsync(const char* filename, + long offset, BPoint where); - status_t SetEventMask(uint32 mask, uint32 options = 0); - uint32 EventMask(); - status_t SetMouseEventMask(uint32 mask, uint32 options = 0); + status_t SetEventMask(uint32 mask, uint32 options = 0); + uint32 EventMask(); + status_t SetMouseEventMask(uint32 mask, + uint32 options = 0); - virtual void SetFlags(uint32 flags); - uint32 Flags() const; - virtual void SetResizingMode(uint32 mode); - uint32 ResizingMode() const; - void MoveBy(float dh, float dv); - void MoveTo(BPoint where); - void MoveTo(float x, float y); - void ResizeBy(float dh, float dv); - void ResizeTo(float width, float height); - void ResizeTo(BSize size); - void ScrollBy(float dh, float dv); - void ScrollTo(float x, float y); - virtual void ScrollTo(BPoint where); - virtual void MakeFocus(bool focusState = true); - bool IsFocus() const; + virtual void SetFlags(uint32 flags); + uint32 Flags() const; + virtual void SetResizingMode(uint32 mode); + uint32 ResizingMode() const; + void MoveBy(float dh, float dv); + void MoveTo(BPoint where); + void MoveTo(float x, float y); + void ResizeBy(float dh, float dv); + void ResizeTo(float width, float height); + void ResizeTo(BSize size); + void ScrollBy(float dh, float dv); + void ScrollTo(float x, float y); + virtual void ScrollTo(BPoint where); + virtual void MakeFocus(bool focusState = true); + bool IsFocus() const; - virtual void Show(); - virtual void Hide(); - bool IsHidden() const; - bool IsHidden(const BView* looking_from) const; + virtual void Show(); + virtual void Hide(); + bool IsHidden() const; + bool IsHidden(const BView* looking_from) const; - void Flush() const; - void Sync() const; + void Flush() const; + void Sync() const; - virtual void GetPreferredSize(float* width, float* height); - virtual void ResizeToPreferred(); + virtual void GetPreferredSize(float* width, float* height); + virtual void ResizeToPreferred(); - BScrollBar* ScrollBar(orientation posture) const; + BScrollBar* ScrollBar(orientation posture) const; - virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, - BMessage* specifier, int32 form, - const char* property); - virtual status_t GetSupportedSuites(BMessage* data); + virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, + BMessage* specifier, int32 form, + const char* property); + virtual status_t GetSupportedSuites(BMessage* data); - bool IsPrinting() const; - void SetScale(float scale) const; - float Scale() const; - // new for Haiku + bool IsPrinting() const; + void SetScale(float scale) const; + float Scale() const; + // new for Haiku - virtual status_t Perform(perform_code code, void* data); + virtual status_t Perform(perform_code code, void* data); - virtual void DrawAfterChildren(BRect r); + virtual void DrawAfterChildren(BRect r); - // layout related + // layout related - virtual BSize MinSize(); - virtual BSize MaxSize(); - virtual BSize PreferredSize(); - virtual BAlignment LayoutAlignment(); + virtual BSize MinSize(); + virtual BSize MaxSize(); + virtual BSize PreferredSize(); + virtual BAlignment LayoutAlignment(); - void SetExplicitMinSize(BSize size); - void SetExplicitMaxSize(BSize size); - void SetExplicitPreferredSize(BSize size); - void SetExplicitAlignment(BAlignment alignment); + void SetExplicitMinSize(BSize size); + void SetExplicitMaxSize(BSize size); + void SetExplicitPreferredSize(BSize size); + void SetExplicitAlignment(BAlignment alignment); - BSize ExplicitMinSize() const; - BSize ExplicitMaxSize() const; - BSize ExplicitPreferredSize() const; - BAlignment ExplicitAlignment() const; + BSize ExplicitMinSize() const; + BSize ExplicitMaxSize() const; + BSize ExplicitPreferredSize() const; + BAlignment ExplicitAlignment() const; - virtual bool HasHeightForWidth(); - virtual void GetHeightForWidth(float width, float* min, - float* max, float* preferred); + virtual bool HasHeightForWidth(); + virtual void GetHeightForWidth(float width, float* min, + float* max, float* preferred); - virtual void SetLayout(BLayout* layout); - BLayout* GetLayout() const; + virtual void SetLayout(BLayout* layout); + BLayout* GetLayout() const; - virtual void InvalidateLayout(bool descendants = false); - void EnableLayoutInvalidation(); - void DisableLayoutInvalidation(); - bool IsLayoutValid() const; - void ResetLayoutInvalidation(); + virtual void InvalidateLayout(bool descendants = false); + void EnableLayoutInvalidation(); + void DisableLayoutInvalidation(); + bool IsLayoutValid() const; + void ResetLayoutInvalidation(); - BLayoutContext* LayoutContext() const; + BLayoutContext* LayoutContext() const; - void Layout(bool force); - void Relayout(); + void Layout(bool force); + void Relayout(); protected: - virtual void DoLayout(); + virtual void DoLayout(); public: - // tool tip support + // tool tip support - void SetToolTip(const char* text); - void SetToolTip(BToolTip* tip); - BToolTip* ToolTip() const; + void SetToolTip(const char* text); + void SetToolTip(BToolTip* tip); + BToolTip* ToolTip() const; - void ShowToolTip(BToolTip* tip = NULL); - void HideToolTip(); + void ShowToolTip(BToolTip* tip = NULL); + void HideToolTip(); protected: - virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); + virtual bool GetToolTipAt(BPoint point, BToolTip** _tip); private: - void _Layout(bool force, BLayoutContext* context); + void _Layout(bool force, BLayoutContext* context); + +private: + // FBC padding and forbidden methods + virtual void _ReservedView12(); + virtual void _ReservedView13(); + virtual void _ReservedView14(); + virtual void _ReservedView15(); + virtual void _ReservedView16(); + + BView(const BView&); + BView& operator=(const BView&); private: struct LayoutData; @@ -569,110 +597,104 @@ private: friend class BTabView; friend class BWindow; - virtual void _ReservedView12(); - virtual void _ReservedView13(); - virtual void _ReservedView14(); - virtual void _ReservedView15(); - virtual void _ReservedView16(); + void _InitData(BRect frame, const char* name, + uint32 resizeMask, uint32 flags); + status_t _SetViewBitmap(const BBitmap* bitmap, + BRect srcRect, BRect dstRect, + uint32 followFlags, uint32 options); + void _ClipToPicture(BPicture* picture, BPoint where, + bool invert, bool sync); - BView(const BView&); - BView& operator=(const BView&); + bool _CheckOwnerLockAndSwitchCurrent() const; + bool _CheckOwnerLock() const; + void _CheckLockAndSwitchCurrent() const; + void _CheckLock() const; + void _SwitchServerCurrentView() const; - void _InitData(BRect frame, const char* name, - uint32 resizeMask, uint32 flags); - status_t _SetViewBitmap(const BBitmap* bitmap, - BRect srcRect, BRect dstRect, - uint32 followFlags, uint32 options); - void _ClipToPicture(BPicture* picture, BPoint where, - bool invert, bool sync); + void _SetOwner(BWindow* newOwner); + void _RemoveCommArray(); - bool _CheckOwnerLockAndSwitchCurrent() const; - bool _CheckOwnerLock() const; - void _CheckLockAndSwitchCurrent() const; - void _CheckLock() const; - void _SwitchServerCurrentView() const; + BShelf* _Shelf() const; + void _SetShelf(BShelf* shelf); - void _SetOwner(BWindow* newOwner); - void _RemoveCommArray(); + void _MoveTo(int32 x, int32 y); + void _ResizeBy(int32 deltaWidth, int32 deltaHeight); + void _ParentResizedBy(int32 deltaWidth, + int32 deltaHeight); - BShelf* _Shelf() const; - void _SetShelf(BShelf* shelf); + void _ConvertToScreen(BPoint* pt, + bool checkLock) const; + void _ConvertFromScreen(BPoint* pt, + bool checkLock) const; - void _MoveTo(int32 x, int32 y); - void _ResizeBy(int32 deltaWidth, int32 deltaHeight); - void _ParentResizedBy(int32 deltaWidth, - int32 deltaHeight); + void _ConvertToParent(BPoint* pt, + bool checkLock) const; + void _ConvertFromParent(BPoint* pt, + bool checkLock) const; - void _ConvertToScreen(BPoint* pt, bool checkLock) const; - void _ConvertFromScreen(BPoint* pt, - bool checkLock) const; + void _Activate(bool state); + void _Attach(); + void _Detach(); + void _Draw(BRect screenUpdateRect); + void _DrawAfterChildren(BRect screenUpdateRect); + void _Pulse(); - void _ConvertToParent(BPoint* pt, bool checkLock) const; - void _ConvertFromParent(BPoint* pt, - bool checkLock) const; + void _UpdateStateForRemove(); + void _UpdatePattern(::pattern pattern); + void _FlushIfNotInTransaction(); - void _Activate(bool state); - void _Attach(); - void _Detach(); - void _Draw(BRect screenUpdateRect); - void _DrawAfterChildren(BRect screenUpdateRect); - void _Pulse(); + bool _CreateSelf(); + bool _AddChildToList(BView* child, + BView* before = NULL); + bool _RemoveChildFromList(BView* child); - void _UpdateStateForRemove(); - void _UpdatePattern(::pattern pattern); + bool _AddChild(BView *child, BView *before); + bool _RemoveSelf(); - void _FlushIfNotInTransaction(); + // Debugging methods + void _PrintToStream(); + void _PrintTree(); - bool _CreateSelf(); - bool _AddChildToList(BView* child, BView* before = NULL); - bool _RemoveChildFromList(BView* child); + int32 _unused_int1; - bool _AddChild(BView *child, BView *before); - bool _RemoveSelf(); + uint32 fFlags; + BPoint fParentOffset; + BWindow* fOwner; + BView* fParent; + BView* fNextSibling; + BView* fPreviousSibling; + BView* fFirstChild; - // Debugging methods - void _PrintToStream(); - void _PrintTree(); + int16 fShowLevel; + bool fTopLevelView; + bool fNoISInteraction; + BPicture* fCurrentPicture; + _array_data_* fCommArray; - int32 _unused_int1; + BScrollBar* fVerScroller; + BScrollBar* fHorScroller; + bool fIsPrinting; + bool fAttached; + bool _unused_bool1; + bool _unused_bool2; + BPrivate::ViewState* fState; + BRect fBounds; + BShelf* fShelf; + uint32 fEventMask; + uint32 fEventOptions; + uint32 fMouseEventOptions; - uint32 fFlags; - BPoint fParentOffset; - BWindow* fOwner; - BView* fParent; - BView* fNextSibling; - BView* fPreviousSibling; - BView* fFirstChild; + LayoutData* fLayoutData; + BToolTip* fToolTip; + BToolTip* fVisibleToolTip; - int16 fShowLevel; - bool fTopLevelView; - bool fNoISInteraction; - BPicture* fCurrentPicture; - _array_data_* fCommArray; - - BScrollBar* fVerScroller; - BScrollBar* fHorScroller; - bool fIsPrinting; - bool fAttached; - bool _unused_bool1; - bool _unused_bool2; - BPrivate::ViewState* fState; - BRect fBounds; - BShelf* fShelf; - uint32 fEventMask; - uint32 fEventOptions; - uint32 fMouseEventOptions; - - LayoutData* fLayoutData; - BToolTip* fToolTip; - BToolTip* fVisibleToolTip; - - uint32 _reserved[5]; + uint32 _reserved[5]; }; -// inline definitions ---------------------------------------------------------- +// #pragma mark - inline definitions + inline void BView::ScrollTo(float x, float y) @@ -680,6 +702,7 @@ BView::ScrollTo(float x, float y) ScrollTo(BPoint(x, y)); } + inline void BView::SetViewColor(uchar r, uchar g, uchar b, uchar a) { @@ -691,6 +714,7 @@ BView::SetViewColor(uchar r, uchar g, uchar b, uchar a) SetViewColor(color); } + inline void BView::SetHighColor(uchar r, uchar g, uchar b, uchar a) { @@ -702,6 +726,7 @@ BView::SetHighColor(uchar r, uchar g, uchar b, uchar a) SetHighColor(color); } + inline void BView::SetLowColor(uchar r, uchar g, uchar b, uchar a) { @@ -713,4 +738,4 @@ BView::SetLowColor(uchar r, uchar g, uchar b, uchar a) SetLowColor(color); } -#endif // _VIEW_H +#endif // _VIEW_H diff --git a/headers/os/interface/Window.h b/headers/os/interface/Window.h index b434321f91..93db100ed7 100644 --- a/headers/os/interface/Window.h +++ b/headers/os/interface/Window.h @@ -1,9 +1,6 @@ /* - * Copyright 2001-2009, Haiku. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Adrian Oanca */ #ifndef _WINDOW_H #define _WINDOW_H @@ -32,31 +29,31 @@ namespace BPrivate { enum window_type { - B_UNTYPED_WINDOW = 0, - B_TITLED_WINDOW = 1, - B_MODAL_WINDOW = 3, - B_DOCUMENT_WINDOW = 11, - B_BORDERED_WINDOW = 20, - B_FLOATING_WINDOW = 21 + B_UNTYPED_WINDOW = 0, + B_TITLED_WINDOW = 1, + B_MODAL_WINDOW = 3, + B_DOCUMENT_WINDOW = 11, + B_BORDERED_WINDOW = 20, + B_FLOATING_WINDOW = 21 }; enum window_look { - B_BORDERED_WINDOW_LOOK = 20, - B_NO_BORDER_WINDOW_LOOK = 19, - B_TITLED_WINDOW_LOOK = 1, - B_DOCUMENT_WINDOW_LOOK = 11, - B_MODAL_WINDOW_LOOK = 3, - B_FLOATING_WINDOW_LOOK = 7 + B_BORDERED_WINDOW_LOOK = 20, + B_NO_BORDER_WINDOW_LOOK = 19, + B_TITLED_WINDOW_LOOK = 1, + B_DOCUMENT_WINDOW_LOOK = 11, + B_MODAL_WINDOW_LOOK = 3, + B_FLOATING_WINDOW_LOOK = 7 }; enum window_feel { - B_NORMAL_WINDOW_FEEL = 0, - B_MODAL_SUBSET_WINDOW_FEEL = 2, - B_MODAL_APP_WINDOW_FEEL = 1, - B_MODAL_ALL_WINDOW_FEEL = 3, - B_FLOATING_SUBSET_WINDOW_FEEL = 5, - B_FLOATING_APP_WINDOW_FEEL = 4, - B_FLOATING_ALL_WINDOW_FEEL = 6 + B_NORMAL_WINDOW_FEEL = 0, + B_MODAL_SUBSET_WINDOW_FEEL = 2, + B_MODAL_APP_WINDOW_FEEL = 1, + B_MODAL_ALL_WINDOW_FEEL = 3, + B_FLOATING_SUBSET_WINDOW_FEEL = 5, + B_FLOATING_APP_WINDOW_FEEL = 4, + B_FLOATING_ALL_WINDOW_FEEL = 6 }; enum window_alignment { @@ -87,177 +84,198 @@ enum { B_NO_SERVER_SIDE_WINDOW_MODIFIERS = 0x00000200 }; -#define B_CURRENT_WORKSPACE 0 -#define B_ALL_WORKSPACES 0xffffffff +#define B_CURRENT_WORKSPACE 0 +#define B_ALL_WORKSPACES 0xffffffff -//---------------------------------------------------------------- class BWindow : public BLooper { public: - BWindow(BRect frame, const char* title, - window_type type, uint32 flags, - uint32 workspace = B_CURRENT_WORKSPACE); - BWindow(BRect frame, const char* title, - window_look look, window_feel feel, uint32 flags, - uint32 workspace = B_CURRENT_WORKSPACE); - virtual ~BWindow(); + BWindow(BRect frame, const char* title, + window_type type, uint32 flags, + uint32 workspace = B_CURRENT_WORKSPACE); + BWindow(BRect frame, const char* title, + window_look look, window_feel feel, + uint32 flags, uint32 workspace + = B_CURRENT_WORKSPACE); + virtual ~BWindow(); - BWindow(BMessage* data); - static BArchivable* Instantiate(BMessage* data); - virtual status_t Archive(BMessage* data, bool deep = true) const; + BWindow(BMessage* archive); + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; - virtual void Quit(); - void Close() { Quit(); } + virtual void Quit(); + void Close() { Quit(); } - void AddChild(BView* child, BView* before = NULL); - bool RemoveChild(BView* child); - int32 CountChildren() const; - BView* ChildAt(int32 index) const; + void AddChild(BView* child, BView* before = NULL); + bool RemoveChild(BView* child); + int32 CountChildren() const; + BView* ChildAt(int32 index) const; - virtual void DispatchMessage(BMessage* message, - BHandler* handler); - virtual void MessageReceived(BMessage* message); - virtual void FrameMoved(BPoint newPosition); - virtual void WorkspacesChanged(uint32 oldWorkspaces, - uint32 newWorkspaces); - virtual void WorkspaceActivated(int32 workspace, bool state); - virtual void FrameResized(float newWidth, float newHeight); - virtual void Minimize(bool minimize); - virtual void Zoom(BPoint origin, float width, float height); - void Zoom(); - void SetZoomLimits(float maxWidth, float maxHeight); - virtual void ScreenChanged(BRect screenSize, color_space format); + virtual void DispatchMessage(BMessage* message, + BHandler* handler); + virtual void MessageReceived(BMessage* message); + virtual void FrameMoved(BPoint newPosition); + virtual void WorkspacesChanged(uint32 oldWorkspaces, + uint32 newWorkspaces); + virtual void WorkspaceActivated(int32 workspace, + bool state); + virtual void FrameResized(float newWidth, float newHeight); + virtual void Minimize(bool minimize); + virtual void Zoom(BPoint origin, float width, float height); + void Zoom(); + void SetZoomLimits(float maxWidth, float maxHeight); + virtual void ScreenChanged(BRect screenSize, + color_space format); - void SetPulseRate(bigtime_t rate); - bigtime_t PulseRate() const; + void SetPulseRate(bigtime_t rate); + bigtime_t PulseRate() const; - void AddShortcut(uint32 key, uint32 modifiers, - BMessage* message); - void AddShortcut(uint32 key, uint32 modifiers, - BMessage* message, BHandler* target); - void RemoveShortcut(uint32 key, uint32 modifiers); + void AddShortcut(uint32 key, uint32 modifiers, + BMessage* message); + void AddShortcut(uint32 key, uint32 modifiers, + BMessage* message, BHandler* target); + void RemoveShortcut(uint32 key, uint32 modifiers); - void SetDefaultButton(BButton* button); - BButton* DefaultButton() const; + void SetDefaultButton(BButton* button); + BButton* DefaultButton() const; - virtual void MenusBeginning(); - virtual void MenusEnded(); + virtual void MenusBeginning(); + virtual void MenusEnded(); - bool NeedsUpdate() const; - void UpdateIfNeeded(); + bool NeedsUpdate() const; + void UpdateIfNeeded(); - BView* FindView(const char* viewName) const; - BView* FindView(BPoint) const; - BView* CurrentFocus() const; + BView* FindView(const char* viewName) const; + BView* FindView(BPoint) const; + BView* CurrentFocus() const; - void Activate(bool = true); - virtual void WindowActivated(bool state); + void Activate(bool = true); + virtual void WindowActivated(bool state); - void ConvertToScreen(BPoint* point) const; - BPoint ConvertToScreen(BPoint point) const; - void ConvertFromScreen(BPoint* point) const; - BPoint ConvertFromScreen(BPoint point) const; - void ConvertToScreen(BRect* rect) const; - BRect ConvertToScreen(BRect rect) const; - void ConvertFromScreen(BRect* rect) const; - BRect ConvertFromScreen(BRect rect) const; + void ConvertToScreen(BPoint* point) const; + BPoint ConvertToScreen(BPoint point) const; + void ConvertFromScreen(BPoint* point) const; + BPoint ConvertFromScreen(BPoint point) const; + void ConvertToScreen(BRect* rect) const; + BRect ConvertToScreen(BRect rect) const; + void ConvertFromScreen(BRect* rect) const; + BRect ConvertFromScreen(BRect rect) const; - void MoveBy(float dx, float dy); - void MoveTo(BPoint); - void MoveTo(float x, float y); - void ResizeBy(float dx, float dy); - void ResizeTo(float width, float height); + void MoveBy(float dx, float dy); + void MoveTo(BPoint); + void MoveTo(float x, float y); + void ResizeBy(float dx, float dy); + void ResizeTo(float width, float height); - void CenterIn(const BRect& rect); - void CenterOnScreen(); + void CenterIn(const BRect& rect); + void CenterOnScreen(); - virtual void Show(); - virtual void Hide(); - bool IsHidden() const; - bool IsMinimized() const; + virtual void Show(); + virtual void Hide(); + bool IsHidden() const; + bool IsMinimized() const; - void Flush() const; - void Sync() const; + void Flush() const; + void Sync() const; - status_t SendBehind(const BWindow* window); + status_t SendBehind(const BWindow* window); - void DisableUpdates(); - void EnableUpdates(); + void DisableUpdates(); + void EnableUpdates(); - void BeginViewTransaction(); - // referred as OpenViewTransaction() in BeBook - void EndViewTransaction(); - // referred as CommitViewTransaction() in BeBook + void BeginViewTransaction(); + // referred as OpenViewTransaction() + // in BeBook + void EndViewTransaction(); + // referred as CommitViewTransaction() + // in BeBook - BRect Bounds() const; - BRect Frame() const; - BRect DecoratorFrame() const; - BSize Size() const; - const char* Title() const; - void SetTitle(const char* title); - bool IsFront() const; - bool IsActive() const; + BRect Bounds() const; + BRect Frame() const; + BRect DecoratorFrame() const; + BSize Size() const; + const char* Title() const; + void SetTitle(const char* title); + bool IsFront() const; + bool IsActive() const; - void SetKeyMenuBar(BMenuBar* bar); - BMenuBar* KeyMenuBar() const; + void SetKeyMenuBar(BMenuBar* bar); + BMenuBar* KeyMenuBar() const; - void SetSizeLimits(float minWidth, float maxWidth, - float minHeight, float maxHeight); - void GetSizeLimits(float* minWidth, float* maxWidth, - float* minHeight, float* maxHeight); + void SetSizeLimits(float minWidth, float maxWidth, + float minHeight, float maxHeight); + void GetSizeLimits(float* minWidth, float* maxWidth, + float* minHeight, float* maxHeight); - status_t SetDecoratorSettings(const BMessage& settings); - status_t GetDecoratorSettings(BMessage* settings) const; + status_t SetDecoratorSettings(const BMessage& settings); + status_t GetDecoratorSettings(BMessage* settings) const; - uint32 Workspaces() const; - void SetWorkspaces(uint32); + uint32 Workspaces() const; + void SetWorkspaces(uint32); - BView* LastMouseMovedView() const; + BView* LastMouseMovedView() const; - virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 form, - const char* property); - virtual status_t GetSupportedSuites(BMessage* data); + virtual BHandler* ResolveSpecifier(BMessage* message, + int32 index, BMessage* specifier, + int32 form, const char* property); + virtual status_t GetSupportedSuites(BMessage* data); - status_t AddToSubset(BWindow* window); - status_t RemoveFromSubset(BWindow* window); + status_t AddToSubset(BWindow* window); + status_t RemoveFromSubset(BWindow* window); - virtual status_t Perform(perform_code d, void* arg); + virtual status_t Perform(perform_code code, void* data); - status_t SetType(window_type type); - window_type Type() const; + status_t SetType(window_type type); + window_type Type() const; - status_t SetLook(window_look look); - window_look Look() const; + status_t SetLook(window_look look); + window_look Look() const; - status_t SetFeel(window_feel feel); - window_feel Feel() const; + status_t SetFeel(window_feel feel); + window_feel Feel() const; - status_t SetFlags(uint32); - uint32 Flags() const; + status_t SetFlags(uint32); + uint32 Flags() const; - bool IsModal() const; - bool IsFloating() const; + bool IsModal() const; + bool IsFloating() const; - status_t SetWindowAlignment(window_alignment mode, int32 h, - int32 hOffset = 0, int32 width = 0, - int32 widthOffset = 0, int32 v = 0, - int32 vOffset = 0, int32 height = 0, - int32 heightOffset = 0); - status_t GetWindowAlignment(window_alignment* mode = NULL, - int32* h = NULL, int32* hOffset = NULL, - int32* width = NULL, int32* widthOffset = NULL, - int32* v = NULL, int32* vOffset = NULL, - int32* height = NULL, - int32* heightOffset = NULL) const; + status_t SetWindowAlignment(window_alignment mode, + int32 h, int32 hOffset = 0, + int32 width = 0, int32 widthOffset = 0, + int32 v = 0, int32 vOffset = 0, + int32 height = 0, int32 heightOffset = 0); + status_t GetWindowAlignment( + window_alignment* mode = NULL, + int32* h = NULL, int32* hOffset = NULL, + int32* width = NULL, + int32* widthOffset = NULL, + int32* v = NULL, int32* vOffset = NULL, + int32* height = NULL, + int32* heightOffset = NULL) const; - virtual bool QuitRequested(); - virtual thread_id Run(); + virtual bool QuitRequested(); + virtual thread_id Run(); - virtual void SetLayout(BLayout* layout); - BLayout* GetLayout() const; + virtual void SetLayout(BLayout* layout); + BLayout* GetLayout() const; - void InvalidateLayout(bool descendants = false); + void InvalidateLayout(bool descendants = false); + +private: + // FBC padding and forbidden methods + virtual void _ReservedWindow2(); + virtual void _ReservedWindow3(); + virtual void _ReservedWindow4(); + virtual void _ReservedWindow5(); + virtual void _ReservedWindow6(); + virtual void _ReservedWindow7(); + virtual void _ReservedWindow8(); + + BWindow(); + BWindow(BWindow&); + BWindow& operator=(BWindow&); private: typedef BLooper inherited; @@ -275,118 +293,108 @@ private: friend void _set_menu_sem_(BWindow* w, sem_id sem); friend status_t _safe_get_server_token_(const BLooper*, int32*); - virtual void _ReservedWindow2(); - virtual void _ReservedWindow3(); - virtual void _ReservedWindow4(); - virtual void _ReservedWindow5(); - virtual void _ReservedWindow6(); - virtual void _ReservedWindow7(); - virtual void _ReservedWindow8(); + BWindow(BRect frame, int32 bitmapToken); + void _InitData(BRect frame, const char* title, + window_look look, window_feel feel, + uint32 flags, uint32 workspace, + int32 bitmapToken = -1); - BWindow(); - BWindow(BWindow&); - BWindow& operator=(BWindow&); + virtual void task_looper(); - BWindow(BRect frame, int32 bitmapToken); - void _InitData(BRect frame, const char* title, - window_look look, window_feel feel, - uint32 flags, uint32 workspace, - int32 bitmapToken = -1); + virtual BMessage* ConvertToMessage(void* raw, int32 code); - virtual void task_looper(); + void AddShortcut(uint32 key, uint32 modifiers, + BMenuItem* item); + BHandler* _DetermineTarget(BMessage* message, + BHandler* target); + bool _IsFocusMessage(BMessage* message); + bool _UnpackMessage(unpack_cookie& state, + BMessage** _message, BHandler** _target, + bool* _usePreferred); + void _SanitizeMessage(BMessage* message, + BHandler* target, bool usePreferred); + bool _StealMouseMessage(BMessage* message, + bool& deleteMessage); + uint32 _TransitForMouseMoved(BView* view, + BView* viewUnderMouse) const; - virtual BMessage* ConvertToMessage(void* raw, int32 code); + bool InUpdate(); + void _DequeueAll(); + window_type _ComposeType(window_look look, + window_feel feel) const; + void _DecomposeType(window_type type, + window_look* look, + window_feel* feel) const; - void AddShortcut(uint32 key, uint32 modifiers, - BMenuItem* item); - BHandler* _DetermineTarget(BMessage* message, - BHandler* target); - bool _IsFocusMessage(BMessage* message); - bool _UnpackMessage(unpack_cookie& state, - BMessage** _message, BHandler** _target, - bool* _usePreferred); - void _SanitizeMessage(BMessage* message, - BHandler* target, bool usePreferred); - bool _StealMouseMessage(BMessage* message, - bool& deleteMessage); - uint32 _TransitForMouseMoved(BView* view, - BView* viewUnderMouse) const; + void SetIsFilePanel(bool yes); + bool IsFilePanel() const; - bool InUpdate(); - void _DequeueAll(); - window_type _ComposeType(window_look look, - window_feel feel) const; - void _DecomposeType(window_type type, window_look* look, - window_feel* feel) const; + void _CreateTopView(); + void _AdoptResize(); + void _SetFocus(BView* focusView, + bool notifyIputServer = false); + void _SetName(const char* title); - void SetIsFilePanel(bool yes); - bool IsFilePanel() const; + Shortcut* _FindShortcut(uint32 key, uint32 modifiers); + BView* _FindView(BView* view, BPoint point) const; + BView* _FindView(int32 token); + BView* _LastViewChild(BView* parent); - void _CreateTopView(); - void _AdoptResize(); - void _SetFocus(BView* focusView, - bool notifyIputServer = false); - void _SetName(const char* title); + BView* _FindNextNavigable(BView* focus, uint32 flags); + BView* _FindPreviousNavigable(BView* focus, + uint32 flags); + void _Switcher(int32 rawKey, uint32 modifiers, + bool repeat); + bool _HandleKeyDown(BMessage* event); + bool _HandleUnmappedKeyDown(BMessage* event); + void _KeyboardNavigation(); - Shortcut* _FindShortcut(uint32 key, uint32 modifiers); - BView* _FindView(BView* view, BPoint point) const; - BView* _FindView(int32 token); - BView* _LastViewChild(BView* parent); + void _GetDecoratorSize(float* _borderWidth, + float* _tabHeight) const; - BView* _FindNextNavigable(BView *focus, uint32 flags); - BView* _FindPreviousNavigable(BView *focus, uint32 flags); - void _Switcher(int32 rawKey, uint32 modifiers, - bool repeat); - bool _HandleKeyDown(BMessage* event); - bool _HandleUnmappedKeyDown(BMessage* event); - void _KeyboardNavigation(); - - void _GetDecoratorSize(float* _borderWidth, - float* _tabHeight) const; - - void _CheckSizeLimits(); + void _CheckSizeLimits(); private: - char* fTitle; - int32 _unused0; - bool fInTransaction; - bool fActive; - short fShowLevel; - uint32 fFlags; + char* fTitle; + int32 _unused0; + bool fInTransaction; + bool fActive; + short fShowLevel; + uint32 fFlags; - BView* fTopView; - BView* fFocus; - BView* fLastMouseMovedView; - BMessageRunner* fIdleMouseRunner; - BMenuBar* fKeyMenuBar; - BButton* fDefaultButton; - BList fShortcuts; - int32 fTopViewToken; - bool fUpdateRequested; - bool fOffscreen; - bool fIsFilePanel; - bool _unused4; - bigtime_t fPulseRate; - bool _unused5; - bool fMinimized; - bool fNoQuitShortcut; - bool _unused6; - sem_id fMenuSem; - float fMaxZoomHeight; - float fMaxZoomWidth; - float fMinHeight; - float fMinWidth; - float fMaxHeight; - float fMaxWidth; - BRect fFrame; - window_look fLook; - window_feel fFeel; - int32 fLastViewToken; + BView* fTopView; + BView* fFocus; + BView* fLastMouseMovedView; + BMessageRunner* fIdleMouseRunner; + BMenuBar* fKeyMenuBar; + BButton* fDefaultButton; + BList fShortcuts; + int32 fTopViewToken; + bool fUpdateRequested; + bool fOffscreen; + bool fIsFilePanel; + bool _unused4; + bigtime_t fPulseRate; + bool _unused5; + bool fMinimized; + bool fNoQuitShortcut; + bool _unused6; + sem_id fMenuSem; + float fMaxZoomHeight; + float fMaxZoomWidth; + float fMinHeight; + float fMinWidth; + float fMaxHeight; + float fMaxWidth; + BRect fFrame; + window_look fLook; + window_feel fFeel; + int32 fLastViewToken; BPrivate::PortLink* fLink; - BMessageRunner* fPulseRunner; - BRect fPreviousFrame; + BMessageRunner* fPulseRunner; + BRect fPreviousFrame; - uint32 _reserved[9]; + uint32 _reserved[9]; }; -#endif // _WINDOW_H +#endif // _WINDOW_H diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index 9ffa59fb9f..b1e2fd52eb 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2008, Haiku, Inc. + * Copyright 2001-2009, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT license. * * Authors: @@ -323,6 +323,9 @@ BScrollBar::Archive(BMessage *data, bool deep) const } +// #pragma mark - + + void BScrollBar::AttachedToWindow() { diff --git a/src/kits/interface/ScrollView.cpp b/src/kits/interface/ScrollView.cpp index 39de2a1739..c8c8938eea 100644 --- a/src/kits/interface/ScrollView.cpp +++ b/src/kits/interface/ScrollView.cpp @@ -85,61 +85,11 @@ BScrollView::~BScrollView() } -void -BScrollView::_Init(bool horizontal, bool vertical) -{ - fHorizontalScrollBar = NULL; - fVerticalScrollBar = NULL; - fHighlighted = false; - - if (be_control_look != NULL) - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - - BRect targetFrame; - if (fTarget) { - // layout target and add it - fTarget->TargetedByScrollView(this); - fTarget->MoveTo(B_ORIGIN); - - if (fBorder != B_NO_BORDER) - fTarget->MoveBy(_BorderSize(), _BorderSize()); - - AddChild(fTarget); - targetFrame = fTarget->Frame(); - } else { - // no target specified - targetFrame = Bounds(); - if (horizontal) - targetFrame.bottom -= B_H_SCROLL_BAR_HEIGHT + 1; - if (vertical) - targetFrame.right -= B_V_SCROLL_BAR_WIDTH + 1; - if (fBorder == B_FANCY_BORDER) { - targetFrame.bottom--; - targetFrame.right--; - } - } - - if (horizontal) { - fHorizontalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_HSB_", - fTarget, 0, 1000, B_HORIZONTAL); - AddChild(fHorizontalScrollBar); - } - - if (vertical) { - fVerticalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_VSB_", - fTarget, 0, 1000, B_VERTICAL); - AddChild(fVerticalScrollBar); - } - - _AlignScrollBars(horizontal, vertical, targetFrame); - - fPreviousWidth = uint16(Bounds().Width()); - fPreviousHeight = uint16(Bounds().Height()); -} +// #pragma mark - -BArchivable * -BScrollView::Instantiate(BMessage *archive) +BArchivable* +BScrollView::Instantiate(BMessage* archive) { if (validate_instantiation(archive, "BScrollView")) return new BScrollView(archive); @@ -149,7 +99,7 @@ BScrollView::Instantiate(BMessage *archive) status_t -BScrollView::Archive(BMessage *archive, bool deep) const +BScrollView::Archive(BMessage* archive, bool deep) const { status_t status = BView::Archive(archive, deep); if (status != B_OK) @@ -245,21 +195,24 @@ BScrollView::Draw(BRect updateRect) } if (fBorder == B_PLAIN_BORDER) { - SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT)); + SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), + B_DARKEN_2_TINT)); StrokeRect(Bounds()); return; } else if (fBorder != B_FANCY_BORDER) return; BRect bounds = Bounds(); - SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT)); + SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), + B_DARKEN_2_TINT)); StrokeRect(bounds.InsetByCopy(1, 1)); if (fHighlighted && Window()->IsActive()) { SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR)); StrokeRect(bounds); } else { - SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT)); + SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), + B_DARKEN_1_TINT)); StrokeLine(bounds.LeftBottom(), bounds.LeftTop()); bounds.left++; StrokeLine(bounds.LeftTop(), bounds.RightTop()); @@ -273,7 +226,215 @@ BScrollView::Draw(BRect updateRect) } -BScrollBar * +// #pragma mark - + + +void +BScrollView::WindowActivated(bool active) +{ + if (fHighlighted) + Invalidate(); + + BView::WindowActivated(active); +} + + +void +BScrollView::MakeFocus(bool state) +{ + BView::MakeFocus(state); +} + + +// #pragma mark - + + +void +BScrollView::GetPreferredSize(float *_width, float *_height) +{ + BSize size = PreferredSize(); + + if (_width) + *_width = size.width; + if (_height) + *_height = size.height; +} + + +BSize +BScrollView::MinSize() +{ + BSize size = _ComputeSize(fTarget != NULL ? fTarget->MinSize() + : BSize(16, 16)); + + return BLayoutUtils::ComposeSize(ExplicitMinSize(), size); +} + + +BSize +BScrollView::MaxSize() +{ + BSize size = _ComputeSize(fTarget != NULL ? fTarget->MaxSize() + : BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); + + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size); +} + + +BSize +BScrollView::PreferredSize() +{ + BSize size = _ComputeSize(fTarget != NULL ? fTarget->PreferredSize() + : BSize(32, 32)); + + return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size); +} + + +void +BScrollView::ResizeToPreferred() +{ + if (Window() == NULL) + return; + BView::ResizeToPreferred(); +} + + +void +BScrollView::InvalidateLayout(bool descendants) +{ + BView::InvalidateLayout(descendants); +} + + +void +BScrollView::DoLayout() +{ + if (!(Flags() & B_SUPPORTS_LAYOUT)) + return; + + // If the user set a layout, we let the base class version call its hook. + if (GetLayout()) { + BView::DoLayout(); + return; + } + + BRect innerFrame = _InnerFrame(); + + if (fTarget != NULL) { + fTarget->MoveTo(innerFrame.left, innerFrame.top); + fTarget->ResizeTo(innerFrame.Width(), innerFrame.Height()); + + //BLayoutUtils::AlignInFrame(fTarget, fTarget->Bounds()); + } + + _AlignScrollBars(fHorizontalScrollBar != NULL, fVerticalScrollBar != NULL, + innerFrame); +} + + +void +BScrollView::FrameMoved(BPoint position) +{ + BView::FrameMoved(position); +} + + +void +BScrollView::FrameResized(float width, float height) +{ + BView::FrameResized(width, height); + + if (fBorder == B_NO_BORDER) + return; + + BRect bounds = Bounds(); + float border = _BorderSize() - 1; + + if (be_control_look && fHorizontalScrollBar && fVerticalScrollBar) { + BRect scrollCorner(bounds); + scrollCorner.left = min_c( + fPreviousWidth - fVerticalScrollBar->Frame().Height(), + fHorizontalScrollBar->Frame().right + 1); + scrollCorner.top = min_c( + fPreviousHeight - fHorizontalScrollBar->Frame().Width(), + fVerticalScrollBar->Frame().bottom + 1); + Invalidate(scrollCorner); + } + + // changes in width + + if (bounds.Width() > fPreviousWidth) { + // invalidate the region between the old and the new right border + BRect rect = bounds; + rect.left += fPreviousWidth - border; + rect.right--; + Invalidate(rect); + } else if (bounds.Width() < fPreviousWidth) { + // invalidate the region of the new right border + BRect rect = bounds; + rect.left = rect.right - border; + Invalidate(rect); + } + + // changes in height + + if (bounds.Height() > fPreviousHeight) { + // invalidate the region between the old and the new bottom border + BRect rect = bounds; + rect.top += fPreviousHeight - border; + rect.bottom--; + Invalidate(rect); + } else if (bounds.Height() < fPreviousHeight) { + // invalidate the region of the new bottom border + BRect rect = bounds; + rect.top = rect.bottom - border; + Invalidate(rect); + } + + fPreviousWidth = uint16(bounds.Width()); + fPreviousHeight = uint16(bounds.Height()); +} + + +// #pragma mark - + + +void +BScrollView::MessageReceived(BMessage* message) +{ + switch (message->what) { + default: + BView::MessageReceived(message); + } +} + + +void +BScrollView::MouseDown(BPoint point) +{ + BView::MouseDown(point); +} + + +void +BScrollView::MouseUp(BPoint point) +{ + BView::MouseUp(point); +} + + +void +BScrollView::MouseMoved(BPoint point, uint32 code, const BMessage *dragMessage) +{ + BView::MouseMoved(point, code, dragMessage); +} + + +// #pragma mark - + + +BScrollBar* BScrollView::ScrollBar(orientation posture) const { if (posture == B_HORIZONTAL) @@ -425,126 +586,141 @@ BScrollView::SetTarget(BView *target) } -BView * +BView* BScrollView::Target() const { return fTarget; } -void -BScrollView::MessageReceived(BMessage *message) +// #pragma mark - + + + +BHandler* +BScrollView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, + int32 form, const char* property) { - switch (message->what) { - default: - BView::MessageReceived(message); - } + return BView::ResolveSpecifier(msg, index, specifier, form, property); } -void -BScrollView::MouseDown(BPoint point) +status_t +BScrollView::GetSupportedSuites(BMessage *data) { - BView::MouseDown(point); + return BView::GetSupportedSuites(data); } -void -BScrollView::MouseUp(BPoint point) +status_t +BScrollView::Perform(perform_code code, void* _data) { - BView::MouseUp(point); -} - - -void -BScrollView::MouseMoved(BPoint point, uint32 code, const BMessage *dragMessage) -{ - BView::MouseMoved(point, code, dragMessage); -} - - -void -BScrollView::FrameMoved(BPoint position) -{ - BView::FrameMoved(position); -} - - -void -BScrollView::FrameResized(float width, float height) -{ - BView::FrameResized(width, height); - - if (fBorder == B_NO_BORDER) - return; - - BRect bounds = Bounds(); - float border = _BorderSize() - 1; - - if (be_control_look && fHorizontalScrollBar && fVerticalScrollBar) { - BRect scrollCorner(bounds); - scrollCorner.left = min_c( - fPreviousWidth - fVerticalScrollBar->Frame().Height(), - fHorizontalScrollBar->Frame().right + 1); - scrollCorner.top = min_c( - fPreviousHeight - fHorizontalScrollBar->Frame().Width(), - fVerticalScrollBar->Frame().bottom + 1); - Invalidate(scrollCorner); + 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; + } } - // changes in width - - if (bounds.Width() > fPreviousWidth) { - // invalidate the region between the old and the new right border - BRect rect = bounds; - rect.left += fPreviousWidth - border; - rect.right--; - Invalidate(rect); - } else if (bounds.Width() < fPreviousWidth) { - // invalidate the region of the new right border - BRect rect = bounds; - rect.left = rect.right - border; - Invalidate(rect); - } - - // changes in height - - if (bounds.Height() > fPreviousHeight) { - // invalidate the region between the old and the new bottom border - BRect rect = bounds; - rect.top += fPreviousHeight - border; - rect.bottom--; - Invalidate(rect); - } else if (bounds.Height() < fPreviousHeight) { - // invalidate the region of the new bottom border - BRect rect = bounds; - rect.top = rect.bottom - border; - Invalidate(rect); - } - - fPreviousWidth = uint16(bounds.Width()); - fPreviousHeight = uint16(bounds.Height()); + return BView::Perform(code, _data); } -void -BScrollView::ResizeToPreferred() -{ - if (Window() == NULL) - return; - BView::ResizeToPreferred(); -} +// #pragma mark - void -BScrollView::GetPreferredSize(float *_width, float *_height) +BScrollView::_Init(bool horizontal, bool vertical) { - BSize size = PreferredSize(); + fHorizontalScrollBar = NULL; + fVerticalScrollBar = NULL; + fHighlighted = false; - if (_width) - *_width = size.width; - if (_height) - *_height = size.height; + if (be_control_look != NULL) + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + BRect targetFrame; + if (fTarget) { + // layout target and add it + fTarget->TargetedByScrollView(this); + fTarget->MoveTo(B_ORIGIN); + + if (fBorder != B_NO_BORDER) + fTarget->MoveBy(_BorderSize(), _BorderSize()); + + AddChild(fTarget); + targetFrame = fTarget->Frame(); + } else { + // no target specified + targetFrame = Bounds(); + if (horizontal) + targetFrame.bottom -= B_H_SCROLL_BAR_HEIGHT + 1; + if (vertical) + targetFrame.right -= B_V_SCROLL_BAR_WIDTH + 1; + if (fBorder == B_FANCY_BORDER) { + targetFrame.bottom--; + targetFrame.right--; + } + } + + if (horizontal) { + fHorizontalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_HSB_", + fTarget, 0, 1000, B_HORIZONTAL); + AddChild(fHorizontalScrollBar); + } + + if (vertical) { + fVerticalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_VSB_", + fTarget, 0, 1000, B_VERTICAL); + AddChild(fVerticalScrollBar); + } + + _AlignScrollBars(horizontal, vertical, targetFrame); + + fPreviousWidth = uint16(Bounds().Width()); + fPreviousHeight = uint16(Bounds().Height()); } @@ -671,8 +847,8 @@ BScrollView::_ComputeFrame(BRect frame, bool horizontal, bool vertical, BScrollView::_ComputeFrame(BView *target, bool horizontal, bool vertical, border_style border) { - return _ComputeFrame(target != NULL ? target->Frame() : BRect(0, 0, 16, 16), - horizontal, vertical, border); + return _ComputeFrame(target != NULL ? target->Frame() + : BRect(0, 0, 16, 16), horizontal, vertical, border); } @@ -705,155 +881,7 @@ BScrollView::_ModifyFlags(int32 flags, border_style border) } -void -BScrollView::WindowActivated(bool active) -{ - if (fHighlighted) - Invalidate(); - - BView::WindowActivated(active); -} - - -void -BScrollView::MakeFocus(bool state) -{ - BView::MakeFocus(state); -} - - -BHandler* -BScrollView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, - int32 form, const char* property) -{ - return BView::ResolveSpecifier(msg, index, specifier, form, property); -} - - -status_t -BScrollView::GetSupportedSuites(BMessage *data) -{ - return BView::GetSupportedSuites(data); -} - - -BSize -BScrollView::MinSize() -{ - BSize size = _ComputeSize(fTarget != NULL ? fTarget->MinSize() - : BSize(16, 16)); - - return BLayoutUtils::ComposeSize(ExplicitMinSize(), size); -} - - -BSize -BScrollView::MaxSize() -{ - BSize size = _ComputeSize(fTarget != NULL ? fTarget->MaxSize() - : BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); - - return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size); -} - - -BSize -BScrollView::PreferredSize() -{ - BSize size = _ComputeSize(fTarget != NULL ? fTarget->PreferredSize() - : BSize(32, 32)); - - return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size); -} - - -void -BScrollView::InvalidateLayout(bool descendants) -{ - BView::InvalidateLayout(descendants); -} - - -void -BScrollView::DoLayout() -{ - if (!(Flags() & B_SUPPORTS_LAYOUT)) - return; - - // If the user set a layout, we let the base class version call its hook. - if (GetLayout()) { - BView::DoLayout(); - return; - } - - BRect innerFrame = _InnerFrame(); - - if (fTarget != NULL) { - fTarget->MoveTo(innerFrame.left, innerFrame.top); - fTarget->ResizeTo(innerFrame.Width(), innerFrame.Height()); - - //BLayoutUtils::AlignInFrame(fTarget, fTarget->Bounds()); - } - - _AlignScrollBars(fHorizontalScrollBar != NULL, fVerticalScrollBar != NULL, - innerFrame); -} - - -status_t -BScrollView::Perform(perform_code code, void* _data) -{ - 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); -} +// #pragma mark - BScrollView & @@ -863,22 +891,6 @@ BScrollView::operator=(const BScrollView &) } -/** Although BScrollView::InitObject() was defined in the original ScrollView.h, - * it is not exported by the R5 libbe.so, so we don't have to export it as well. - */ - -#if 0 -void -BScrollView::InitObject() -{ -} -#endif - - -// #pragma mark - -// Reserved virtuals - - void BScrollView::_ReservedScrollView1() {} void BScrollView::_ReservedScrollView2() {} void BScrollView::_ReservedScrollView3() {} diff --git a/src/kits/interface/StatusBar.cpp b/src/kits/interface/StatusBar.cpp index 7ac44160bb..f699118122 100644 --- a/src/kits/interface/StatusBar.cpp +++ b/src/kits/interface/StatusBar.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2008, Haiku. All Rights Reserved. + * Copyright 2001-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -28,8 +28,9 @@ static const rgb_color kDefaultBarColor = {50, 150, 255, 255}; BStatusBar::BStatusBar(BRect frame, const char *name, const char *label, - const char *trailingLabel) - : BView(frame, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW), + const char *trailingLabel) + : + BView(frame, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW), fLabel(label), fTrailingLabel(trailingLabel) { @@ -38,9 +39,10 @@ BStatusBar::BStatusBar(BRect frame, const char *name, const char *label, BStatusBar::BStatusBar(const char *name, const char *label, - const char *trailingLabel) - : BView(BRect(0, 0, -1, -1), name, B_FOLLOW_LEFT | B_FOLLOW_TOP, - B_WILL_DRAW | B_SUPPORTS_LAYOUT), + const char *trailingLabel) + : + BView(BRect(0, 0, -1, -1), name, B_FOLLOW_LEFT | B_FOLLOW_TOP, + B_WILL_DRAW | B_SUPPORTS_LAYOUT), fLabel(label), fTrailingLabel(trailingLabel) { @@ -49,7 +51,8 @@ BStatusBar::BStatusBar(const char *name, const char *label, BStatusBar::BStatusBar(BMessage *archive) - : BView(archive) + : + BView(archive) { _InitObject(); @@ -81,22 +84,6 @@ BStatusBar::~BStatusBar() } -void -BStatusBar::_InitObject() -{ - fMax = 100.0; - fCurrent = 0.0; - - fBarHeight = -1.0; - fTextDivider = Bounds().Width(); - - fBarColor = kDefaultBarColor; - fCustomBarHeight = false; - - SetFlags(Flags() | B_FRAME_EVENTS); -} - - BArchivable * BStatusBar::Instantiate(BMessage *archive) { @@ -139,6 +126,9 @@ BStatusBar::Archive(BMessage *archive, bool deep) const } +// #pragma mark - + + void BStatusBar::AttachedToWindow() { @@ -164,42 +154,124 @@ BStatusBar::AttachedToWindow() void -BStatusBar::MessageReceived(BMessage *message) +BStatusBar::DetachedFromWindow() { - switch(message->what) { - case B_UPDATE_STATUS_BAR: - { - float delta; - const char *text = NULL, *trailing_text = NULL; + BView::DetachedFromWindow(); +} - message->FindFloat("delta", &delta); - message->FindString("text", &text); - message->FindString("trailing_text", &trailing_text); - Update(delta, text, trailing_text); +void +BStatusBar::AllAttached() +{ + BView::AllAttached(); +} - break; - } - case B_RESET_STATUS_BAR: - { - const char *label = NULL, *trailing_label = NULL; +void +BStatusBar::AllDetached() +{ + BView::AllDetached(); +} - message->FindString("label", &label); - message->FindString("trailing_label", &trailing_label); - Reset(label, trailing_label); +// #pragma mark - - break; - } - default: - BView::MessageReceived(message); - break; +void +BStatusBar::WindowActivated(bool state) +{ + BView::WindowActivated(state); +} + + +void +BStatusBar::MakeFocus(bool state) +{ + BView::MakeFocus(state); +} + + +// #pragma mark - + + +void +BStatusBar::GetPreferredSize(float* _width, float* _height) +{ + if (_width) { + // AttachedToWindow() might not have been called yet + *_width = ceilf(StringWidth(fLabel.String())) + + ceilf(StringWidth(fTrailingLabel.String())) + + ceilf(StringWidth(fText.String())) + + ceilf(StringWidth(fTrailingText.String())) + + 5; + } + + if (_height) { + font_height fontHeight; + GetFontHeight(&fontHeight); + + *_height = ceilf(fontHeight.ascent + fontHeight.descent) + 6 + + BarHeight(); } } +BSize +BStatusBar::MinSize() +{ + float width, height; + GetPreferredSize(&width, &height); + + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height)); +} + + +BSize +BStatusBar::MaxSize() +{ + float width, height; + GetPreferredSize(&width, &height); + + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), + BSize(B_SIZE_UNLIMITED, height)); +} + + +BSize +BStatusBar::PreferredSize() +{ + float width, height; + GetPreferredSize(&width, &height); + + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height)); +} + + +void +BStatusBar::ResizeToPreferred() +{ + BView::ResizeToPreferred(); +} + + +void +BStatusBar::FrameMoved(BPoint newPosition) +{ + BView::FrameMoved(newPosition); +} + + +void +BStatusBar::FrameResized(float newWidth, float newHeight) +{ + BView::FrameResized(newWidth, newHeight); + Invalidate(); +} + + +// #pragma mark - + + void BStatusBar::Draw(BRect updateRect) { @@ -321,6 +393,67 @@ BStatusBar::Draw(BRect updateRect) } +void +BStatusBar::MessageReceived(BMessage *message) +{ + switch(message->what) { + case B_UPDATE_STATUS_BAR: + { + float delta; + const char *text = NULL, *trailing_text = NULL; + + message->FindFloat("delta", &delta); + message->FindString("text", &text); + message->FindString("trailing_text", &trailing_text); + + Update(delta, text, trailing_text); + + break; + } + + case B_RESET_STATUS_BAR: + { + const char *label = NULL, *trailing_label = NULL; + + message->FindString("label", &label); + message->FindString("trailing_label", &trailing_label); + + Reset(label, trailing_label); + + break; + } + + default: + BView::MessageReceived(message); + break; + } +} + + +void +BStatusBar::MouseDown(BPoint point) +{ + BView::MouseDown(point); +} + + +void +BStatusBar::MouseUp(BPoint point) +{ + BView::MouseUp(point); +} + + +void +BStatusBar::MouseMoved(BPoint point, uint32 transit, const BMessage *message) +{ + BView::MouseMoved(point, transit, message); +} + + +// #pragma mark - + + void BStatusBar::SetBarColor(rgb_color color) { @@ -385,6 +518,26 @@ BStatusBar::Update(float delta, const char* text, const char* trailingText) } +void +BStatusBar::Reset(const char *label, const char *trailingLabel) +{ + // Reset replaces the label and trailing label with copies of the + // strings passed as arguments. If either argument is NULL, the + // label or trailing label will be deleted and erased. + fLabel = label ? label : ""; + fTrailingLabel = trailingLabel ? trailingLabel : ""; + + // Reset deletes and erases any text or trailing text + fText = ""; + fTrailingText = ""; + + fCurrent = 0; + fMax = 100; + + Invalidate(); +} + + void BStatusBar::SetTo(float value, const char* text, const char* trailingText) { @@ -425,26 +578,6 @@ BStatusBar::SetTo(float value, const char* text, const char* trailingText) } -void -BStatusBar::Reset(const char *label, const char *trailingLabel) -{ - // Reset replaces the label and trailing label with copies of the - // strings passed as arguments. If either argument is NULL, the - // label or trailing label will be deleted and erased. - fLabel = label ? label : ""; - fTrailingLabel = trailingLabel ? trailingLabel : ""; - - // Reset deletes and erases any text or trailing text - fText = ""; - fTrailingText = ""; - - fCurrent = 0; - fMax = 100; - - Invalidate(); -} - - float BStatusBar::CurrentValue() const { @@ -509,54 +642,7 @@ BStatusBar::TrailingLabel() const } -void -BStatusBar::MouseDown(BPoint point) -{ - BView::MouseDown(point); -} - - -void -BStatusBar::MouseUp(BPoint point) -{ - BView::MouseUp(point); -} - - -void -BStatusBar::WindowActivated(bool state) -{ - BView::WindowActivated(state); -} - - -void -BStatusBar::MouseMoved(BPoint point, uint32 transit, const BMessage *message) -{ - BView::MouseMoved(point, transit, message); -} - - -void -BStatusBar::DetachedFromWindow() -{ - BView::DetachedFromWindow(); -} - - -void -BStatusBar::FrameMoved(BPoint newPosition) -{ - BView::FrameMoved(newPosition); -} - - -void -BStatusBar::FrameResized(float newWidth, float newHeight) -{ - BView::FrameResized(newWidth, newHeight); - Invalidate(); -} +// #pragma mark - BHandler * @@ -567,56 +653,6 @@ BStatusBar::ResolveSpecifier(BMessage* message, int32 index, } -void -BStatusBar::ResizeToPreferred() -{ - BView::ResizeToPreferred(); -} - - -void -BStatusBar::GetPreferredSize(float* _width, float* _height) -{ - if (_width) { - // AttachedToWindow() might not have been called yet - *_width = ceilf(StringWidth(fLabel.String())) - + ceilf(StringWidth(fTrailingLabel.String())) - + ceilf(StringWidth(fText.String())) - + ceilf(StringWidth(fTrailingText.String())) - + 5; - } - - if (_height) { - font_height fontHeight; - GetFontHeight(&fontHeight); - - *_height = ceilf(fontHeight.ascent + fontHeight.descent) + 6 - + BarHeight(); - } -} - - -void -BStatusBar::MakeFocus(bool state) -{ - BView::MakeFocus(state); -} - - -void -BStatusBar::AllAttached() -{ - BView::AllAttached(); -} - - -void -BStatusBar::AllDetached() -{ - BView::AllDetached(); -} - - status_t BStatusBar::GetSupportedSuites(BMessage* data) { @@ -624,37 +660,6 @@ BStatusBar::GetSupportedSuites(BMessage* data) } -BSize -BStatusBar::MinSize() -{ - float width, height; - GetPreferredSize(&width, &height); - - return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height)); -} - - -BSize -BStatusBar::MaxSize() -{ - float width, height; - GetPreferredSize(&width, &height); - - return BLayoutUtils::ComposeSize(ExplicitMaxSize(), - BSize(B_SIZE_UNLIMITED, height)); -} - - -BSize -BStatusBar::PreferredSize() -{ - float width, height; - GetPreferredSize(&width, &height); - - return BLayoutUtils::ComposeSize(ExplicitMaxSize(), BSize(width, height)); -} - - status_t BStatusBar::Perform(perform_code code, void* _data) { @@ -686,7 +691,7 @@ BStatusBar::Perform(perform_code code, void* _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; @@ -711,6 +716,9 @@ BStatusBar::Perform(perform_code code, void* _data) } +// #pragma mark - + + extern "C" void _ReservedStatusBar1__10BStatusBar(BStatusBar* self, float value, const char* text, const char* trailingText) @@ -731,6 +739,25 @@ BStatusBar::operator=(const BStatusBar& other) } +// #pragma mark - + + +void +BStatusBar::_InitObject() +{ + fMax = 100.0; + fCurrent = 0.0; + + fBarHeight = -1.0; + fTextDivider = Bounds().Width(); + + fBarColor = kDefaultBarColor; + fCustomBarHeight = false; + + SetFlags(Flags() | B_FRAME_EVENTS); +} + + void BStatusBar::_SetTextData(BString& text, const char* source, const BString& combineWith, bool rightAligned) diff --git a/src/kits/interface/StringView.cpp b/src/kits/interface/StringView.cpp index 5822754204..1f8b629f45 100644 --- a/src/kits/interface/StringView.cpp +++ b/src/kits/interface/StringView.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2008, Haiku Inc. All rights reserved. + * Copyright 2001-2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -64,6 +64,12 @@ BStringView::BStringView(BMessage* data) } +BStringView::~BStringView() +{ + free(fText); +} + + BArchivable* BStringView::Instantiate(BMessage* data) { @@ -89,12 +95,199 @@ BStringView::Archive(BMessage* data, bool deep) const } -BStringView::~BStringView() +// #pragma mark - + + +void +BStringView::AttachedToWindow() { - free(fText); + rgb_color color = B_TRANSPARENT_COLOR; + + BView* parent = Parent(); + if (parent != NULL) + color = parent->ViewColor(); + + if (color == B_TRANSPARENT_COLOR) + color = ui_color(B_PANEL_BACKGROUND_COLOR); + + SetViewColor(color); } +void +BStringView::DetachedFromWindow() +{ + BView::DetachedFromWindow(); +} + + +void +BStringView::AllAttached() +{ + BView::AllAttached(); +} + + +void +BStringView::AllDetached() +{ + BView::AllDetached(); +} + + +// #pragma mark - + + +void +BStringView::MakeFocus(bool state) +{ + BView::MakeFocus(state); +} + + +void +BStringView::GetPreferredSize(float* _width, float* _height) +{ + _ValidatePreferredSize(); + + if (_width) + *_width = fPreferredSize.width; + + if (_height) + *_height = fPreferredSize.height; +} + + +BSize +BStringView::MinSize() +{ + return BLayoutUtils::ComposeSize(ExplicitMinSize(), + _ValidatePreferredSize()); +} + + +BSize +BStringView::MaxSize() +{ + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), + _ValidatePreferredSize()); +} + + +BSize +BStringView::PreferredSize() +{ + return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), + _ValidatePreferredSize()); +} + + +void +BStringView::InvalidateLayout(bool descendants) +{ + // invalidate cached preferred size + fPreferredSize.Set(-1, -1); + + BView::InvalidateLayout(descendants); +} + + +void +BStringView::ResizeToPreferred() +{ + float width, height; + GetPreferredSize(&width, &height); + + // Resize the width only for B_ALIGN_LEFT (if its large enough already, that is) + if (Bounds().Width() > width && Alignment() != B_ALIGN_LEFT) + width = Bounds().Width(); + + BView::ResizeTo(width, height); +} + + +void +BStringView::FrameMoved(BPoint newPosition) +{ + BView::FrameMoved(newPosition); +} + + +void +BStringView::FrameResized(float newWidth, float newHeight) +{ + BView::FrameResized(newWidth, newHeight); +} + + +// #pragma mark - + + +void +BStringView::Draw(BRect updateRect) +{ + if (!fText) + return; + + SetLowColor(ViewColor()); + + font_height fontHeight; + GetFontHeight(&fontHeight); + + BRect bounds = Bounds(); + + float y = (bounds.top + bounds.bottom - ceilf(fontHeight.ascent) + - ceilf(fontHeight.descent)) / 2.0 + ceilf(fontHeight.ascent); + float x; + switch (fAlign) { + case B_ALIGN_RIGHT: + x = bounds.Width() - StringWidth(fText); + break; + + case B_ALIGN_CENTER: + x = (bounds.Width() - StringWidth(fText)) / 2.0; + break; + + default: + x = 0.0; + break; + } + + DrawString(fText, BPoint(x, y)); +} + + +void +BStringView::MessageReceived(BMessage* message) +{ + BView::MessageReceived(message); +} + + +void +BStringView::MouseDown(BPoint point) +{ + BView::MouseDown(point); +} + + +void +BStringView::MouseUp(BPoint point) +{ + BView::MouseUp(point); +} + + +void +BStringView::MouseMoved(BPoint point, uint32 transit, const BMessage* msg) +{ + BView::MouseMoved(point, transit, msg); +} + + +// #pragma mark - + + void BStringView::SetText(const char* text) { @@ -131,132 +324,6 @@ BStringView::Alignment() const } -void -BStringView::AttachedToWindow() -{ - rgb_color color = B_TRANSPARENT_COLOR; - - BView* parent = Parent(); - if (parent != NULL) - color = parent->ViewColor(); - - if (color == B_TRANSPARENT_COLOR) - color = ui_color(B_PANEL_BACKGROUND_COLOR); - - SetViewColor(color); -} - - -void -BStringView::Draw(BRect updateRect) -{ - if (!fText) - return; - - SetLowColor(ViewColor()); - - font_height fontHeight; - GetFontHeight(&fontHeight); - - BRect bounds = Bounds(); - - float y = (bounds.top + bounds.bottom - ceilf(fontHeight.ascent) - - ceilf(fontHeight.descent)) / 2.0 + ceilf(fontHeight.ascent); - float x; - switch (fAlign) { - case B_ALIGN_RIGHT: - x = bounds.Width() - StringWidth(fText); - break; - - case B_ALIGN_CENTER: - x = (bounds.Width() - StringWidth(fText)) / 2.0; - break; - - default: - x = 0.0; - break; - } - - DrawString(fText, BPoint(x, y)); -} - - -void -BStringView::ResizeToPreferred() -{ - float width, height; - GetPreferredSize(&width, &height); - - // Resize the width only for B_ALIGN_LEFT (if its large enough already, that is) - if (Bounds().Width() > width && Alignment() != B_ALIGN_LEFT) - width = Bounds().Width(); - - BView::ResizeTo(width, height); -} - - -void -BStringView::GetPreferredSize(float* _width, float* _height) -{ - _ValidatePreferredSize(); - - if (_width) - *_width = fPreferredSize.width; - - if (_height) - *_height = fPreferredSize.height; -} - - -void -BStringView::MessageReceived(BMessage* message) -{ - BView::MessageReceived(message); -} - - -void -BStringView::MouseDown(BPoint point) -{ - BView::MouseDown(point); -} - - -void -BStringView::MouseUp(BPoint point) -{ - BView::MouseUp(point); -} - - -void -BStringView::MouseMoved(BPoint point, uint32 transit, const BMessage* msg) -{ - BView::MouseMoved(point, transit, msg); -} - - -void -BStringView::DetachedFromWindow() -{ - BView::DetachedFromWindow(); -} - - -void -BStringView::FrameMoved(BPoint newPosition) -{ - BView::FrameMoved(newPosition); -} - - -void -BStringView::FrameResized(float newWidth, float newHeight) -{ - BView::FrameResized(newWidth, newHeight); -} - - BHandler* BStringView::ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, int32 form, const char* property) @@ -265,27 +332,6 @@ BStringView::ResolveSpecifier(BMessage* msg, int32 index, } -void -BStringView::MakeFocus(bool state) -{ - BView::MakeFocus(state); -} - - -void -BStringView::AllAttached() -{ - BView::AllAttached(); -} - - -void -BStringView::AllDetached() -{ - BView::AllDetached(); -} - - status_t BStringView::GetSupportedSuites(BMessage* message) { @@ -303,38 +349,7 @@ BStringView::SetFont(const BFont* font, uint32 mask) } -void -BStringView::InvalidateLayout(bool descendants) -{ - // invalidate cached preferred size - fPreferredSize.Set(-1, -1); - - BView::InvalidateLayout(descendants); -} - - -BSize -BStringView::MinSize() -{ - return BLayoutUtils::ComposeSize(ExplicitMinSize(), - _ValidatePreferredSize()); -} - - -BSize -BStringView::MaxSize() -{ - return BLayoutUtils::ComposeSize(ExplicitMaxSize(), - _ValidatePreferredSize()); -} - - -BSize -BStringView::PreferredSize() -{ - return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), - _ValidatePreferredSize()); -} +// #pragma mark - status_t @@ -406,6 +421,10 @@ BStringView::operator=(const BStringView&) return *this; } + +// #pragma mark - + + BSize BStringView::_ValidatePreferredSize() { diff --git a/src/kits/interface/TabView.cpp b/src/kits/interface/TabView.cpp index 2cc8784a31..d75db0b336 100644 --- a/src/kits/interface/TabView.cpp +++ b/src/kits/interface/TabView.cpp @@ -1,6 +1,6 @@ /* * Copyright 2001-2009, Haiku, Inc. All rights reserved. - * Distributed under the terms of the MIT license. + * Distributed under the terms of the MIT License. * * Authors: * Marc Flerackers (mflerackers@androme.be) @@ -382,7 +382,7 @@ BTab &BTab::operator=(const BTab &) } -// #pragma mark - +// #pragma mark - BTabView BTabView::BTabView(const char *name, button_width width, uint32 flags) @@ -523,16 +523,6 @@ BTabView::Perform(perform_code d, void *arg) } -void -BTabView::WindowActivated(bool active) -{ - BView::WindowActivated(active); - - if (IsFocus()) - Invalidate(); -} - - void BTabView::AttachedToWindow() { @@ -542,6 +532,13 @@ BTabView::AttachedToWindow() } +void +BTabView::DetachedFromWindow() +{ + BView::DetachedFromWindow(); +} + + void BTabView::AllAttached() { @@ -556,11 +553,7 @@ BTabView::AllDetached() } -void -BTabView::DetachedFromWindow() -{ - BView::DetachedFromWindow(); -} +// #pragma mark - void @@ -635,20 +628,6 @@ BTabView::MessageReceived(BMessage *message) } -void -BTabView::FrameMoved(BPoint newLocation) -{ - BView::FrameMoved(newLocation); -} - - -void -BTabView::FrameResized(float width,float height) -{ - BView::FrameResized(width, height); -} - - void BTabView::KeyDown(const char *bytes, int32 numBytes) { @@ -773,6 +752,16 @@ BTabView::Selection() const } +void +BTabView::WindowActivated(bool active) +{ + BView::WindowActivated(active); + + if (IsFocus()) + Invalidate(); +} + + void BTabView::MakeFocus(bool focused) { @@ -1060,6 +1049,16 @@ BTabView::SetResizingMode(uint32 mode) } +// #pragma mark - + + +void +BTabView::ResizeToPreferred() +{ + BView::ResizeToPreferred(); +} + + void BTabView::GetPreferredSize(float *width, float *height) { @@ -1104,12 +1103,22 @@ BTabView::PreferredSize() void -BTabView::ResizeToPreferred() +BTabView::FrameMoved(BPoint newLocation) { - BView::ResizeToPreferred(); + BView::FrameMoved(newLocation); } +void +BTabView::FrameResized(float width,float height) +{ + BView::FrameResized(width, height); +} + + +// #pragma mark - + + BHandler * BTabView::ResolveSpecifier(BMessage *message, int32 index, BMessage *specifier, int32 what, const char *property) @@ -1136,6 +1145,9 @@ BTabView::GetSupportedSuites(BMessage *message) } +// #pragma mark - + + void BTabView::AddTab(BView *target, BTab *tab) {