xref: /haiku/src/kits/interface/TabView.cpp (revision 7120e97489acbf17d86d3f33e3b2e68974fd4b23)
1 //------------------------------------------------------------------------------
2 //	Copyright (c) 2001-2002, OpenBeOS
3 //
4 //	Permission is hereby granted, free of charge, to any person obtaining a
5 //	copy of this software and associated documentation files (the "Software"),
6 //	to deal in the Software without restriction, including without limitation
7 //	the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 //	and/or sell copies of the Software, and to permit persons to whom the
9 //	Software is furnished to do so, subject to the following conditions:
10 //
11 //	The above copyright notice and this permission notice shall be included in
12 //	all copies or substantial portions of the Software.
13 //
14 //	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 //	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 //	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 //	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 //	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 //	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 //	DEALINGS IN THE SOFTWARE.
21 //
22 //	File Name:		TabView.cpp
23 //	Author:			Marc Flerackers (mflerackers@androme.be)
24 //	Description:	BTab creates individual "tabs" that can be assigned
25 //                  to specific views.
26 //                  BTabView provides the framework for containing and
27 //                  managing groups of BTab objects.
28 //------------------------------------------------------------------------------
29 
30 // Standard Includes -----------------------------------------------------------
31 
32 // System Includes -------------------------------------------------------------
33 #include <TabView.h>
34 #include <Message.h>
35 #include <List.h>
36 #include <Rect.h>
37 #include <Errors.h>
38 
39 // Project Includes ------------------------------------------------------------
40 
41 // Local Includes --------------------------------------------------------------
42 
43 // Local Defines ---------------------------------------------------------------
44 
45 // Globals ---------------------------------------------------------------------
46 
47 //------------------------------------------------------------------------------
48 BTab::BTab(BView *tabView)
49 	:	fEnabled(true),
50 		fSelected(false),
51 		fFocus(false),
52 		fView(tabView)
53 {
54 }
55 //------------------------------------------------------------------------------
56 BTab::~BTab()
57 {
58 	if (fView->Window() != NULL)
59 	{
60 		fView->RemoveSelf();
61 
62 		delete fView;
63 	}
64 }
65 //------------------------------------------------------------------------------
66 BTab::BTab(BMessage *archive)
67 	:	fSelected(false),
68 		fFocus(false),
69 		fView(NULL)
70 {
71 	if (archive->FindBool("_disable", &fEnabled) != B_OK)
72 		fEnabled = true;
73 	else
74 		fEnabled = !fEnabled;
75 }
76 //------------------------------------------------------------------------------
77 BArchivable *BTab::Instantiate(BMessage *archive)
78 {
79 	if (validate_instantiation(archive, "BTab"))
80 		return new BTab(archive);
81 	else
82 		return NULL;
83 }
84 //------------------------------------------------------------------------------
85 status_t BTab::Archive(BMessage *archive, bool deep) const
86 {
87 	status_t err = BArchivable::Archive(archive, deep);
88 
89 	if (err != B_OK)
90 		return err;
91 
92 	if ( !fEnabled )
93 		err = archive->AddBool("_disable", false);
94 
95 	return err;
96 }
97 //------------------------------------------------------------------------------
98 status_t BTab::Perform(uint32 d, void *arg)
99 {
100 	return B_ERROR;
101 }
102 //------------------------------------------------------------------------------
103 const char *BTab::Label() const
104 {
105 	if (fView)
106 		return fView->Name();
107 	else
108 		return NULL;
109 }
110 //------------------------------------------------------------------------------
111 void BTab::SetLabel(const char *label)
112 {
113 	if (fView)
114 		fView->SetName(label);
115 }
116 //------------------------------------------------------------------------------
117 bool BTab::IsSelected() const
118 {
119 	return fSelected;
120 }
121 //------------------------------------------------------------------------------
122 void BTab::Select(BView *owner)
123 {
124 	dynamic_cast<BTabView*>(owner)->ContainerView()->AddChild(fView);
125 
126 	fSelected = true;
127 }
128 //------------------------------------------------------------------------------
129 void BTab::Deselect()
130 {
131 	fView->RemoveSelf();
132 
133 	fSelected = false;
134 }
135 //------------------------------------------------------------------------------
136 void BTab::SetEnabled(bool enabled)
137 {
138 	fEnabled = enabled;
139 }
140 //------------------------------------------------------------------------------
141 bool BTab::IsEnabled() const
142 {
143 	return fEnabled;
144 }
145 //------------------------------------------------------------------------------
146 void BTab::MakeFocus(bool inFocus)
147 {
148 	fFocus = inFocus;
149 }
150 //------------------------------------------------------------------------------
151 bool BTab::IsFocus() const
152 {
153 	return fFocus;
154 }
155 //------------------------------------------------------------------------------
156 void BTab::SetView(BView *view)
157 {
158 	// TODO: do we need to remove the previous view and add the new one if
159 	// selected?
160 	fView = view;
161 }
162 //------------------------------------------------------------------------------
163 BView *BTab::View() const
164 {
165 	return fView;
166 }
167 //------------------------------------------------------------------------------
168 void BTab::DrawFocusMark(BView *owner, BRect frame)
169 {
170 	float width = owner->StringWidth(Label());
171 
172 	owner->SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
173 	owner->StrokeLine(BPoint(frame.left + frame.Width() * 0.5f - width * 0.5f, frame.bottom),
174 		BPoint(frame.left + frame.Width() * 0.5f + width * 0.5f, frame.bottom));
175 }
176 //------------------------------------------------------------------------------
177 void BTab::DrawLabel(BView *owner, BRect frame)
178 {
179 	const char *label = Label();
180 
181 	if (label)
182 	{
183 		owner->SetHighColor(0, 0, 0);
184 		owner->DrawString(label, BPoint(frame.left + frame.Width() * 0.5f -
185 			owner->StringWidth(label) * 0.5f, frame.bottom - 4.0f - 2.0f));
186 	}
187 }
188 //------------------------------------------------------------------------------
189 void BTab::DrawTab(BView *owner, BRect frame, tab_position position, bool full)
190 {
191 	rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR),
192 		lightenmax = tint_color(no_tint, B_LIGHTEN_MAX_TINT),
193 		darken4 = tint_color(no_tint, B_DARKEN_4_TINT),
194 		darkenmax = tint_color(no_tint, B_DARKEN_MAX_TINT);
195 
196 	owner->SetHighColor(darkenmax);
197 	owner->SetLowColor(no_tint);
198 	DrawLabel(owner, frame);
199 
200 	owner->BeginLineArray(12);
201 
202 	if (position != B_TAB_ANY)
203 	{
204 		owner->AddLine(BPoint(frame.left - 2.0f, frame.bottom),
205 			BPoint(frame.left - 1.0f, frame.bottom - 1.0f), lightenmax);
206 		owner->AddLine(BPoint(frame.left, frame.bottom - 2.0f),
207 			BPoint(frame.left, frame.bottom - 3.0f), lightenmax);
208 	}
209 
210 	owner->AddLine(BPoint(frame.left + 1.0f, frame.bottom - 4.0f),
211 		BPoint(frame.left + 1.0f, frame.top + 5.0f), lightenmax);
212 	owner->AddLine(BPoint(frame.left + 1.0f, frame.top + 4.0f),
213 		BPoint(frame.left + 2.0f, frame.top + 2.0f), lightenmax);
214 	owner->AddLine(BPoint(frame.left + 3.0f, frame.top + 1.0f),
215 		BPoint(frame.left + 4.0f, frame.top + 1.0f), lightenmax);
216 	owner->AddLine(BPoint(frame.left + 5.0f, frame.top),
217 		BPoint(frame.right - 5.0f, frame.top), lightenmax);
218 
219 	owner->AddLine(BPoint(frame.right - 4.0f, frame.top + 1.0f),
220 		BPoint(frame.right - 3.0f, frame.top + 1.0f), lightenmax);
221 
222 	owner->AddLine(BPoint(frame.right - 2.0f, frame.top + 2.0f),
223 		BPoint(frame.right - 2.0f, frame.top + 3.0f), darken4);
224 	owner->AddLine(BPoint(frame.right - 1.0f, frame.top + 4.0f),
225 		BPoint(frame.right - 1.0f, frame.bottom - 4.0f), darken4);
226 
227 	if (full)
228 	{
229 		owner->AddLine(BPoint(frame.right, frame.bottom - 3.0f),
230 			BPoint(frame.right, frame.bottom - 2.0f), darken4);
231 		owner->AddLine(BPoint(frame.right + 1.0f, frame.bottom - 1.0f),
232 			BPoint(frame.right + 2.0f, frame.bottom), darken4);
233 	}
234 
235 	owner->EndLineArray();
236 }
237 //------------------------------------------------------------------------------
238 void BTab::_ReservedTab1() {}
239 void BTab::_ReservedTab2() {}
240 void BTab::_ReservedTab3() {}
241 void BTab::_ReservedTab4() {}
242 void BTab::_ReservedTab5() {}
243 void BTab::_ReservedTab6() {}
244 void BTab::_ReservedTab7() {}
245 void BTab::_ReservedTab8() {}
246 void BTab::_ReservedTab9() {}
247 void BTab::_ReservedTab10() {}
248 void BTab::_ReservedTab11() {}
249 void BTab::_ReservedTab12() {}
250 //------------------------------------------------------------------------------
251 BTab &BTab::operator=(const BTab &)
252 {
253 	return *this;
254 }
255 //------------------------------------------------------------------------------
256 
257 //------------------------------------------------------------------------------
258 BTabView::BTabView(BRect frame, const char *name, button_width width,
259 		uint32 resizingMode, uint32 flags)
260 	:	BView(frame, name, resizingMode, flags),
261 		fTabWidthSetting(width),
262 		fTabWidth(0.0f),
263 		fSelection(-1),
264 		fInitialSelection(-1),
265 		fFocus(-1)
266 {
267 	fTabList = new BList;
268 
269 	//font_height fh;
270 	//GetFontHeight(&fh);
271 	//fTabHeight = fh.ascent + fh.descent + 8.0f;
272 	fTabHeight = 20.0f;
273 
274 	BRect bounds = Bounds();
275 
276 	bounds.top += fTabHeight + 1.0f;
277 	bounds.InsetBy ( 2.0f, 2.0f );
278 
279 	fContainerView = new BView(bounds, "_fContainerView", B_FOLLOW_ALL,
280 		B_FRAME_EVENTS);
281 	AddChild(fContainerView);
282 }
283 //------------------------------------------------------------------------------
284 BTabView::~BTabView()
285 {
286 	for (int32 i = 0; i < CountTabs(); i++)
287 		delete TabAt(i);
288 
289 	delete fTabList;
290 }
291 //------------------------------------------------------------------------------
292 BTabView::BTabView(BMessage *archive)
293 	:	BView(archive),
294 		fInitialSelection(-1),
295 		fFocus(-1)
296 {
297 	fTabList = new BList;
298 
299 	if (archive->FindFloat("_high", &fTabHeight) != B_OK)
300 	{
301 		//font_height fh;
302 		//GetFontHeight(&fh);
303 		//fTabHeight = fh.ascent + fh.descent + 8.0f;
304 		fTabHeight = 20.0f;
305 	}
306 
307 	if (archive->FindInt16("_but_width", (int16*)&fTabWidthSetting) != B_OK)
308 		fTabWidthSetting = B_WIDTH_AS_USUAL;
309 
310 	if (archive->FindInt32("_sel", &fSelection) != B_OK)
311 		fSelection = -1;
312 
313 	int32 i = 0;
314 	BMessage msg;
315 
316 	while (archive->FindMessage("_l_items", i++, &msg) == B_OK)
317 	{
318 		BTab *tab = dynamic_cast<BTab*>(instantiate_object(&msg));
319 
320 		if (tab)
321 			AddTab(NULL, tab);
322 	}
323 
324 	BRect bounds = Bounds();
325 
326 	bounds.top += fTabHeight + 1.0f;
327 	bounds.InsetBy ( 2.0f, 2.0f );
328 
329 	fContainerView = new BView(bounds, "_fContainerView", B_FOLLOW_ALL,
330 		B_FRAME_EVENTS);
331 	AddChild(fContainerView);
332 }
333 //------------------------------------------------------------------------------
334 BArchivable *BTabView::Instantiate(BMessage *archive)
335 {
336 	if ( validate_instantiation(archive, "BTabView"))
337 		return new BTabView(archive);
338 	else
339 		return NULL;
340 }
341 //------------------------------------------------------------------------------
342 status_t BTabView::Archive(BMessage *archive, bool deep) const
343 {
344 	status_t err = BView::Archive(archive, deep);
345 
346 	if (err != B_OK)
347 		return err;
348 
349 	err = archive->AddFloat("_high", fTabHeight);
350 
351 	if (err != B_OK)
352 		return err;
353 
354 	if (fTabHeight != B_WIDTH_AS_USUAL)
355 	{
356 		err = archive->AddInt16("_but_width", fTabWidthSetting);
357 
358 		if (err != B_OK)
359 			return err;
360 	}
361 
362 	if (fSelection != -1)
363 	{
364 		err = archive->AddInt32("_sel", fSelection);
365 
366 		if (err != B_OK)
367 			return err;
368 	}
369 
370 	if (deep)
371 	{
372 		BMessage tabArchive;
373 
374 		for (int32 i = 0; i < CountTabs(); i++)
375 			if ((err = TabAt(i)->Archive(&tabArchive, deep)) == B_OK)
376 				archive->AddMessage("_l_items", &tabArchive);
377 			else
378 				return err;
379 	}
380 
381 	return B_OK;
382 }
383 //------------------------------------------------------------------------------
384 status_t BTabView::Perform(perform_code d, void *arg)
385 {
386 	return B_ERROR;
387 }
388 //------------------------------------------------------------------------------
389 void BTabView::WindowActivated(bool active)
390 {
391 	BView::WindowActivated(active);
392 
393 	DrawTabs();
394 }
395 //------------------------------------------------------------------------------
396 void BTabView::AttachedToWindow()
397 {
398 	BView::AttachedToWindow();
399 
400 	// TODO: check if this color is set in the BeOS implementation
401 	//if (Parent())
402     // SetViewColor(Parent()->ViewColor ());
403     SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
404 
405 	Select(0);
406 }
407 //------------------------------------------------------------------------------
408 void BTabView::AllAttached()
409 {
410 	BView::AllAttached();
411 }
412 //------------------------------------------------------------------------------
413 void BTabView::AllDetached()
414 {
415 	BView::AllDetached();
416 }
417 //------------------------------------------------------------------------------
418 void BTabView::DetachedFromWindow()
419 {
420 	BView::DetachedFromWindow();
421 }
422 //------------------------------------------------------------------------------
423 void BTabView::MessageReceived(BMessage *message)
424 {
425 	BView::MessageReceived(message);
426 }
427 //------------------------------------------------------------------------------
428 void BTabView::FrameMoved(BPoint newLocation)
429 {
430 	BView::FrameMoved(newLocation);
431 }
432 //------------------------------------------------------------------------------
433 void BTabView::FrameResized(float width,float height)
434 {
435 	BView::FrameResized(width, height);
436 }
437 //------------------------------------------------------------------------------
438 void BTabView::KeyDown(const char *bytes, int32 numBytes)
439 {
440 	switch (bytes[0])
441 	{
442 		case B_DOWN_ARROW:
443 		case B_LEFT_ARROW:
444 		{
445 			SetFocusTab((fFocus - 1) % CountTabs(), true);
446 			break;
447 		}
448 		case B_UP_ARROW:
449 		case B_RIGHT_ARROW:
450 		{
451 			SetFocusTab((fFocus + 1) % CountTabs(), true);
452 			break;
453 		}
454 		case B_RETURN:
455 		case B_SPACE:
456 		{
457 			Select(FocusTab());
458 			break;
459 		}
460 		default:
461 			BView::KeyDown(bytes, numBytes);
462 	}
463 }
464 //------------------------------------------------------------------------------
465 void BTabView::MouseDown(BPoint point)
466 {
467 	if (point.y <= fTabHeight)
468 	{
469 		for (int32 i = 0; i < CountTabs(); i++)
470 		{
471 			if (TabFrame(i).Contains(point))
472 			{
473 				Select(i);
474 				return;
475 			}
476 		}
477 	}
478 	else
479 		BView::MouseDown(point);
480 }
481 //------------------------------------------------------------------------------
482 void BTabView::MouseUp(BPoint point)
483 {
484 	BView::MouseUp(point);
485 }
486 //------------------------------------------------------------------------------
487 void BTabView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
488 {
489 	BView::MouseMoved(point, transit, message);
490 }
491 //------------------------------------------------------------------------------
492 void BTabView::Pulse()
493 {
494 	BView::Pulse();
495 }
496 //------------------------------------------------------------------------------
497 void BTabView::Select(int32 tab)
498 {
499 	if (tab < 0 || tab >= CountTabs())
500 		return;
501 
502 	if (tab == fSelection)
503 		return;
504 
505 	if (fSelection != -1)
506 		TabAt(fSelection)->Deselect();
507 
508 	if (tab != -1)
509 		TabAt(tab)->Select(this);
510 
511 	fSelection = tab;
512 
513 	Invalidate();
514 }
515 //------------------------------------------------------------------------------
516 int32 BTabView::Selection() const
517 {
518 	return fSelection;
519 }
520 //------------------------------------------------------------------------------
521 void BTabView::MakeFocus(bool focused)
522 {
523 	BView::MakeFocus(focused);
524 
525 	SetFocusTab(Selection(), focused);
526 }
527 //------------------------------------------------------------------------------
528 void BTabView::SetFocusTab(int32 tab, bool focused)
529 {
530 	if (tab < 0 || tab >= CountTabs())
531 		return;
532 
533 	if (focused)
534 	{
535 		if (tab == fFocus)
536 			return;
537 
538 		if (fFocus != -1)
539 			TabAt (fFocus)->MakeFocus(false);
540 
541 		TabAt(tab)->MakeFocus(true);
542 		fFocus = tab;
543 	}
544 	else if (fFocus != -1)
545 	{
546 		TabAt (fFocus)->MakeFocus(false);
547 		fFocus = -1;
548 	}
549 
550 	Invalidate();
551 }
552 //------------------------------------------------------------------------------
553 int32 BTabView::FocusTab() const
554 {
555 	return fFocus;
556 }
557 //------------------------------------------------------------------------------
558 void BTabView::Draw(BRect updateRect)
559 {
560 	DrawBox(DrawTabs());
561 
562 	if (IsFocus() && fFocus != -1)
563 		TabAt(fFocus)->DrawFocusMark(this, TabFrame(fFocus));
564 }
565 //------------------------------------------------------------------------------
566 BRect BTabView::DrawTabs()
567 {
568 	for(int32 i = 0; i < CountTabs(); i++)
569 		TabAt(i)->DrawTab(this, TabFrame(i),
570 			(i == fSelection) ? B_TAB_FRONT : (i == 0) ? B_TAB_FIRST : B_TAB_ANY,
571 			(i + 1 != fSelection));
572 
573 	if (fSelection > -1)
574 		return TabFrame(fSelection);
575 	else
576 		return BRect();
577 }
578 //------------------------------------------------------------------------------
579 void BTabView::DrawBox(BRect selTabRect)
580 {
581 	BRect rect = Bounds();
582 
583 	SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
584 		B_LIGHTEN_MAX_TINT));
585 
586 	StrokeLine(BPoint(0.0f, rect.bottom), BPoint(0.0f, selTabRect.bottom));
587 	StrokeLine(BPoint(selTabRect.left - 3.0f, selTabRect.bottom));
588 	StrokeLine(BPoint(selTabRect.right + 3.0f, selTabRect.bottom),
589 		BPoint(rect.right - 1.0f, selTabRect.bottom));
590 
591 	SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
592 		B_DARKEN_4_TINT));
593 
594 	StrokeLine(BPoint(rect.right, selTabRect.bottom + 1.0f),
595 		BPoint(rect.right, rect.bottom));
596 	StrokeLine(BPoint(rect.left + 1.0f, rect.bottom));
597 }
598 //------------------------------------------------------------------------------
599 BRect BTabView::TabFrame(int32 tab_index) const
600 {
601 	switch (fTabWidthSetting)
602 	{
603 		case B_WIDTH_FROM_LABEL:
604 		{
605 			float x = 6.0f;
606 
607 			for (int32 i = 0; i < tab_index; i++)
608 				x += StringWidth(TabAt(i)->Label()) + 20.0f;
609 
610 			return BRect(x, 0.0f,
611 				x + StringWidth(TabAt(tab_index)->Label()) + 20.0f, fTabHeight);
612 			break;
613 		}
614 		case B_WIDTH_FROM_WIDEST:
615 		{
616 			float width = 0.0f;
617 
618 			for (int32 i = 0; i < CountTabs(); i++)
619 			{
620 				float tabWidth = StringWidth(TabAt(i)->Label()) + 20.0f;
621 
622 				if (tabWidth > width)
623 					width = tabWidth;
624 			}
625 
626 			return BRect((6.0f + tab_index * width), 0.0f,
627 				(6.0f + tab_index * width + width), fTabHeight);
628 			break;
629 		}
630 		case B_WIDTH_AS_USUAL:
631 		default:
632 		{
633 			return BRect((6.0f + tab_index * 100.0f), 0.0f,
634 				(6.0f + tab_index * 100.0f + 100.0f), fTabHeight);
635 			break;
636 		}
637 	}
638 }
639 //------------------------------------------------------------------------------
640 void BTabView::SetFlags(uint32 flags)
641 {
642 	BView::SetFlags(flags);
643 }
644 //------------------------------------------------------------------------------
645 void BTabView::SetResizingMode(uint32 mode)
646 {
647 	BView::SetResizingMode(mode);
648 }
649 //------------------------------------------------------------------------------
650 void BTabView::GetPreferredSize(float *width, float *height)
651 {
652 	*width = Bounds().Width();
653 	*height = Bounds().Height();
654 }
655 //------------------------------------------------------------------------------
656 void BTabView::ResizeToPreferred()
657 {
658 	float width, height;
659 	GetPreferredSize(&width, &height);
660 	BView::ResizeTo(width, height);
661 }
662 //------------------------------------------------------------------------------
663 BHandler *BTabView::ResolveSpecifier(BMessage *message, int32 index,
664 							BMessage *specifier, int32 what, const char *property)
665 {
666 	return BView::ResolveSpecifier(message, index, specifier, what, property);
667 }
668 //------------------------------------------------------------------------------
669 status_t BTabView::GetSupportedSuites(BMessage *message)
670 {
671 	return BView::GetSupportedSuites(message);
672 }
673 //------------------------------------------------------------------------------
674 void BTabView::AddTab(BView *target, BTab *tab)
675 {
676 	if (tab == NULL)
677 		tab = new BTab(target);
678 	else
679 		tab->SetView(target);
680 
681 	fTabList->AddItem(tab);
682 
683 	// TODO: check if we need to select the new tab
684 	if (fSelection == -1)
685 		Select(0);
686 
687 	Invalidate();
688 }
689 //------------------------------------------------------------------------------
690 BTab *BTabView::RemoveTab(int32 tab_index)
691 {
692 	// TODO: check if we need to change the selection and focus
693 	if (fSelection == CountTabs() - 1)
694 		Select(fSelection - 1);
695 
696 	if (fFocus == CountTabs() - 1)
697 		SetFocusTab(fFocus, false);
698 	else
699 		SetFocusTab(fFocus, true);
700 
701 	BTab *tab = (BTab*)fTabList->RemoveItem(tab_index);
702 
703 	Invalidate();
704 
705 	return tab;
706 }
707 //------------------------------------------------------------------------------
708 BTab *BTabView::TabAt(int32 tab_index) const
709 {
710 	return (BTab*)fTabList->ItemAt(tab_index);
711 }
712 //------------------------------------------------------------------------------
713 void BTabView::SetTabWidth(button_width width)
714 {
715 	fTabWidthSetting = width;
716 
717 	Invalidate();
718 }
719 //------------------------------------------------------------------------------
720 button_width BTabView::TabWidth() const
721 {
722 	return fTabWidthSetting;
723 }
724 //------------------------------------------------------------------------------
725 void BTabView::SetTabHeight(float height)
726 {
727 	if (fTabHeight == height)
728 		return;
729 
730 	fContainerView->ResizeBy(0.0f, height - fTabHeight);
731 
732 	fTabHeight = height;
733 
734 	Invalidate();
735 }
736 //------------------------------------------------------------------------------
737 float BTabView::TabHeight() const
738 {
739 	return fTabHeight;
740 }
741 //------------------------------------------------------------------------------
742 BView *BTabView::ContainerView() const
743 {
744 	return fContainerView;
745 }
746 //------------------------------------------------------------------------------
747 int32 BTabView::CountTabs() const
748 {
749 	return fTabList->CountItems();
750 }
751 //------------------------------------------------------------------------------
752 BView *BTabView::ViewForTab(int32 tabIndex) const
753 {
754 	BTab *tab = TabAt(tabIndex);
755 
756 	if (tab)
757 		return tab->View();
758 	else
759 		return NULL;
760 }
761 //------------------------------------------------------------------------------
762 void BTabView::_InitObject()
763 {
764 }
765 //------------------------------------------------------------------------------
766 void BTabView::_ReservedTabView1() {}
767 void BTabView::_ReservedTabView2() {}
768 void BTabView::_ReservedTabView3() {}
769 void BTabView::_ReservedTabView4() {}
770 void BTabView::_ReservedTabView5() {}
771 void BTabView::_ReservedTabView6() {}
772 void BTabView::_ReservedTabView7() {}
773 void BTabView::_ReservedTabView8() {}
774 void BTabView::_ReservedTabView9() {}
775 void BTabView::_ReservedTabView10() {}
776 void BTabView::_ReservedTabView11() {}
777 void BTabView::_ReservedTabView12() {}
778 //------------------------------------------------------------------------------
779 BTabView::BTabView(const BTabView &tabView)
780 	:	BView(tabView)
781 {
782 }
783 //------------------------------------------------------------------------------
784 BTabView &BTabView::operator=(const BTabView &)
785 {
786 	return *this;
787 }
788 //------------------------------------------------------------------------------
789 
790 /*
791  * $Log $
792  *
793  * $Id  $
794  *
795  */
796