1 #include <Application.h> 2 #include <Button.h> 3 #include <TextView.h> 4 #include <List.h> 5 #include <Window.h> 6 7 // include this for ALM 8 #include "XTab.h" 9 #include "YTab.h" 10 #include "Area.h" 11 #include "BALMLayout.h" 12 13 14 class PinwheelWindow : public BWindow { 15 public: 16 PinwheelWindow(BRect frame) 17 : BWindow(frame, "ALM Pinwheel", 18 B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE) 19 { 20 button1 = new BButton("1"); 21 button2 = new BButton("2"); 22 button3 = new BButton("3"); 23 button4 = new BButton("4"); 24 textView1 = new BTextView("textView1"); 25 textView1->SetText("5"); 26 27 // create a new BALMLayout and use it for this window 28 BALMLayout* layout = new BALMLayout(); 29 SetLayout(layout); 30 31 // create extra tabs 32 XTab* x1 = layout->AddXTab(); 33 XTab* x2 = layout->AddXTab(); 34 YTab* y1 = layout->AddYTab(); 35 YTab* y2 = layout->AddYTab(); 36 37 Area* a1 = layout->AddArea( 38 layout->Left(), layout->Top(), 39 x2, y1, 40 button1); 41 Area* a2 = layout->AddArea( 42 x2, layout->Top(), 43 layout->Right(), y2, 44 button2); 45 Area* a3 = layout->AddArea( 46 x1, y2, 47 layout->Right(), layout->Bottom(), 48 button3); 49 Area* a4 = layout->AddArea( 50 layout->Left(), y1, 51 x1, layout->Bottom(), 52 button4); 53 Area* a5 = layout->AddArea( 54 x1, y1, 55 x2, y2, 56 textView1); 57 58 a1->HasSameSizeAs(a3); 59 } 60 61 private: 62 BButton* button1; 63 BButton* button2; 64 BButton* button3; 65 BButton* button4; 66 BTextView* textView1; 67 }; 68 69 70 class Pinwheel : public BApplication { 71 public: 72 Pinwheel() 73 : BApplication("application/x-vnd.haiku.Pinwheel") 74 { 75 BRect frameRect; 76 frameRect.Set(100, 100, 300, 300); 77 PinwheelWindow* window = new PinwheelWindow(frameRect); 78 window->Show(); 79 } 80 }; 81 82 83 int 84 main() 85 { 86 Pinwheel app; 87 app.Run(); 88 return 0; 89 } 90 91