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