xref: /haiku/src/apps/poorman/PoorManSiteView.cpp (revision ed24eb5ff12640d052171c6a7feba37fab8a75d1)
1 /* PoorManSiteView.cpp
2  *
3  *	Philip Harrison
4  *	Started: 5/07/2004
5  *	Version: 0.1
6  */
7 
8 #include <Box.h>
9 #include <LayoutBuilder.h>
10 
11 #include "constants.h"
12 #include "PoorManSiteView.h"
13 #include "PoorManWindow.h"
14 #include "PoorManApplication.h"
15 
16 PoorManSiteView::PoorManSiteView(const char* name)
17 	: BView(name, B_WILL_DRAW, NULL)
18 {
19 	PoorManWindow* win;
20 	win = ((PoorManApplication *)be_app)->GetPoorManWindow();
21 
22 	SetLayout(new BGroupLayout(B_VERTICAL));
23 
24 	// Web Site Location BBox
25 	BBox* webSiteLocation = new BBox("Web Location");
26 	webSiteLocation->SetLabel(STR_BBX_LOCATION);
27 
28 	// Web Site Options BBox
29 	BBox* webSiteOptions = new BBox("Web Options");
30 	webSiteOptions->SetLabel(STR_BBX_OPTIONS);
31 
32 	// Send Directory List if No Index
33 	fSendDir = new BCheckBox("Send Dir", STR_CBX_DIR_LIST_LABEL,
34 		new BMessage(MSG_PREF_SITE_CBX_INDEX));
35 	// set the checkbox to the value the program has
36 	SetSendDirValue(win->DirListFlag());
37 
38 	// Web Directory Text Control
39 	fWebDir = new BTextControl(STR_TXT_DIRECTORY, NULL, NULL);
40 	SetWebDir(win->WebDir());
41 
42 	// Select Web Directory Button
43 	fSelectWebDir = new BButton("Select Web Dir", STR_BTN_DIRECTORY,
44 		new BMessage(MSG_PREF_SITE_BTN_SELECT));
45 
46 	// Index File Name Text Control
47 	fIndexFileName = new BTextControl(STR_TXT_INDEX, NULL, NULL);
48 	SetIndexFileName(win->IndexFileName());
49 
50 
51 	BGroupLayout* webSiteLocationLayout = new BGroupLayout(B_VERTICAL, 0);
52 	webSiteLocation->SetLayout(webSiteLocationLayout);
53 
54 	BGroupLayout* webSiteOptionsLayout = new BGroupLayout(B_VERTICAL, 0);
55 	webSiteOptions->SetLayout(webSiteOptionsLayout);
56 
57 	BLayoutBuilder::Group<>(this, B_VERTICAL)
58 		.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
59 			B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING)
60 		.AddGroup(webSiteLocationLayout)
61 			.SetInsets(B_USE_ITEM_INSETS)
62 			.AddGrid(B_USE_SMALL_SPACING, B_USE_SMALL_SPACING)
63 				.SetInsets(0, B_USE_ITEM_INSETS, 0, 0)
64 				.AddTextControl(fWebDir, 0, 0, B_ALIGN_LEFT, 1, 2)
65 				.Add(fSelectWebDir, 2, 1)
66 				.AddTextControl(fIndexFileName, 0, 2, B_ALIGN_LEFT, 1, 2)
67 				.SetColumnWeight(1, 10.f)
68 				.End()
69 			.End()
70 		.AddGroup(webSiteOptionsLayout)
71 			.SetInsets(B_USE_ITEM_INSETS)
72 			.AddStrut(B_USE_ITEM_SPACING)
73 			.AddGroup(B_HORIZONTAL)
74 				.SetInsets(0)
75 				.Add(fSendDir)
76 				.AddGlue()
77 				.End()
78 			.AddGlue();
79 }
80