Ticket #3866: LocalePrefs_layout.diff
File LocalePrefs_layout.diff, 3.6 KB (added by , 16 years ago) |
---|
-
src/preferences/locale/LocaleWindow.cpp
8 8 #include "LocaleWindow.h" 9 9 10 10 #include <Application.h> 11 #include <Button.h> 12 #include <GroupLayout.h> 13 #include <GroupLayoutBuilder.h> 14 #include <ListView.h> 11 15 #include <Screen.h> 16 #include <ScrollView.h> 12 17 #include <TabView.h> 13 #include <ScrollView.h>14 #include <ListView.h>15 #include <Button.h>16 18 17 19 18 20 const static uint32 kMsgSelectLanguage = 'slng'; … … 24 26 : BWindow(rect, "Locale", B_TITLED_WINDOW, 25 27 B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) 26 28 { 27 rect = Bounds(); 28 BView *view = new BView(rect, "view", B_FOLLOW_ALL, 0); 29 view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); 30 AddChild(view); 29 // Buttons at the bottom 31 30 32 BButton *button = new BButton(rect, "defaults", "Defaults", 33 new BMessage(kMsgDefaults), B_FOLLOW_NONE); 34 button->ResizeToPreferred(); 35 button->MoveTo(10, rect.bottom - 10 - button->Bounds().Height()); 36 view->AddChild(button); 31 BButton *button = new BButton("Defaults", new BMessage(kMsgDefaults)); 37 32 38 fRevertButton = new BButton(rect, "revert", "Revert", 39 new BMessage(kMsgRevert), B_FOLLOW_NONE); 40 fRevertButton->ResizeToPreferred(); 41 fRevertButton->MoveTo(20 + button->Bounds().Width(), button->Frame().top); 33 fRevertButton = new BButton("Revert", new BMessage(kMsgRevert)); 42 34 fRevertButton->SetEnabled(false); 43 view->AddChild(fRevertButton);44 35 45 rect.InsetBy(10, 10); 46 rect.bottom -= 10 + button->Bounds().Height(); 47 BTabView *tabView = new BTabView(rect, "tabview"); 36 // Tabs 37 BTabView *tabView = new BTabView("tabview"); 48 38 49 rect = tabView->ContainerView()->Bounds();50 rect.InsetBy(2, 2); 51 BView *tab = new BView( rect, "Language", B_FOLLOW_NONE, B_WILL_DRAW);39 // Language tab 40 41 BView *tab = new BView("Language", B_WILL_DRAW); 52 42 tab->SetViewColor(tabView->ViewColor()); 43 tab->SetLayout(new BGroupLayout(B_VERTICAL,10)); 53 44 tabView->AddTab(tab); 54 45 55 46 { 56 BRect frame = rect; 57 frame.InsetBy(12, 12); 58 frame.right = 100 + B_V_SCROLL_BAR_WIDTH; 59 frame.bottom = 150; 60 61 BListView *listView = new BListView(frame, "preferred", B_SINGLE_SELECTION_LIST, 62 B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); 47 BListView *listView = new BListView("preferred", B_SINGLE_SELECTION_LIST); 63 48 listView->SetSelectionMessage(new BMessage(kMsgSelectLanguage)); 64 49 65 50 BScrollView *scrollView = new BScrollView("scroller", listView, 66 B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER); 67 tab->AddChild(scrollView); 51 0, false, true, B_FANCY_BORDER); 52 tab->AddChild(BGroupLayoutBuilder(B_HORIZONTAL,10) 53 .Add(scrollView) 54 .AddGlue() 55 ); 68 56 } 69 57 70 tab = new BView(rect, "Country", B_FOLLOW_NONE, B_WILL_DRAW); 58 // Country tab 59 60 tab = new BView("Country", B_WILL_DRAW); 71 61 tab->SetViewColor(tabView->ViewColor()); 72 62 tabView->AddTab(tab); 73 63 74 tab = new BView(rect, "Keyboard", B_FOLLOW_NONE, B_WILL_DRAW); 64 // Keyboard tab 65 66 tab = new BView("Keyboard", B_WILL_DRAW); 75 67 tab->SetViewColor(tabView->ViewColor()); 76 68 tabView->AddTab(tab); 77 69 78 view->AddChild(tabView);79 80 70 // check if the window is on screen 81 71 82 72 rect = BScreen().Frame(); … … 90 80 position.y = (rect.Height() - Bounds().Height()) / 2; 91 81 } 92 82 MoveTo(position); 83 84 // Layout management 85 86 SetLayout(new BGroupLayout(B_HORIZONTAL)); 87 88 AddChild(BGroupLayoutBuilder(B_VERTICAL,10) 89 .Add(tabView) 90 .Add(BGroupLayoutBuilder(B_HORIZONTAL,10) 91 .Add(button) 92 .Add(fRevertButton) 93 .AddGlue() 94 ) 95 .SetInsets(5,5,5,5) 96 ); 93 97 } 94 98 95 99