haiku/headers/os/interface/Box.h
Axel Dörfler f17cfabc82 * Fixed BBox resizing when not attached.
* Less flickering when drawing the label: the area of the label is now
  clipped, so there is no need to fill the background again.
* Consumed the last reserved member for the bounding box of the label.
* More or less rewrote the header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15747 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-12-30 18:23:48 +00:00

79 lines
2.2 KiB
C++

/*
* Copyright 2005, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _BOX_H
#define _BOX_H
#include <View.h>
class BBox : public BView {
public:
BBox(BRect frame, const char *name = NULL,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
| B_NAVIGABLE_JUMP,
border_style border = B_FANCY_BORDER);
virtual ~BBox();
/* Archiving */
BBox(BMessage* archive);
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive, bool deep = true) const;
virtual void SetBorder(border_style border);
border_style Border() const;
void SetLabel(const char* string);
status_t SetLabel(BView* viewLabel);
const char* Label() const;
BView* LabelView() const;
virtual void Draw(BRect updateRect);
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void AllAttached();
virtual void AllDetached();
virtual void FrameResized(float width, float height);
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void WindowActivated(bool active);
virtual void MouseMoved(BPoint point, uint32 transit,
const BMessage* dragMessage);
virtual void FrameMoved(BPoint newLocation);
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 focused = true);
virtual status_t GetSupportedSuites(BMessage* message);
virtual status_t Perform(perform_code d, void* arg);
private:
virtual void _ReservedBox1();
virtual void _ReservedBox2();
BBox &operator=(const BBox &);
void _InitObject(BMessage* data = NULL);
void _DrawPlain(BRect labelBox);
void _DrawFancy(BRect labelBox);
void _ClearLabel();
char* fLabel;
BRect fBounds;
border_style fStyle;
BView* fLabelView;
BRect* fLabelBox;
};
#endif // _BOX_H