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