Commits

daonix  committed 29dfaf3

BTab class ready

  • Participants
  • Parent commits 81d90f8

Comments (0)

Files changed (13)

-#include BTabML.h
+#include "BTabML.hpp"
 BTabML::BTabML(BView* tabView)
 	:BTab(tabView)
 {
+	unsetHooks();
 }
 BTabML::BTabML(BMessage* archive)
 	:BTab(archive)
 {
+	unsetHooks();
+}
+void
+BTabML::unsetHooks()
+{
+	closure_DrawFocusMark = 0;
+	closure_DrawTab = 0;
+	closure_DrawLabel = 0;
 }
 void
 BTabML::DrawFocusMark(BView* owner, BRect frame)
 {
 	if (closure_DrawFocusMark)
 	{
-		value arglist = { (value)owner, (value)frame };
-		return caml_callbackN(closure_DrawFocusMark, 2, arglist);
+		value arglist [] = { (value)owner, (value)&frame };
+		caml_callbackN(closure_DrawFocusMark, 2, arglist);
 	} else
 	{
 		BTab::DrawFocusMark(owner, frame);
 {
 	if (closure_DrawTab)
 	{
-		value arglist = { (value)owner, (value)frame, (value)position, Val_bool(full) };
-		return caml_callbackN(closure_DrawTab, 4, arglist);
+		value arglist [] = { (value)owner, (value)&frame, (value)position, Val_bool(full) };
+		caml_callbackN(closure_DrawTab, 4, arglist);
 	} else
 	{
 		BTab::DrawTab(owner, frame, position, full);
 {
 	if (closure_DrawLabel)
 	{
-		value arglist = { (value)owner, (value)frame };
-		return caml_callbackN(closure_DrawLabel, 2, arglist);
+		value arglist [] = { (value)owner, (value)&frame };
+		caml_callbackN(closure_DrawLabel, 2, arglist);
 	} else
 	{
 		BTab::DrawLabel(owner, frame);
 	closure_DrawLabel = cb_DrawLabel;
 }
 extern "C" {
+CAMLprim value btab_null()
+{
+	CAMLparam0();
+	CAMLreturn((value)0);
+}
 CAMLprim value btab_constructor_1(value v_tabView)
 {
 	CAMLparam1(v_tabView);
 	((BTabML*)v_self)->setDrawLabel(v_cb);
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabArchive(value v_self, value v_archive, value v_deep)
+CAMLprim value btab_Archive(value v_self, value v_archive, value v_deep)
 {
 	CAMLparam3(v_self, v_archive, v_deep);
 	status_t res = ((BTab*)v_self)->Archive((BMessage*)v_archive, Bool_val(v_deep));
 	CAMLreturn((value)res);
 }
-CAMLprim value btabIsEnabled(value v_self)
+CAMLprim value btab_IsEnabled(value v_self)
 {
 	CAMLparam1(v_self);
 	bool res = ((BTab*)v_self)->IsEnabled();
 	CAMLreturn(Val_bool(res));
 }
-CAMLprim value btabSetEnabled(value v_self, value v_enabled)
+CAMLprim value btab_SetEnabled(value v_self, value v_enabled)
 {
 	CAMLparam2(v_self, v_enabled);
 	((BTab*)v_self)->SetEnabled(Bool_val(v_enabled));
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabIsSelected(value v_self)
+CAMLprim value btab_IsSelected(value v_self)
 {
 	CAMLparam1(v_self);
 	bool res = ((BTab*)v_self)->IsSelected();
 	CAMLreturn(Val_bool(res));
 }
-CAMLprim value btabDeselect(value v_self)
+CAMLprim value btab_Deselect(value v_self)
 {
 	CAMLparam1(v_self);
 	((BTab*)v_self)->Deselect();
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabSelect(value v_self, value v_owner)
+CAMLprim value btab_Select(value v_self, value v_owner)
 {
 	CAMLparam2(v_self, v_owner);
 	((BTab*)v_self)->Select((BView*)v_owner);
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabLabel(value v_self)
+CAMLprim value btab_Label(value v_self)
 {
 	CAMLparam1(v_self);
 	const char * res = ((BTab*)v_self)->Label();
-	CAMLreturn(Val_string(res));
+	CAMLreturn(caml_copy_string(res));
 }
-CAMLprim value btabSetLabel(value v_self, value v_label)
+CAMLprim value btab_SetLabel(value v_self, value v_label)
 {
 	CAMLparam2(v_self, v_label);
 	((BTab*)v_self)->SetLabel(String_val(v_label));
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabIsFocus(value v_self)
+CAMLprim value btab_IsFocus(value v_self)
 {
 	CAMLparam1(v_self);
 	bool res = ((BTab*)v_self)->IsFocus();
 	CAMLreturn(Val_bool(res));
 }
-CAMLprim value btabMakeFocus(value v_self, value v_inFocus)
+CAMLprim value btab_MakeFocus(value v_self, value v_inFocus)
 {
 	CAMLparam2(v_self, v_inFocus);
 	((BTab*)v_self)->MakeFocus(Bool_val(v_inFocus));
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabView(value v_self)
+CAMLprim value btab_View(value v_self)
 {
 	CAMLparam1(v_self);
 	BView* res = ((BTab*)v_self)->View();
 	CAMLreturn((value)res);
 }
-CAMLprim value btabSetView(value v_self, value v_view)
+CAMLprim value btab_SetView(value v_self, value v_view)
 {
 	CAMLparam2(v_self, v_view);
 	((BTab*)v_self)->SetView((BView*)v_view);
 	CAMLreturn(Val_unit);
 }
-}
+}
 #ifndef BTABML_H
 #define BTABML_H
-extern "C" { #include "HaikuML.h" }
+#include "interface/TabView.h"
+extern "C" {
+#include "HaikuML.h"
+}
 class BTabML : public BTab
 {
 public:
 	void setDrawTab(value cb_DrawTab);
 	void DrawLabel(BView* owner,BRect frame);
 	void setDrawLabel(value cb_DrawLabel);
+	void unsetHooks();
 private:
 	value closure_DrawFocusMark;
 	value closure_DrawTab;
 	value closure_DrawLabel;
 };
 
-#endif
+#endif

File BTabViewML.cpp

-#include BTabViewML.h
+#include "BTabViewML.hpp"
 BTabViewML::BTabViewML(BRect frame, const char * name, button_width width, int resizingMode, int flags)
 	:BTabView(frame, name, width, resizingMode, flags)
 {
+	unsetHooks();
 }
-BTabViewML::BTabViewML(BTabView& tabView)
+/*BTabViewML::BTabViewML(BTabView& tabView)
 	:BTabView(tabView)
 {
-}
+	unsetHooks();
+}*/
 BTabViewML::BTabViewML(BMessage* archive)
 	:BTabView(archive)
 {
+	unsetHooks();
+}
+void
+BTabViewML::unsetHooks()
+{
+	closure_AttachedToWindow = 0;
+        closure_Draw = 0;
+        closure_DrawBox = 0;
+        closure_DrawTabs = 0;
+        closure_KeyDown = 0;
+        closure_MouseDown = 0;
+        closure_WindowActivated = 0;
 }
 void
 BTabViewML::AttachedToWindow()
 {
 	if (closure_AttachedToWindow)
 	{
-		return caml_callback(closure_AttachedToWindow, Val_unit);
+		caml_callback(closure_AttachedToWindow, Val_unit);
 	} else
 	{
 		BTabView::AttachedToWindow();
 {
 	if (closure_Draw)
 	{
-		value arglist = { (value)updateRect };
-		return caml_callbackN(closure_Draw, 1, arglist);
+		value arglist [] = { (value)&updateRect };
+		caml_callbackN(closure_Draw, 1, arglist);
 	} else
 	{
 		BTabView::Draw(updateRect);
 {
 	if (closure_DrawBox)
 	{
-		value arglist = { (value)selTabRect };
-		return caml_callbackN(closure_DrawBox, 1, arglist);
+		value arglist [] = { (value)&selTabRect };
+		caml_callbackN(closure_DrawBox, 1, arglist);
 	} else
 	{
 		BTabView::DrawBox(selTabRect);
 {
 	if (closure_KeyDown)
 	{
-		value arglist = { Val_string(bytes), Val_int(numBytes) };
-		return caml_callbackN(closure_KeyDown, 2, arglist);
+		value arglist [] = { caml_copy_string(bytes), Val_int(numBytes) };
+		caml_callbackN(closure_KeyDown, 2, arglist);
 	} else
 	{
 		BTabView::KeyDown(bytes, numBytes);
 {
 	if (closure_MouseDown)
 	{
-		value arglist = { (value)point };
-		return caml_callbackN(closure_MouseDown, 1, arglist);
+		value arglist [] = { (value)&point };
+		caml_callbackN(closure_MouseDown, 1, arglist);
 	} else
 	{
 		BTabView::MouseDown(point);
 {
 	if (closure_WindowActivated)
 	{
-		value arglist = { Val_bool(active) };
-		return caml_callbackN(closure_WindowActivated, 1, arglist);
+		value arglist [] = { Val_bool(active) };
+		caml_callbackN(closure_WindowActivated, 1, arglist);
 	} else
 	{
 		BTabView::WindowActivated(active);
 	BTabViewML *res = new BTabViewML(*((BRect*)v_frame), String_val(v_name), (button_width)v_width, Int_val(v_resizingMode), Int_val(v_flags));
 	CAMLreturn((value)res);
 }
-CAMLprim value btabview_constructor_2(value v_tabView)
+/*CAMLprim value btabview_constructor_2(value v_tabView)
 {
 	CAMLparam1(v_tabView);
 	BTabViewML *res = new BTabViewML((BTabView&)v_tabView);
 	CAMLreturn((value)res);
-}
+}*/
 CAMLprim value btabview_constructor_3(value v_archive)
 {
 	CAMLparam1(v_archive);
 	((BTabViewML*)v_self)->setWindowActivated(v_cb);
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabviewAddTab(value v_self, value v_target, value v_tab)
+CAMLprim value btabview_AddTab(value v_self, value v_target, value v_tab)
 {
 	CAMLparam3(v_self, v_target, v_tab);
 	((BTabView*)v_self)->AddTab((BView*)v_target, (BTab*)v_tab);
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabviewRemoveTab(value v_self, value v_tab_index)
+CAMLprim value btabview_RemoveTab(value v_self, value v_tab_index)
 {
 	CAMLparam2(v_self, v_tab_index);
 	BTab* res = ((BTabView*)v_self)->RemoveTab(Int_val(v_tab_index));
 	CAMLreturn((value)res);
 }
-CAMLprim value btabviewMakeFocus(value v_self, value v_focused)
+CAMLprim value btabview_MakeFocus(value v_self, value v_focused)
 {
 	CAMLparam2(v_self, v_focused);
 	((BTabView*)v_self)->MakeFocus(Bool_val(v_focused));
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabviewSelect(value v_self, value v_tab)
+CAMLprim value btabview_Select(value v_self, value v_tab)
 {
 	CAMLparam2(v_self, v_tab);
 	((BTabView*)v_self)->Select(Int_val(v_tab));
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabviewSelection(value v_self)
+CAMLprim value btabview_Selection(value v_self)
 {
 	CAMLparam1(v_self);
 	int res = ((BTabView*)v_self)->Selection();
 	CAMLreturn(Val_int(res));
 }
-CAMLprim value btabviewSetFocusTab(value v_self, value v_tab, value v_focused)
+CAMLprim value btabview_SetFocusTab(value v_self, value v_tab, value v_focused)
 {
 	CAMLparam3(v_self, v_tab, v_focused);
 	((BTabView*)v_self)->SetFocusTab(Int_val(v_tab), Bool_val(v_focused));
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabviewFocusTab(value v_self)
+CAMLprim value btabview_FocusTab(value v_self)
 {
 	CAMLparam1(v_self);
 	int res = ((BTabView*)v_self)->FocusTab();
 	CAMLreturn(Val_int(res));
 }
-CAMLprim value btabviewSetTabHeight(value v_self, value v_height)
+CAMLprim value btabview_SetTabHeight(value v_self, value v_height)
 {
 	CAMLparam2(v_self, v_height);
 	((BTabView*)v_self)->SetTabHeight(Double_val(v_height));
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabviewTabHeight(value v_self)
+CAMLprim value btabview_TabHeight(value v_self)
 {
 	CAMLparam1(v_self);
 	float res = ((BTabView*)v_self)->TabHeight();
-	CAMLreturn(Val_double(res));
+	CAMLreturn(caml_copy_double(res));
 }
-CAMLprim value btabviewSetTabWidth(value v_self, value v_width)
+CAMLprim value btabview_SetTabWidth(value v_self, value v_width)
 {
 	CAMLparam2(v_self, v_width);
 	((BTabView*)v_self)->SetTabWidth((button_width)v_width);
 	CAMLreturn(Val_unit);
 }
-CAMLprim value btabviewTabWidth(value v_self)
+CAMLprim value btabview_TabWidth(value v_self)
 {
 	CAMLparam1(v_self);
 	button_width res = ((BTabView*)v_self)->TabWidth();
 	CAMLreturn((value)res);
 }
-CAMLprim value btabviewTabAt(value v_self, value v_tab_index)
+CAMLprim value btabview_TabAt(value v_self, value v_tab_index)
 {
 	CAMLparam2(v_self, v_tab_index);
 	BTab* res = ((BTabView*)v_self)->TabAt(Int_val(v_tab_index));
 	CAMLreturn((value)res);
 }
-CAMLprim value btabviewTabFrame(value v_self, value v_tab_index)
+CAMLprim value btabview_TabFrame(value v_self, value v_tab_index)
 {
 	CAMLparam2(v_self, v_tab_index);
-	BRect res = ((BTabView*)v_self)->TabFrame(Int_val(v_tab_index));
+	BRect pre_res = ((BTabView*)v_self)->TabFrame(Int_val(v_tab_index));
+	BRect* res = new BRect(pre_res);
 	CAMLreturn((value)res);
 }
-}
+}

File BTabViewML.hpp

 #ifndef BTABVIEWML_H
 #define BTABVIEWML_H
-extern "C" { #include "HaikuML.h" }
+#include "interface/TabView.h"
+extern "C" {
+#include "HaikuML.h"
+}
 class BTabViewML : public BTabView
 {
 public:
 	BTabViewML(BRect frame,const char * name,button_width width,int resizingMode,int flags);
-	BTabViewML(BTabView& tabView);
 	BTabViewML(BMessage* archive);
 	void AttachedToWindow();
 	void setAttachedToWindow(value cb_AttachedToWindow);
 	void setMouseDown(value cb_MouseDown);
 	void WindowActivated(bool active);
 	void setWindowActivated(value cb_WindowActivated);
+	void unsetHooks();
 private:
+//	BTabViewML(BTabView& tabView);
 	value closure_AttachedToWindow;
 	value closure_Draw;
 	value closure_DrawBox;
 	value closure_WindowActivated;
 };
 
-#endif
+#endif
 	CAMLparam1(v_button);
 	CAMLreturn((value)((BView*)((BButton*)v_button)));
 }
+CAMLprim value bview_of_btabview(value v_tabview)
+{
+	CAMLparam1(v_tabview);
+	CAMLreturn((value)((BView*)((BTabView*)v_tabview)));
+}
 }
 uint32 view_flags_of_val(value f)
 {
 all : ApplicationKit InterfaceKit
 
 ApplicationKit : bapplication bmessage
-InterfaceKit : bbutton brect bview bwindow
+InterfaceKit : bbutton brect btab btabview bview bwindow
 
 beapi :
 	g++ -o haikuml_beapi.o -I/boot/common/lib/ocaml -c BeapiML.cpp
 	ocamlmklib -o bRect haikuml_brect.o
 	ocamlmklib -o bRect bRect.cmx
 
+btab : beapi
+	g++ -o haikuml_btab.o -I/boot/common/lib/ocaml -c BTabML.cpp
+	ocamlopt -c bTab.ml
+	ocamlmklib -o bTab haikuml_btab.o
+	ocamlmklib -o bTab bTab.cmx
+
+btabview : beapi
+	g++ -o haikuml_btabview.o -I/boot/common/lib/ocaml -c BTabViewML.cpp
+	ocamlopt -c bTabView.ml
+	ocamlmklib -o bTabView haikuml_btabview.o
+	ocamlmklib -o bTabView bTabView.cmx
+
 bview : beapi
 	g++ -o haikuml_bview.o -I/boot/common/lib/ocaml -c BViewML.cpp
 	ocamlopt -c bView.ml
 	ocamlmklib -o bWindow bWindow.cmx
 
 hello_world : all
-	ocamlopt -I . -cclib -lroot -cclib -lbe bWindow.cmxa bView.cmxa bRect.cmxa bButton.cmxa bMessage.cmxa bApplication.cmxa beapi.cmxa caller.ml -o caller.opt
+	ocamlopt -I . -cclib -lroot -cclib -lbe bWindow.cmxa bView.cmxa bTabView.cmxa bTab.cmxa bRect.cmxa bButton.cmxa bMessage.cmxa bApplication.cmxa beapi.cmxa caller.ml -o caller.opt
 	unit -> Beapi.brect =
 	"brect_constructor_4"
 external brect_Contains_1 :
-	Beapi.bpoint -> bool =
+	Beapi.brect -> Beapi.bpoint -> bool =
 	"brect_Contains_1"
 external brect_Contains_2 :
-	Beapi.brect -> bool =
+	Beapi.brect -> Beapi.brect -> bool =
 	"brect_Contains_2"
 external brect_Intersects :
 	Beapi.brect -> Beapi.brect -> bool =
 	"brect_Intersects"
 external brect_InsetBy_1 :
-	float -> float -> unit =
+	Beapi.brect -> float -> float -> unit =
 	"brect_InsetBy_1"
 external brect_InsetBy_2 :
-	Beapi.bpoint -> unit =
+	Beapi.brect -> Beapi.bpoint -> unit =
 	"brect_InsetBy_2"
 external brect_InsetByCopy_1 :
-	float -> float -> Beapi.brect =
+	Beapi.brect -> float -> float -> Beapi.brect =
 	"brect_InsetByCopy_1"
 external brect_InsetByCopy_2 :
-	Beapi.bpoint -> Beapi.brect =
+	Beapi.brect -> Beapi.bpoint -> Beapi.brect =
 	"brect_InsetByCopy_2"
 external brect_OffsetBy_1 :
-	float -> float -> unit =
+	Beapi.brect -> float -> float -> unit =
 	"brect_OffsetBy_1"
 external brect_OffsetBy_2 :
-	Beapi.bpoint -> unit =
+	Beapi.brect -> Beapi.bpoint -> unit =
 	"brect_OffsetBy_2"
 external brect_OffsetByCopy_1 :
-	float -> float -> Beapi.brect =
+	Beapi.brect -> float -> float -> Beapi.brect =
 	"brect_OffsetByCopy_1"
 external brect_OffsetByCopy_2 :
-	Beapi.bpoint -> Beapi.brect =
+	Beapi.brect -> Beapi.bpoint -> Beapi.brect =
 	"brect_OffsetByCopy_2"
 external brect_OffsetTo_1 :
-	float -> float -> unit =
+	Beapi.brect -> float -> float -> unit =
 	"brect_OffsetTo_1"
 external brect_OffsetTo_2 :
-	Beapi.bpoint -> unit =
+	Beapi.brect -> Beapi.bpoint -> unit =
 	"brect_OffsetTo_2"
 external brect_OffsetToCopy_1 :
-	float -> float -> Beapi.brect =
+	Beapi.brect -> float -> float -> Beapi.brect =
 	"brect_OffsetToCopy_1"
 external brect_OffsetToCopy_2 :
-	Beapi.bpoint -> Beapi.brect =
+	Beapi.brect -> Beapi.bpoint -> Beapi.brect =
 	"brect_OffsetToCopy_2"
 external brect_PrintToStream :
 	Beapi.brect -> unit =
 		brect_constructor_4 ()
 	| _, _, _, _, _, _, _ -> invalid_arg "Wrong arg in BRect.brect"
 
-let contains ?point ?rect () =
+let contains ~self ?point ?rect () =
 	match point, rect with
-	| Some point, None -> brect_Contains_1 point
-	| None, Some rect -> brect_Contains_2 rect
+	| Some point, None -> brect_Contains_1 self point
+	| None, Some rect -> brect_Contains_2 self rect
 	| _, _ -> invalid_arg "Wrong arg in BRect.Contains"
 
 
 let intersects ~self ~rect () =
 	brect_Intersects self rect
 
-let inset_by ?point ?x ?y () =
+let inset_by ~self ?point ?x ?y () =
 	match point, x, y with
-	| None, Some x, Some y -> brect_InsetBy_1 x y
-	| Some point, None, None -> brect_InsetBy_2 point
+	| None, Some x, Some y -> brect_InsetBy_1 self x y
+	| Some point, None, None -> brect_InsetBy_2 self point
 	| _, _, _ -> invalid_arg "Wrong arg in BRect.InsetBy"
 
 
-let inset_by_copy ?point ?x ?y () =
+let inset_by_copy ~self ?point ?x ?y () =
 	match point, x, y with
-	| None, Some x, Some y -> brect_InsetByCopy_1 x y
-	| Some point, None, None -> brect_InsetByCopy_2 point
+	| None, Some x, Some y -> brect_InsetByCopy_1 self x y
+	| Some point, None, None -> brect_InsetByCopy_2 self point
 	| _, _, _ -> invalid_arg "Wrong arg in BRect.InsetByCopy"
 
 
-let offset_by ?point ?x ?y () =
+let offset_by ~self ?point ?x ?y () =
 	match point, x, y with
-	| None, Some x, Some y -> brect_OffsetBy_1 x y
-	| Some point, None, None -> brect_OffsetBy_2 point
+	| None, Some x, Some y -> brect_OffsetBy_1 self x y
+	| Some point, None, None -> brect_OffsetBy_2 self point
 	| _, _, _ -> invalid_arg "Wrong arg in BRect.OffsetBy"
 
 
-let offset_by_copy ?point ?x ?y () =
+let offset_by_copy ~self ?point ?x ?y () =
 	match point, x, y with
-	| None, Some x, Some y -> brect_OffsetByCopy_1 x y
-	| Some point, None, None -> brect_OffsetByCopy_2 point
+	| None, Some x, Some y -> brect_OffsetByCopy_1 self x y
+	| Some point, None, None -> brect_OffsetByCopy_2 self point
 	| _, _, _ -> invalid_arg "Wrong arg in BRect.OffsetByCopy"
 
 
-let offset_to ?point ?x ?y () =
+let offset_to ~self ?point ?x ?y () =
 	match point, x, y with
-	| None, Some x, Some y -> brect_OffsetTo_1 x y
-	| Some point, None, None -> brect_OffsetTo_2 point
+	| None, Some x, Some y -> brect_OffsetTo_1 self x y
+	| Some point, None, None -> brect_OffsetTo_2 self point
 	| _, _, _ -> invalid_arg "Wrong arg in BRect.OffsetTo"
 
 
-let offset_to_copy ?point ?x ?y () =
+let offset_to_copy ~self ?point ?x ?y () =
 	match point, x, y with
-	| None, Some x, Some y -> brect_OffsetToCopy_1 x y
-	| Some point, None, None -> brect_OffsetToCopy_2 point
+	| None, Some x, Some y -> brect_OffsetToCopy_1 self x y
+	| Some point, None, None -> brect_OffsetToCopy_2 self point
 	| _, _, _ -> invalid_arg "Wrong arg in BRect.OffsetToCopy"
 
 
 let right_bottom ~self () =
 	brect_RightBottom self
 
+
+class brect ?left ?top ?right ?bottom ?leftTop ?rightBottom
+            ?rect ?external_pointer () =
+  object (self)
+    val pointer =
+      match external_pointer with
+      | Some p -> p
+      | None ->
+          match left, top, right, bottom, leftTop, rightBottom, rect with
+          | Some left, Some top, Some right, Some bottom, None, None, None ->
+              brect_constructor_1 left top right bottom
+          | None, None, None, None, Some leftTop, Some rightBottom, None ->
+              brect_constructor_2 leftTop rightBottom
+          | None, None, None, None, None, None, Some rect ->
+              brect_constructor_3 rect
+          | None, None, None, None, None, None, None ->
+              brect_constructor_4 ()
+          | _, _, _, _, _, _, _ -> invalid_arg "Wrong arg in BRect.brect"
+    method get_pointer = pointer
+    method contains ?point ?rect () =
+      match point, rect with
+      | Some point, None -> brect_Contains_1 pointer point
+      | None, Some rect -> brect_Contains_2 pointer rect
+      | _, _ -> invalid_arg "Wrong arg in BRect.Contains"
+
+    method intersects ~rect () =
+      brect_Intersects pointer rect
+
+    method inset_by ?point ?x ?y () =
+      match point, x, y with
+      | None, Some x, Some y -> brect_InsetBy_1 pointer x y
+      | Some point, None, None -> brect_InsetBy_2 pointer point
+      | _, _, _ -> invalid_arg "Wrong arg in BRect.InsetBy"
+
+    method inset_by_copy ?point ?x ?y () =
+      match point, x, y with
+      | None, Some x, Some y -> brect_InsetByCopy_1 pointer x y
+      | Some point, None, None -> brect_InsetByCopy_2 pointer point
+      | _, _, _ -> invalid_arg "Wrong arg in BRect.InsetByCopy"
+
+    method offset_by ?point ?x ?y () =
+      match point, x, y with
+      | None, Some x, Some y -> brect_OffsetBy_1 pointer x y
+      | Some point, None, None -> brect_OffsetBy_2 pointer point
+      | _, _, _ -> invalid_arg "Wrong arg in BRect.OffsetBy"
+
+    method offset_by_copy ?point ?x ?y () =
+      match point, x, y with
+      | None, Some x, Some y -> brect_OffsetByCopy_1 pointer x y
+      | Some point, None, None -> brect_OffsetByCopy_2 pointer point
+      | _, _, _ -> invalid_arg "Wrong arg in BRect.OffsetByCopy"
+
+    method offset_to ?point ?x ?y () =
+      match point, x, y with
+      | None, Some x, Some y -> brect_OffsetTo_1 pointer x y
+      | Some point, None, None -> brect_OffsetTo_2 pointer point
+      | _, _, _ -> invalid_arg "Wrong arg in BRect.OffsetTo"
+
+    method offset_to_copy ?point ?x ?y () =
+      match point, x, y with
+      | None, Some x, Some y -> brect_OffsetToCopy_1 pointer x y
+      | Some point, None, None -> brect_OffsetToCopy_2 pointer point
+      | _, _, _ -> invalid_arg "Wrong arg in BRect.OffsetToCopy"
+
+    method print_to_stream () =
+      brect_PrintToStream pointer
+
+    method set_left_top ~point () =
+      brect_SetLeftTop pointer point
+
+    method set_left_bottom ~point () =
+      brect_SetLeftBottom pointer point
+
+    method set_right_top ~point () =
+      brect_SetRightTop pointer point
+
+    method set_right_bottom ~point () =
+      brect_SetRightBottom pointer point
+
+    method left_top () =
+      brect_LeftTop pointer
+
+    method left_bottom () =
+      brect_LeftBottom pointer
+
+    method right_top () =
+      brect_RightTop pointer
+
+    method right_bottom () =
+      brect_RightBottom pointer
+end
+external null :
+	unit -> Beapi.btab =
+	"btab_null"
+
+external btab_constructor_1 :
+	Beapi.bview -> Beapi.btab =
+	"btab_constructor_1"
+external btab_constructor_2 :
+	Beapi.bmessage -> Beapi.btab =
+	"btab_constructor_2"
+external btab_setDrawFocusMark :
+	Beapi.btab -> (Beapi.bview -> Beapi.brect -> unit) -> unit =
+	"btab_setDrawFocusMark"
+external btab_setDrawTab :
+	Beapi.btab -> (Beapi.bview -> Beapi.brect -> Beapi.tab_position -> bool -> unit) -> unit =
+	"btab_setDrawTab"
+external btab_setDrawLabel :
+	Beapi.btab -> (Beapi.bview -> Beapi.brect -> unit) -> unit =
+	"btab_setDrawLabel"
+external btab_Archive :
+	Beapi.btab -> Beapi.bmessage -> bool -> Beapi.status_t =
+	"btab_Archive"
+external btab_IsEnabled :
+	Beapi.btab -> bool =
+	"btab_IsEnabled"
+external btab_SetEnabled :
+	Beapi.btab -> bool -> unit =
+	"btab_SetEnabled"
+external btab_IsSelected :
+	Beapi.btab -> bool =
+	"btab_IsSelected"
+external btab_Deselect :
+	Beapi.btab -> unit =
+	"btab_Deselect"
+external btab_Select :
+	Beapi.btab -> Beapi.bview -> unit =
+	"btab_Select"
+external btab_Label :
+	Beapi.btab -> string =
+	"btab_Label"
+external btab_SetLabel :
+	Beapi.btab -> string -> unit =
+	"btab_SetLabel"
+external btab_IsFocus :
+	Beapi.btab -> bool =
+	"btab_IsFocus"
+external btab_MakeFocus :
+	Beapi.btab -> bool -> unit =
+	"btab_MakeFocus"
+external btab_View :
+	Beapi.btab -> Beapi.bview =
+	"btab_View"
+external btab_SetView :
+	Beapi.btab -> Beapi.bview -> unit =
+	"btab_SetView"
+
+
+let btab ?archive ?tabView () =
+	match archive, tabView with
+	| None, Some tabView -> btab_constructor_1 tabView
+	| Some archive, None -> btab_constructor_2 archive
+	| None, None -> invalid_arg "Wrong arg in BTab.constructor"
+
+let setDrawFocusMark ~self ~cb () =
+	btab_setDrawFocusMark self cb
+
+let setDrawTab ~self ~cb () =
+	btab_setDrawTab self cb
+
+let setDrawLabel ~self ~cb () =
+	btab_setDrawLabel self cb
+
+let archive ~self ~archive ~deep () =
+	btab_Archive self archive deep
+
+let is_enabled ~self () =
+	btab_IsEnabled self
+
+let set_enabled ~self ~enabled () =
+	btab_SetEnabled self enabled
+
+let is_selected ~self () =
+	btab_IsSelected self
+
+let deselect ~self () =
+	btab_Deselect self
+
+let select ~self ~owner () =
+	btab_Select self owner
+
+let label ~self () =
+	btab_Label self
+
+let set_label ~self ~label () =
+	btab_SetLabel self label
+
+let is_focus ~self () =
+	btab_IsFocus self
+
+let make_focus ~self ~inFocus () =
+	btab_MakeFocus self inFocus
+
+let view ~self () =
+	btab_View self
+
+let set_view ~self ~view () =
+	btab_SetView self view
+
+class btab ?archive ?tabView ?external_pointer () =
+  object (self)
+    val pointer =
+      match external_pointer with
+      | Some p -> p
+      | None ->
+          match archive, tabView with
+          | None, Some tabView -> btab_constructor_1 tabView
+          | Some archive, None -> btab_constructor_2 archive
+          | None, None -> invalid_arg "Wrong arg in BTab.constructor"
+
+    method get_pointer = pointer
+    method setDrawFocusMark cb =
+      btab_setDrawFocusMark pointer cb
+
+    method setDrawTab cb =
+      btab_setDrawTab pointer cb
+
+    method setDrawLabel cb =
+      btab_setDrawLabel pointer cb
+
+    method archive ~archive ~deep () =
+      btab_Archive pointer archive deep
+
+    method is_enabled () =
+      btab_IsEnabled pointer
+
+    method set_enabled ~enabled () =
+      btab_SetEnabled pointer enabled
+
+    method is_selected () =
+      btab_IsSelected pointer
+
+    method deselect () =
+      btab_Deselect pointer
+
+    method select ~owner () =
+      btab_Select pointer owner
+
+    method label () =
+      btab_Label pointer
+
+    method set_label ~label () =
+      btab_SetLabel pointer label
+
+    method is_focus () =
+      btab_IsFocus pointer
+
+    method make_focus ~inFocus () =
+      btab_MakeFocus pointer inFocus
+
+    method view () =
+      btab_View pointer
+
+    method set_view ~view () =
+      btab_SetView pointer view
+end
+external btabview_constructor_1 :
+	Beapi.brect -> string -> Beapi.button_width -> int -> int -> Beapi.btabview =
+	"btabview_constructor_1"
+(*external btabview_constructor_2 :
+	btabview& -> Beapi.btabview =
+	"btabview_constructor_2"*)
+external btabview_constructor_3 :
+	Beapi.bmessage -> Beapi.btabview =
+	"btabview_constructor_3"
+external btabview_setAttachedToWindow :
+	Beapi.btabview -> (unit -> unit) -> unit =
+	"btabview_setAttachedToWindow"
+external btabview_setDraw :
+	Beapi.btabview -> (Beapi.brect -> unit) -> unit =
+	"btabview_setDraw"
+external btabview_setDrawBox :
+	Beapi.btabview -> (Beapi.brect -> unit) -> unit =
+	"btabview_setDrawBox"
+external btabview_setDrawTabs :
+	Beapi.btabview -> (unit -> Beapi.brect) -> unit =
+	"btabview_setDrawTabs"
+external btabview_setKeyDown :
+	Beapi.btabview -> (string -> int -> unit) -> unit =
+	"btabview_setKeyDown"
+external btabview_setMouseDown :
+	Beapi.btabview -> (Beapi.bpoint -> unit) -> unit =
+	"btabview_setMouseDown"
+external btabview_setWindowActivated :
+	Beapi.btabview -> (bool -> unit) -> unit =
+	"btabview_setWindowActivated"
+external btabview_AddTab :
+	Beapi.btabview -> Beapi.bview -> Beapi.btab -> unit =
+	"btabview_AddTab"
+external btabview_RemoveTab :
+	Beapi.btabview -> int -> Beapi.btab =
+	"btabview_RemoveTab"
+external btabview_MakeFocus :
+	Beapi.btabview -> bool -> unit =
+	"btabview_MakeFocus"
+external btabview_Select :
+	Beapi.btabview -> int -> unit =
+	"btabview_Select"
+external btabview_Selection :
+	Beapi.btabview -> int =
+	"btabview_Selection"
+external btabview_SetFocusTab :
+	Beapi.btabview -> int -> bool -> unit =
+	"btabview_SetFocusTab"
+external btabview_FocusTab :
+	Beapi.btabview -> int =
+	"btabview_FocusTab"
+external btabview_SetTabHeight :
+	Beapi.btabview -> float -> unit =
+	"btabview_SetTabHeight"
+external btabview_TabHeight :
+	Beapi.btabview -> float =
+	"btabview_TabHeight"
+external btabview_SetTabWidth :
+	Beapi.btabview -> Beapi.button_width -> unit =
+	"btabview_SetTabWidth"
+external btabview_TabWidth :
+	Beapi.btabview -> Beapi.button_width =
+	"btabview_TabWidth"
+external btabview_TabAt :
+	Beapi.btabview -> int -> Beapi.btab =
+	"btabview_TabAt"
+external btabview_TabFrame :
+	Beapi.btabview -> int -> Beapi.brect =
+	"btabview_TabFrame"
+
+
+
+let btabview ?width ?archive ?tabView ?frame ?resizingMode ?flags ?name () =
+	match width, archive, tabView, frame, resizingMode, flags, name with
+	| Some width, None, None, Some frame, Some resizingMode, Some flags, Some name -> btabview_constructor_1 frame name width resizingMode flags
+	(*| None, None, Some tabView, None, None, None, None -> btabview_constructor_2 tabView*)
+	| None, Some archive, None, None, None, None, None -> btabview_constructor_3 archive
+	| _, _, _, _, _, _, _ -> invalid_arg "Wrong arg in BTabView.constructor"
+
+
+let setAttachedToWindow ~self ~cb () =
+	btabview_setAttachedToWindow self cb
+
+let setDraw ~self ~cb () =
+	btabview_setDraw self cb
+
+let setDrawBox ~self ~cb () =
+	btabview_setDrawBox self cb
+
+let setDrawTabs ~self ~cb () =
+	btabview_setDrawTabs self cb
+
+let setKeyDown ~self ~cb () =
+	btabview_setKeyDown self cb
+
+let setMouseDown ~self ~cb () =
+	btabview_setMouseDown self cb
+
+let setWindowActivated ~self ~cb () =
+	btabview_setWindowActivated self cb
+
+let add_tab ~self ~target ~tab () =
+	btabview_AddTab self target tab
+
+let remove_tab ~self ~tab_index () =
+	btabview_RemoveTab self tab_index
+
+let make_focus ~self ~focused () =
+	btabview_MakeFocus self focused
+
+let select ~self ~tab () =
+	btabview_Select self tab
+
+let selection ~self () =
+	btabview_Selection self
+
+let set_focus_tab ~self ~tab ~focused () =
+	btabview_SetFocusTab self tab focused
+
+let focus_tab ~self () =
+	btabview_FocusTab self
+
+let set_tab_height ~self ~height () =
+	btabview_SetTabHeight self height
+
+let tab_height ~self () =
+	btabview_TabHeight self
+
+let set_tab_width ~self ~width () =
+	btabview_SetTabWidth self width
+
+let tab_width ~self () =
+	btabview_TabWidth self
+
+let tab_at ~self ~tab_index () =
+	btabview_TabAt self tab_index
+
+let tab_frame ~self ~tab_index () =
+	btabview_TabFrame self tab_index
+
+class btabview ?width ?archive ?tabView ?frame ?resizingMode
+               ?flags ?name ?external_pointer () =
+  object (self)
+    val pointer =
+      match external_pointer with
+      | Some p -> p
+      | None ->
+          match width, archive, tabView, frame, resizingMode, flags, name with
+          | Some width, None, None, Some frame,
+            Some resizingMode, Some flags, Some name ->
+              btabview_constructor_1 frame name width resizingMode flags
+          (*| None, None, Some tabView, None, None, None, None ->
+              btabview_constructor_2 tabView*)
+          | None, Some archive, None, None, None, None, None ->
+              btabview_constructor_3 archive
+          | _, _, _, _, _, _, _ ->
+              invalid_arg "Wrong arg in BTabView.constructor"
+
+     method get_pointer = pointer
+
+     method setAttachedToWindow cb =
+       btabview_setAttachedToWindow pointer cb
+
+     method setDraw cb =
+       btabview_setDraw pointer cb
+
+     method setDrawBox cb =
+       btabview_setDrawBox pointer cb
+
+     method setDrawTabs cb =
+       btabview_setDrawTabs pointer cb
+
+     method setKeyDown cb =
+       btabview_setKeyDown pointer cb
+
+     method setMouseDown cb =
+       btabview_setMouseDown pointer cb
+
+     method setWindowActivated cb =
+       btabview_setWindowActivated pointer cb
+
+     method add_tab ~target ~tab () =
+       btabview_AddTab pointer target tab
+
+     method remove_tab ~tab_index () =
+       btabview_RemoveTab pointer tab_index
+
+     method make_focus ~focused () =
+       btabview_MakeFocus pointer focused
+
+     method select ~tab () =
+       btabview_Select pointer tab
+
+     method selection () =
+       btabview_Selection pointer
+
+     method set_focusTab ~tab ~focused () =
+       btabview_SetFocusTab pointer tab focused
+
+     method focus_tab () =
+       btabview_FocusTab pointer
+
+     method set_tab_height ~height () =
+       btabview_SetTabHeight pointer height
+
+     method tab_height () =
+       btabview_TabHeight pointer
+
+     method set_tab_width ~width () =
+       btabview_SetTabWidth pointer width
+
+     method tab_width () =
+       btabview_TabWidth pointer
+
+     method tab_at ~tab_index () =
+       btabview_TabAt pointer tab_index
+
+     method tab_frame ~tab_index () =
+       btabview_TabFrame pointer tab_index
+
+end
 type bpoint
 type brect
 type bstring
+type btab
+type btabview
 type bview
 type bwindow
 
 type app_info
 type bigtime_t
+type button_width =
+	| B_WIDTH_AS_USUAL
 type color_space
 type entry_ref
 type status_t
 type ssize_t
+type tab_position
 type thread_id
 type type_code
 
 	| B_BORDERED_WINDOW
 	| B_UNTYPED_WINDOW
 
+let b_FOLLOW_ALL = 1
 let b_FOLLOW_ALL_SIDES = 4660
 let b_WILL_DRAW = 536870912
 
 external bview_of_bbutton :
 	bbutton -> bview =
 	"bview_of_bbutton"
+external bview_of_btabview :
+	btabview -> bview =
+	"bview_of_btabview"

File btab.ml

-external btab_constructor_1 :
-	bview -> btab =
-	"btab_constructor_1"
-external btab_constructor_2 :
-	bmessage -> btab =
-	"btab_constructor_2"
-external btab_setDrawFocusMark :
-	btab -> 'a -> unit =
-	"btab_setDrawFocusMark"
-external btab_setDrawTab :
-	btab -> 'a -> unit =
-	"btab_setDrawTab"
-external btab_setDrawLabel :
-	btab -> 'a -> unit =
-	"btab_setDrawLabel"
-external btab_Archive :
-	btab -> bmessage -> bool -> status_t =
-	"btab_Archive"
-external btab_IsEnabled :
-	btab -> bool =
-	"btab_IsEnabled"
-external btab_SetEnabled :
-	btab -> bool -> unit =
-	"btab_SetEnabled"
-external btab_IsSelected :
-	btab -> bool =
-	"btab_IsSelected"
-external btab_Deselect :
-	btab -> unit =
-	"btab_Deselect"
-external btab_Select :
-	btab -> bview -> unit =
-	"btab_Select"
-external btab_Label :
-	btab -> string =
-	"btab_Label"
-external btab_SetLabel :
-	btab -> string -> unit =
-	"btab_SetLabel"
-external btab_IsFocus :
-	btab -> bool =
-	"btab_IsFocus"
-external btab_MakeFocus :
-	btab -> bool -> unit =
-	"btab_MakeFocus"
-external btab_View :
-	btab -> bview =
-	"btab_View"
-external btab_SetView :
-	btab -> bview -> unit =
-	"btab_SetView"
-module BTab =
-struct
-	let constructor ?archive ?tabView () =
-		match archive, tabView with
-		| None, Some tabView -> btab_constructor_1 tabView
-		| Some archive, None -> btab_constructor_2 archive
-		| None, None -> invalid_arg "Wrong arg in BTab.constructor"
-
-
-	let setDrawFocusMark ~self ~cb () =
-		btab_setDrawFocusMark self cb
-
-	let setDrawTab ~self ~cb () =
-		btab_setDrawTab self cb
-
-	let setDrawLabel ~self ~cb () =
-		btab_setDrawLabel self cb
-
-	let btab_Archive ~self ~archive ~deep () =
-		btab_Archive self archive deep
-
-	let btab_IsEnabled ~self () =
-		btab_IsEnabled self
-
-	let btab_SetEnabled ~self ~enabled () =
-		btab_SetEnabled self enabled
-
-	let btab_IsSelected ~self () =
-		btab_IsSelected self
-
-	let btab_Deselect ~self () =
-		btab_Deselect self
-
-	let btab_Select ~self ~owner () =
-		btab_Select self owner
-
-	let btab_Label ~self () =
-		btab_Label self
-
-	let btab_SetLabel ~self ~label () =
-		btab_SetLabel self label
-
-	let btab_IsFocus ~self () =
-		btab_IsFocus self
-
-	let btab_MakeFocus ~self ~inFocus () =
-		btab_MakeFocus self inFocus
-
-	let btab_View ~self () =
-		btab_View self
-
-	let btab_SetView ~self ~view () =
-		btab_SetView self view
-
-end

File btabview.ml

-external btabview_constructor_1 :
-	brect -> string -> button_width -> int -> int -> btabview =
-	"btabview_constructor_1"
-external btabview_constructor_2 :
-	btabview& -> btabview =
-	"btabview_constructor_2"
-external btabview_constructor_3 :
-	bmessage -> btabview =
-	"btabview_constructor_3"
-external btabview_setAttachedToWindow :
-	btabview -> 'a -> unit =
-	"btabview_setAttachedToWindow"
-external btabview_setDraw :
-	btabview -> 'a -> unit =
-	"btabview_setDraw"
-external btabview_setDrawBox :
-	btabview -> 'a -> unit =
-	"btabview_setDrawBox"
-external btabview_setDrawTabs :
-	btabview -> 'a -> unit =
-	"btabview_setDrawTabs"
-external btabview_setKeyDown :
-	btabview -> 'a -> unit =
-	"btabview_setKeyDown"
-external btabview_setMouseDown :
-	btabview -> 'a -> unit =
-	"btabview_setMouseDown"
-external btabview_setWindowActivated :
-	btabview -> 'a -> unit =
-	"btabview_setWindowActivated"
-external btabview_AddTab :
-	btabview -> bview -> btab -> unit =
-	"btabview_AddTab"
-external btabview_RemoveTab :
-	btabview -> int -> btab =
-	"btabview_RemoveTab"
-external btabview_MakeFocus :
-	btabview -> bool -> unit =
-	"btabview_MakeFocus"
-external btabview_Select :
-	btabview -> int -> unit =
-	"btabview_Select"
-external btabview_Selection :
-	btabview -> int =
-	"btabview_Selection"
-external btabview_SetFocusTab :
-	btabview -> int -> bool -> unit =
-	"btabview_SetFocusTab"
-external btabview_FocusTab :
-	btabview -> int =
-	"btabview_FocusTab"
-external btabview_SetTabHeight :
-	btabview -> float -> unit =
-	"btabview_SetTabHeight"
-external btabview_TabHeight :
-	btabview -> float =
-	"btabview_TabHeight"
-external btabview_SetTabWidth :
-	btabview -> button_width -> unit =
-	"btabview_SetTabWidth"
-external btabview_TabWidth :
-	btabview -> button_width =
-	"btabview_TabWidth"
-external btabview_TabAt :
-	btabview -> int -> btab =
-	"btabview_TabAt"
-external btabview_TabFrame :
-	btabview -> int -> brect =
-	"btabview_TabFrame"
-module BTabView =
-struct
-	let constructor ?width ?archive ?tabView ?frame ?resizingMode ?flags ?name () =
-		match width, archive, tabView, frame, resizingMode, flags, name with
-		| Some width, None, None, Some frame, Some resizingMode, Some flags, Some name -> btabview_constructor_1 frame name width resizingMode flags
-		| None, None, Some tabView, None, None, None, None -> btabview_constructor_2 tabView
-		| None, Some archive, None, None, None, None, None -> btabview_constructor_3 archive
-		| None, None, None, None, None, None, None -> invalid_arg "Wrong arg in BTabView.constructor"
-
-
-	let setAttachedToWindow ~self ~cb () =
-		btabview_setAttachedToWindow self cb
-
-	let setDraw ~self ~cb () =
-		btabview_setDraw self cb
-
-	let setDrawBox ~self ~cb () =
-		btabview_setDrawBox self cb
-
-	let setDrawTabs ~self ~cb () =
-		btabview_setDrawTabs self cb
-
-	let setKeyDown ~self ~cb () =
-		btabview_setKeyDown self cb
-
-	let setMouseDown ~self ~cb () =
-		btabview_setMouseDown self cb
-
-	let setWindowActivated ~self ~cb () =
-		btabview_setWindowActivated self cb
-
-	let btabview_AddTab ~self ~target ~tab () =
-		btabview_AddTab self target tab
-
-	let btabview_RemoveTab ~self ~tab_index () =
-		btabview_RemoveTab self tab_index
-
-	let btabview_MakeFocus ~self ~focused () =
-		btabview_MakeFocus self focused
-
-	let btabview_Select ~self ~tab () =
-		btabview_Select self tab
-
-	let btabview_Selection ~self () =
-		btabview_Selection self
-
-	let btabview_SetFocusTab ~self ~tab ~focused () =
-		btabview_SetFocusTab self tab focused
-
-	let btabview_FocusTab ~self () =
-		btabview_FocusTab self
-
-	let btabview_SetTabHeight ~self ~height () =
-		btabview_SetTabHeight self height
-
-	let btabview_TabHeight ~self () =
-		btabview_TabHeight self
-
-	let btabview_SetTabWidth ~self ~width () =
-		btabview_SetTabWidth self width
-
-	let btabview_TabWidth ~self () =
-		btabview_TabWidth self
-
-	let btabview_TabAt ~self ~tab_index () =
-		btabview_TabAt self tab_index
-
-	let btabview_TabFrame ~self ~tab_index () =
-		btabview_TabFrame self tab_index
-
-end
     val message_received = fun message -> print_endline "button clicked"
     initializer
       self#setMessageReceived message_received ;
+      let tabview =
+        new BTabView.btabview ~frame:(self#bounds ()) ~name:"Test Tabs"
+                              ~width:Beapi.B_WIDTH_AS_USUAL
+                              ~resizingMode:Beapi.b_FOLLOW_ALL
+                              ~flags:(Beapi.b_WILL_DRAW) () in
+      self#add_child ~aView:(Beapi.bview_of_btabview tabview#get_pointer)
+                     ~sibling:(BView.null ()) () ;
       let view =
-        BView.bview ~frame:(self#bounds ()) ~name:"Hello, Gaiku"
+        BView.bview ~frame:(self#bounds ()) ~name:"Hello, Haiku"
                     ~resizingMode:Beapi.b_FOLLOW_ALL_SIDES
                     ~flags:Beapi.b_WILL_DRAW () in
-      self#add_child ~aView:view ~sibling:(BView.null ()) () ;
+      tabview#add_tab ~target:view ~tab:(BTab.null ()) () ;
       let button =
         BButton.bbutton ~frame:(BView.bounds ~self:view ())
                         ~name:"Hello" ~label:"Hello"