Documentation fixes for BTab and BTabView
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2001-2009 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _TAB_VIEW_H
|
||||
@@ -24,8 +24,7 @@ public:
|
||||
BTab(BMessage* archive);
|
||||
static BArchivable* Instantiate(BMessage* archive);
|
||||
|
||||
virtual status_t Archive(BMessage* archive,
|
||||
bool deep = true) const;
|
||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||
virtual status_t Perform(uint32 d, void* arg);
|
||||
|
||||
const char* Label() const;
|
||||
@@ -35,10 +34,10 @@ public:
|
||||
virtual void Select(BView* owner);
|
||||
virtual void Deselect();
|
||||
|
||||
virtual void SetEnabled(bool enabled);
|
||||
virtual void SetEnabled(bool enable);
|
||||
bool IsEnabled() const;
|
||||
|
||||
void MakeFocus(bool inFocus = true);
|
||||
void MakeFocus(bool focus = true);
|
||||
bool IsFocus() const;
|
||||
|
||||
// sets/gets the view to be displayed for this tab
|
||||
@@ -86,7 +85,7 @@ public:
|
||||
| B_FRAME_EVENTS | B_NAVIGABLE);
|
||||
BTabView(BRect frame, const char* name,
|
||||
button_width width = B_WIDTH_AS_USUAL,
|
||||
uint32 resizingMode = B_FOLLOW_ALL,
|
||||
uint32 resizeMask = B_FOLLOW_ALL,
|
||||
uint32 flags = B_FULL_UPDATE_ON_RESIZE
|
||||
| B_WILL_DRAW | B_NAVIGABLE_JUMP
|
||||
| B_FRAME_EVENTS | B_NAVIGABLE);
|
||||
@@ -106,9 +105,9 @@ public:
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||
virtual void MouseDown(BPoint point);
|
||||
virtual void MouseUp(BPoint point);
|
||||
virtual void MouseMoved(BPoint point, uint32 transit,
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||
const BMessage* dragMessage);
|
||||
virtual void Pulse();
|
||||
|
||||
@@ -129,15 +128,14 @@ public:
|
||||
virtual void SetResizingMode(uint32 mode);
|
||||
|
||||
virtual void ResizeToPreferred();
|
||||
virtual void GetPreferredSize(float* _width,
|
||||
float* _height);
|
||||
virtual void GetPreferredSize(float* _width, float* _height);
|
||||
|
||||
virtual BSize MinSize();
|
||||
virtual BSize MaxSize();
|
||||
virtual BSize PreferredSize();
|
||||
|
||||
virtual void FrameMoved(BPoint newLocation);
|
||||
virtual void FrameResized(float width,float height);
|
||||
virtual void FrameMoved(BPoint newPosition);
|
||||
virtual void FrameResized(float newWidth, float newHeight);
|
||||
|
||||
virtual BHandler* ResolveSpecifier(BMessage* message,
|
||||
int32 index, BMessage* specifier,
|
||||
|
||||
+49
-108
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2013, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2001-2013 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -41,6 +41,7 @@ static property_info sPropertyList[] = {
|
||||
NULL, 0,
|
||||
{ B_INT32_TYPE }
|
||||
},
|
||||
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -95,16 +96,16 @@ BTab::Instantiate(BMessage *archive)
|
||||
|
||||
|
||||
status_t
|
||||
BTab::Archive(BMessage *archive, bool deep) const
|
||||
BTab::Archive(BMessage* data, bool deep) const
|
||||
{
|
||||
status_t err = BArchivable::Archive(archive, deep);
|
||||
if (err != B_OK)
|
||||
return err;
|
||||
status_t result = BArchivable::Archive(data, deep);
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
|
||||
if (!fEnabled)
|
||||
err = archive->AddBool("_disable", false);
|
||||
result = data->AddBool("_disable", false);
|
||||
|
||||
return err;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,9 +179,9 @@ BTab::Deselect()
|
||||
|
||||
|
||||
void
|
||||
BTab::SetEnabled(bool enabled)
|
||||
BTab::SetEnabled(bool enable)
|
||||
{
|
||||
fEnabled = enabled;
|
||||
fEnabled = enable;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,9 +193,9 @@ BTab::IsEnabled() const
|
||||
|
||||
|
||||
void
|
||||
BTab::MakeFocus(bool inFocus)
|
||||
BTab::MakeFocus(bool focus)
|
||||
{
|
||||
fFocus = inFocus;
|
||||
fFocus = focus;
|
||||
}
|
||||
|
||||
|
||||
@@ -255,12 +256,12 @@ void
|
||||
BTab::DrawTab(BView* owner, BRect frame, tab_position position, bool full)
|
||||
{
|
||||
rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
uint32 borders = BControlLook::B_TOP_BORDER
|
||||
| BControlLook::B_BOTTOM_BORDER;
|
||||
|
||||
if (frame.left == owner->Bounds().left)
|
||||
borders |= BControlLook::B_LEFT_BORDER;
|
||||
|
||||
if (frame.right == owner->Bounds().right)
|
||||
borders |= BControlLook::B_RIGHT_BORDER;
|
||||
|
||||
@@ -274,69 +275,10 @@ BTab::DrawTab(BView *owner, BRect frame, tab_position position, bool full)
|
||||
}
|
||||
|
||||
DrawLabel(owner, frame);
|
||||
return;
|
||||
}
|
||||
|
||||
rgb_color lightenmax = tint_color(no_tint, B_LIGHTEN_MAX_TINT);
|
||||
rgb_color darken2 = tint_color(no_tint, B_DARKEN_2_TINT);
|
||||
rgb_color darken3 = tint_color(no_tint, B_DARKEN_3_TINT);
|
||||
rgb_color darken4 = tint_color(no_tint, B_DARKEN_4_TINT);
|
||||
rgb_color darkenmax = tint_color(no_tint, B_DARKEN_MAX_TINT);
|
||||
|
||||
owner->SetHighColor(darkenmax);
|
||||
owner->SetLowColor(no_tint);
|
||||
// NOTE: "frame" goes from the beginning of the left slope to the beginning
|
||||
// of the right slope - "lableFrame" is the frame between both slopes
|
||||
BRect lableFrame = frame;
|
||||
lableFrame.left = lableFrame.left + frame.Height() / 2.0;
|
||||
DrawLabel(owner, lableFrame);
|
||||
|
||||
owner->SetDrawingMode(B_OP_OVER);
|
||||
|
||||
owner->BeginLineArray(12);
|
||||
|
||||
int32 slopeWidth = (int32)ceilf(frame.Height() / 2.0);
|
||||
|
||||
if (position != B_TAB_ANY) {
|
||||
// full height left side
|
||||
owner->AddLine(BPoint(frame.left, frame.bottom),
|
||||
BPoint(frame.left + slopeWidth, frame.top), darken3);
|
||||
owner->AddLine(BPoint(frame.left, frame.bottom + 1),
|
||||
BPoint(frame.left + slopeWidth, frame.top + 1), lightenmax);
|
||||
} else {
|
||||
// upper half of left side
|
||||
owner->AddLine(BPoint(frame.left + slopeWidth / 2,
|
||||
frame.bottom - slopeWidth),
|
||||
BPoint(frame.left + slopeWidth, frame.top), darken3);
|
||||
owner->AddLine(BPoint(frame.left + slopeWidth / 2 + 2,
|
||||
frame.bottom - slopeWidth - 1),
|
||||
BPoint(frame.left + slopeWidth, frame.top + 1), lightenmax);
|
||||
}
|
||||
|
||||
// lines along the top
|
||||
owner->AddLine(BPoint(frame.left + slopeWidth, frame.top),
|
||||
BPoint(frame.right, frame.top), darken3);
|
||||
owner->AddLine(BPoint(frame.left + slopeWidth, frame.top + 1),
|
||||
BPoint(frame.right, frame.top + 1), lightenmax);
|
||||
|
||||
if (full) {
|
||||
// full height right side
|
||||
owner->AddLine(BPoint(frame.right, frame.top),
|
||||
BPoint(frame.right + slopeWidth + 2, frame.bottom), darken2);
|
||||
owner->AddLine(BPoint(frame.right, frame.top + 1),
|
||||
BPoint(frame.right + slopeWidth + 1, frame.bottom), darken4);
|
||||
} else {
|
||||
// upper half of right side
|
||||
owner->AddLine(BPoint(frame.right, frame.top),
|
||||
BPoint(frame.right + slopeWidth / 2 + 1,
|
||||
frame.bottom - slopeWidth), darken2);
|
||||
owner->AddLine(BPoint(frame.right, frame.top + 1),
|
||||
BPoint(frame.right + slopeWidth / 2,
|
||||
frame.bottom - slopeWidth), darken4);
|
||||
}
|
||||
|
||||
owner->EndLineArray();
|
||||
}
|
||||
// #pragma mark - FBC padding and private methods
|
||||
|
||||
|
||||
void BTab::_ReservedTab1() {}
|
||||
@@ -371,9 +313,9 @@ BTabView::BTabView(const char *name, button_width width, uint32 flags)
|
||||
|
||||
|
||||
BTabView::BTabView(BRect frame, const char* name, button_width width,
|
||||
uint32 resizingMode, uint32 flags)
|
||||
uint32 resizeMask, uint32 flags)
|
||||
:
|
||||
BView(frame, name, resizingMode, flags)
|
||||
BView(frame, name, resizeMask, flags)
|
||||
{
|
||||
_InitObject(false, width);
|
||||
}
|
||||
@@ -466,28 +408,28 @@ BTabView::Archive(BMessage* archive, bool deep) const
|
||||
{
|
||||
BArchiver archiver(archive);
|
||||
|
||||
status_t ret = BView::Archive(archive, deep);
|
||||
status_t result = BView::Archive(archive, deep);
|
||||
|
||||
if (ret == B_OK)
|
||||
ret = archive->AddInt16("_but_width", fTabWidthSetting);
|
||||
if (ret == B_OK)
|
||||
ret = archive->AddFloat("_high", fTabHeight);
|
||||
if (ret == B_OK)
|
||||
ret = archive->AddInt32("_sel", fSelection);
|
||||
if (ret == B_OK && fBorderStyle != B_FANCY_BORDER)
|
||||
ret = archive->AddInt32("_border_style", fBorderStyle);
|
||||
if (result == B_OK)
|
||||
result = archive->AddInt16("_but_width", fTabWidthSetting);
|
||||
if (result == B_OK)
|
||||
result = archive->AddFloat("_high", fTabHeight);
|
||||
if (result == B_OK)
|
||||
result = archive->AddInt32("_sel", fSelection);
|
||||
if (result == B_OK && fBorderStyle != B_FANCY_BORDER)
|
||||
result = archive->AddInt32("_border_style", fBorderStyle);
|
||||
|
||||
if (ret == B_OK && deep) {
|
||||
if (result == B_OK && deep) {
|
||||
for (int32 i = 0; i < CountTabs(); i++) {
|
||||
BTab* tab = TabAt(i);
|
||||
|
||||
if ((ret = archiver.AddArchivable("_l_items", tab, deep)) != B_OK)
|
||||
if ((result = archiver.AddArchivable("_l_items", tab, deep)) != B_OK)
|
||||
break;
|
||||
ret = archiver.AddArchivable("_view_list", tab->View(), deep);
|
||||
result = archiver.AddArchivable("_view_list", tab->View(), deep);
|
||||
}
|
||||
}
|
||||
|
||||
return archiver.Finish(ret);
|
||||
return archiver.Finish(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -687,34 +629,34 @@ BTabView::KeyDown(const char *bytes, int32 numBytes)
|
||||
|
||||
|
||||
void
|
||||
BTabView::MouseDown(BPoint point)
|
||||
BTabView::MouseDown(BPoint where)
|
||||
{
|
||||
if (point.y > fTabHeight)
|
||||
if (where.y > fTabHeight)
|
||||
return;
|
||||
|
||||
for (int32 i = 0; i < CountTabs(); i++) {
|
||||
if (TabFrame(i).Contains(point)
|
||||
if (TabFrame(i).Contains(where)
|
||||
&& i != Selection()) {
|
||||
Select(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BView::MouseDown(point);
|
||||
BView::MouseDown(where);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BTabView::MouseUp(BPoint point)
|
||||
BTabView::MouseUp(BPoint where)
|
||||
{
|
||||
BView::MouseUp(point);
|
||||
BView::MouseUp(where);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BTabView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
||||
BTabView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
||||
{
|
||||
BView::MouseMoved(point, transit, message);
|
||||
BView::MouseMoved(where, transit, dragMessage);
|
||||
}
|
||||
|
||||
|
||||
@@ -786,16 +728,16 @@ BTabView::WindowActivated(bool active)
|
||||
|
||||
|
||||
void
|
||||
BTabView::MakeFocus(bool focused)
|
||||
BTabView::MakeFocus(bool focus)
|
||||
{
|
||||
BView::MakeFocus(focused);
|
||||
BView::MakeFocus(focus);
|
||||
|
||||
SetFocusTab(Selection(), focused);
|
||||
SetFocusTab(Selection(), focus);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BTabView::SetFocusTab(int32 tab, bool focused)
|
||||
BTabView::SetFocusTab(int32 tab, bool focus)
|
||||
{
|
||||
if (tab >= CountTabs())
|
||||
tab = 0;
|
||||
@@ -803,7 +745,7 @@ BTabView::SetFocusTab(int32 tab, bool focused)
|
||||
if (tab < 0)
|
||||
tab = CountTabs() - 1;
|
||||
|
||||
if (focused) {
|
||||
if (focus) {
|
||||
if (tab == fFocus)
|
||||
return;
|
||||
|
||||
@@ -1080,9 +1022,9 @@ BTabView::ResizeToPreferred()
|
||||
|
||||
|
||||
void
|
||||
BTabView::GetPreferredSize(float *width, float *height)
|
||||
BTabView::GetPreferredSize(float* _width, float* _height)
|
||||
{
|
||||
BView::GetPreferredSize(width, height);
|
||||
BView::GetPreferredSize(_width, _height);
|
||||
}
|
||||
|
||||
|
||||
@@ -1144,16 +1086,16 @@ BTabView::PreferredSize()
|
||||
|
||||
|
||||
void
|
||||
BTabView::FrameMoved(BPoint newLocation)
|
||||
BTabView::FrameMoved(BPoint newPosition)
|
||||
{
|
||||
BView::FrameMoved(newLocation);
|
||||
BView::FrameMoved(newPosition);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BTabView::FrameResized(float width,float height)
|
||||
BTabView::FrameResized(float newWidth, float newHeight)
|
||||
{
|
||||
BView::FrameResized(width, height);
|
||||
BView::FrameResized(newWidth, newHeight);
|
||||
}
|
||||
|
||||
|
||||
@@ -1493,4 +1435,3 @@ B_IF_GCC_2(_ReservedTabView1__8BTabView, _ZN8BTabView17_ReservedTabView1Ev)(
|
||||
{
|
||||
tabView->BTabView::SetBorder(border);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user