2009-06-21 17:04:51 +04:00
|
|
|
/*
|
2014-12-20 03:43:26 +03:00
|
|
|
* Copyright 2001-2009 Haiku, Inc. All rights reserved.
|
2009-08-27 15:12:41 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
2009-06-21 17:04:51 +04:00
|
|
|
*/
|
2002-09-26 18:53:19 +04:00
|
|
|
#ifndef _TAB_VIEW_H
|
|
|
|
#define _TAB_VIEW_H
|
2007-09-27 11:55:16 +04:00
|
|
|
|
|
|
|
|
|
|
|
#include <View.h>
|
|
|
|
|
|
|
|
|
2015-07-14 04:28:20 +03:00
|
|
|
class BTabView;
|
|
|
|
|
|
|
|
|
2007-09-27 11:55:16 +04:00
|
|
|
enum tab_position {
|
|
|
|
B_TAB_FIRST = 999,
|
|
|
|
B_TAB_FRONT,
|
|
|
|
B_TAB_ANY
|
2002-09-26 18:53:19 +04:00
|
|
|
};
|
2007-09-27 11:55:16 +04:00
|
|
|
|
|
|
|
|
|
|
|
class BTab : public BArchivable {
|
|
|
|
public:
|
2009-06-21 17:04:51 +04:00
|
|
|
BTab(BView* tabView = NULL);
|
|
|
|
virtual ~BTab();
|
2007-09-27 11:55:16 +04:00
|
|
|
|
2009-06-21 17:04:51 +04:00
|
|
|
BTab(BMessage* archive);
|
|
|
|
static BArchivable* Instantiate(BMessage* archive);
|
2007-09-27 11:55:16 +04:00
|
|
|
|
2014-12-20 03:43:26 +03:00
|
|
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
2009-06-21 17:04:51 +04:00
|
|
|
virtual status_t Perform(uint32 d, void* arg);
|
2007-09-27 11:55:16 +04:00
|
|
|
|
2009-06-21 17:04:51 +04:00
|
|
|
const char* Label() const;
|
|
|
|
virtual void SetLabel(const char* label);
|
2007-09-27 11:55:16 +04:00
|
|
|
|
2009-06-21 17:04:51 +04:00
|
|
|
bool IsSelected() const;
|
|
|
|
virtual void Select(BView* owner);
|
|
|
|
virtual void Deselect();
|
2007-09-27 11:55:16 +04:00
|
|
|
|
2014-12-20 03:43:26 +03:00
|
|
|
virtual void SetEnabled(bool enable);
|
2009-06-21 17:04:51 +04:00
|
|
|
bool IsEnabled() const;
|
2007-09-27 11:55:16 +04:00
|
|
|
|
2014-12-20 03:43:26 +03:00
|
|
|
void MakeFocus(bool focus = true);
|
2009-06-21 17:04:51 +04:00
|
|
|
bool IsFocus() const;
|
2007-09-27 11:55:16 +04:00
|
|
|
|
2009-06-21 17:04:51 +04:00
|
|
|
// sets/gets the view to be displayed for this tab
|
|
|
|
virtual void SetView(BView* view);
|
|
|
|
BView* View() const;
|
2007-09-27 11:55:16 +04:00
|
|
|
|
2009-06-21 17:04:51 +04:00
|
|
|
virtual void DrawFocusMark(BView* owner, BRect frame);
|
|
|
|
virtual void DrawLabel(BView* owner, BRect frame);
|
|
|
|
virtual void DrawTab(BView* owner, BRect frame,
|
|
|
|
tab_position position, bool full = true);
|
2007-09-27 11:55:16 +04:00
|
|
|
|
|
|
|
private:
|
2009-08-27 15:12:41 +04:00
|
|
|
// FBC padding and forbidden methods
|
2009-06-21 17:04:51 +04:00
|
|
|
virtual void _ReservedTab1();
|
|
|
|
virtual void _ReservedTab2();
|
|
|
|
virtual void _ReservedTab3();
|
|
|
|
virtual void _ReservedTab4();
|
|
|
|
virtual void _ReservedTab5();
|
|
|
|
virtual void _ReservedTab6();
|
|
|
|
virtual void _ReservedTab7();
|
|
|
|
virtual void _ReservedTab8();
|
|
|
|
virtual void _ReservedTab9();
|
|
|
|
virtual void _ReservedTab10();
|
|
|
|
virtual void _ReservedTab11();
|
|
|
|
virtual void _ReservedTab12();
|
|
|
|
|
|
|
|
BTab& operator=(const BTab&);
|
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
private:
|
2015-07-14 04:28:20 +03:00
|
|
|
friend class BTabView;
|
|
|
|
|
2009-06-21 17:04:51 +04:00
|
|
|
bool fEnabled;
|
|
|
|
bool fSelected;
|
|
|
|
bool fFocus;
|
|
|
|
BView* fView;
|
2015-07-14 04:28:20 +03:00
|
|
|
BTabView* fTabView;
|
2009-06-21 17:04:51 +04:00
|
|
|
|
2015-07-14 04:28:20 +03:00
|
|
|
uint32 _reserved[11];
|
2007-09-27 11:55:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-06-21 17:04:51 +04:00
|
|
|
class BTabView : public BView {
|
2002-09-26 18:53:19 +04:00
|
|
|
public:
|
2009-06-21 17:04:51 +04:00
|
|
|
BTabView(const char* name,
|
|
|
|
button_width width = B_WIDTH_AS_USUAL,
|
2009-08-27 15:12:41 +04:00
|
|
|
uint32 flags = B_FULL_UPDATE_ON_RESIZE
|
|
|
|
| B_WILL_DRAW | B_NAVIGABLE_JUMP
|
|
|
|
| B_FRAME_EVENTS | B_NAVIGABLE);
|
2009-06-21 17:04:51 +04:00
|
|
|
BTabView(BRect frame, const char* name,
|
|
|
|
button_width width = B_WIDTH_AS_USUAL,
|
2014-12-20 03:43:26 +03:00
|
|
|
uint32 resizeMask = B_FOLLOW_ALL,
|
2009-08-27 15:12:41 +04:00
|
|
|
uint32 flags = B_FULL_UPDATE_ON_RESIZE
|
|
|
|
| B_WILL_DRAW | B_NAVIGABLE_JUMP
|
|
|
|
| B_FRAME_EVENTS | B_NAVIGABLE);
|
2009-06-21 17:04:51 +04:00
|
|
|
virtual ~BTabView();
|
|
|
|
|
|
|
|
BTabView(BMessage* archive);
|
|
|
|
static BArchivable* Instantiate(BMessage* archive);
|
|
|
|
virtual status_t Archive(BMessage* into,
|
|
|
|
bool deep = true) const;
|
2010-07-29 00:03:41 +04:00
|
|
|
virtual status_t AllUnarchived(const BMessage* from);
|
2009-06-21 17:04:51 +04:00
|
|
|
virtual status_t Perform(perform_code d, void* arg);
|
|
|
|
|
|
|
|
virtual void AttachedToWindow();
|
2009-08-27 15:12:41 +04:00
|
|
|
virtual void DetachedFromWindow();
|
2009-06-21 17:04:51 +04:00
|
|
|
virtual void AllAttached();
|
|
|
|
virtual void AllDetached();
|
|
|
|
|
|
|
|
virtual void MessageReceived(BMessage* message);
|
|
|
|
virtual void KeyDown(const char* bytes, int32 numBytes);
|
2014-12-20 03:43:26 +03:00
|
|
|
virtual void MouseDown(BPoint where);
|
|
|
|
virtual void MouseUp(BPoint where);
|
|
|
|
virtual void MouseMoved(BPoint where, uint32 transit,
|
2009-06-21 17:04:51 +04:00
|
|
|
const BMessage* dragMessage);
|
|
|
|
virtual void Pulse();
|
|
|
|
|
2014-12-20 03:58:56 +03:00
|
|
|
virtual void Select(int32 index);
|
2009-06-21 17:04:51 +04:00
|
|
|
int32 Selection() const;
|
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
virtual void WindowActivated(bool active);
|
2009-06-21 17:04:51 +04:00
|
|
|
virtual void MakeFocus(bool focused = true);
|
|
|
|
virtual void SetFocusTab(int32 tab, bool focused);
|
|
|
|
int32 FocusTab() const;
|
|
|
|
|
|
|
|
virtual void Draw(BRect updateRect);
|
|
|
|
virtual BRect DrawTabs();
|
|
|
|
virtual void DrawBox(BRect selectedTabRect);
|
|
|
|
virtual BRect TabFrame(int32 index) const;
|
|
|
|
|
|
|
|
virtual void SetFlags(uint32 flags);
|
|
|
|
virtual void SetResizingMode(uint32 mode);
|
|
|
|
|
|
|
|
virtual void ResizeToPreferred();
|
2014-12-20 03:43:26 +03:00
|
|
|
virtual void GetPreferredSize(float* _width, float* _height);
|
2009-06-21 17:04:51 +04:00
|
|
|
|
|
|
|
virtual BSize MinSize();
|
|
|
|
virtual BSize MaxSize();
|
|
|
|
virtual BSize PreferredSize();
|
|
|
|
|
2014-12-20 03:43:26 +03:00
|
|
|
virtual void FrameMoved(BPoint newPosition);
|
|
|
|
virtual void FrameResized(float newWidth, float newHeight);
|
2009-08-27 15:12:41 +04:00
|
|
|
|
2009-06-21 17:04:51 +04:00
|
|
|
virtual BHandler* ResolveSpecifier(BMessage* message,
|
|
|
|
int32 index, BMessage* specifier,
|
|
|
|
int32 what, const char* property);
|
|
|
|
virtual status_t GetSupportedSuites(BMessage* message);
|
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
// BTabView
|
2009-06-21 17:04:51 +04:00
|
|
|
virtual void AddTab(BView* target, BTab* tab = NULL);
|
|
|
|
virtual BTab* RemoveTab(int32 tabIndex);
|
|
|
|
|
|
|
|
virtual BTab* TabAt(int32 index) const;
|
|
|
|
|
|
|
|
virtual void SetTabWidth(button_width width);
|
|
|
|
button_width TabWidth() const;
|
|
|
|
|
|
|
|
virtual void SetTabHeight(float height);
|
|
|
|
float TabHeight() const;
|
|
|
|
|
2010-02-21 23:15:21 +03:00
|
|
|
virtual void SetBorder(border_style border);
|
|
|
|
border_style Border() const;
|
|
|
|
|
2009-06-21 17:04:51 +04:00
|
|
|
BView* ContainerView() const;
|
|
|
|
|
|
|
|
int32 CountTabs() const;
|
|
|
|
BView* ViewForTab(int32 tabIndex) const;
|
2007-09-27 11:55:16 +04:00
|
|
|
|
|
|
|
private:
|
2009-08-27 15:12:41 +04:00
|
|
|
// FBC padding and forbidden methods
|
2009-06-21 17:04:51 +04:00
|
|
|
virtual void _ReservedTabView2();
|
|
|
|
virtual void _ReservedTabView3();
|
|
|
|
virtual void _ReservedTabView4();
|
|
|
|
virtual void _ReservedTabView5();
|
|
|
|
virtual void _ReservedTabView6();
|
|
|
|
virtual void _ReservedTabView7();
|
|
|
|
virtual void _ReservedTabView8();
|
|
|
|
virtual void _ReservedTabView9();
|
|
|
|
virtual void _ReservedTabView10();
|
|
|
|
virtual void _ReservedTabView11();
|
|
|
|
virtual void _ReservedTabView12();
|
|
|
|
|
|
|
|
BTabView(const BTabView&);
|
|
|
|
BTabView& operator=(const BTabView&);
|
|
|
|
|
2009-08-27 15:12:41 +04:00
|
|
|
private:
|
|
|
|
void _InitObject(bool layouted, button_width width);
|
2010-07-29 00:03:41 +04:00
|
|
|
void _InitContainerView(bool layouted);
|
2009-08-27 15:12:41 +04:00
|
|
|
BSize _TabsMinSize() const;
|
2010-02-21 23:15:21 +03:00
|
|
|
float _BorderWidth() const;
|
|
|
|
void _LayoutContainerView(bool layouted);
|
2009-08-27 15:12:41 +04:00
|
|
|
|
|
|
|
private:
|
2009-06-21 17:04:51 +04:00
|
|
|
BList* fTabList;
|
|
|
|
BView* fContainerView;
|
|
|
|
button_width fTabWidthSetting;
|
|
|
|
float fTabWidth;
|
|
|
|
float fTabHeight;
|
|
|
|
int32 fSelection;
|
|
|
|
int32 fInitialSelection;
|
|
|
|
int32 fFocus;
|
|
|
|
float fTabOffset;
|
2010-02-21 23:15:21 +03:00
|
|
|
border_style fBorderStyle;
|
2009-06-21 17:04:51 +04:00
|
|
|
|
2010-02-21 23:15:21 +03:00
|
|
|
uint32 _reserved[10];
|
2007-09-27 11:55:16 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _TAB_VIEW_H
|