2005-12-30 21:23:48 +03:00
|
|
|
/*
|
2006-02-10 20:07:38 +03:00
|
|
|
* Copyright 2005-2006, Haiku, Inc. All Rights Reserved.
|
2005-12-30 21:23:48 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _BOX_H
|
|
|
|
#define _BOX_H
|
2005-12-30 21:23:48 +03:00
|
|
|
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <View.h>
|
2005-12-30 21:23:48 +03:00
|
|
|
|
|
|
|
|
|
|
|
class BBox : public BView {
|
|
|
|
public:
|
|
|
|
BBox(BRect frame, const char *name = NULL,
|
2007-06-09 03:40:16 +04:00
|
|
|
uint32 resizingMode = B_FOLLOW_LEFT
|
|
|
|
| B_FOLLOW_TOP,
|
2005-12-30 21:23:48 +03:00
|
|
|
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
|
|
|
|
| B_NAVIGABLE_JUMP,
|
|
|
|
border_style border = B_FANCY_BORDER);
|
2007-06-09 03:40:16 +04:00
|
|
|
BBox(const char* name,
|
|
|
|
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS
|
|
|
|
| B_NAVIGABLE_JUMP,
|
|
|
|
border_style border = B_FANCY_BORDER,
|
|
|
|
BView* child = NULL);
|
|
|
|
BBox(border_style border, BView* child);
|
2005-12-30 21:23:48 +03:00
|
|
|
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;
|
|
|
|
|
2006-02-10 20:07:38 +03:00
|
|
|
float TopBorderOffset();
|
|
|
|
BRect InnerFrame();
|
|
|
|
|
2005-12-30 21:23:48 +03:00
|
|
|
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);
|
|
|
|
|
2007-06-09 03:40:16 +04:00
|
|
|
virtual BSize MinSize();
|
|
|
|
virtual BSize MaxSize();
|
|
|
|
virtual BSize PreferredSize();
|
|
|
|
|
2011-10-21 05:18:22 +04:00
|
|
|
protected:
|
|
|
|
virtual void LayoutInvalidated(bool descendants = false);
|
2007-06-09 03:40:16 +04:00
|
|
|
virtual void DoLayout();
|
|
|
|
|
2005-12-30 21:23:48 +03:00
|
|
|
private:
|
2007-06-09 03:40:16 +04:00
|
|
|
struct LayoutData;
|
|
|
|
|
2005-12-30 21:23:48 +03:00
|
|
|
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();
|
|
|
|
|
2007-06-09 03:40:16 +04:00
|
|
|
BView* _Child() const;
|
|
|
|
void _ValidateLayoutData();
|
|
|
|
|
2005-12-30 21:23:48 +03:00
|
|
|
char* fLabel;
|
|
|
|
BRect fBounds;
|
|
|
|
border_style fStyle;
|
|
|
|
BView* fLabelView;
|
2007-06-09 03:40:16 +04:00
|
|
|
LayoutData* fLayoutData;
|
2005-12-30 21:23:48 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _BOX_H
|