xref: /haiku/src/apps/poorman/PoorManSiteView.cpp (revision 4f2fd49bdc6078128b1391191e4edac647044c3d)
1 /* PoorManSiteView.cpp
2  *
3  *	Philip Harrison
4  *	Started: 5/07/2004
5  *	Version: 0.1
6  */
7 
8 #include <Box.h>
9 
10 #include "constants.h"
11 #include "PoorManSiteView.h"
12 #include "PoorManWindow.h"
13 #include "PoorManApplication.h"
14 
15 PoorManSiteView::PoorManSiteView(BRect rect, const char *name)
16 	: BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
17 {
18 	PoorManWindow	*	win;
19 	win = ((PoorManApplication *)be_app)->GetPoorManWindow();
20 
21 	SetViewColor(BACKGROUND_COLOR);
22 
23 	// Web Site Location BBox
24 	BRect webLocationRect;
25 	webLocationRect = rect;
26 	webLocationRect.top -= 5.0;
27 	webLocationRect.left -= 5.0;
28 	webLocationRect.right -= 7.0;
29 	webLocationRect.bottom -= 98.0;
30 
31 	BBox * webSiteLocation = new BBox(webLocationRect, "Web Location");
32 	webSiteLocation->SetLabel(STR_BBX_LOCATION);
33 	AddChild(webSiteLocation);
34 
35 	// Web Site Options BBox
36 	BRect webOptionsRect;
37 	webOptionsRect = webLocationRect;
38 	webOptionsRect.top = webOptionsRect.bottom + 10.0;
39 	webOptionsRect.bottom = webOptionsRect.top + 80.0;
40 
41 	BBox * webSiteOptions = new BBox(webOptionsRect, "Web Options");
42 	webSiteOptions->SetLabel(STR_BBX_OPTIONS);
43 	AddChild(webSiteOptions);
44 
45 	// Send Directory List if No Index
46 	float left = 10.0;
47 	float top = 20.0;
48 	float box_size = 13.0;
49 	BRect sendDirRect(left, top, webOptionsRect.Width() - 5.0, top + box_size);
50 	sendDir = new BCheckBox(sendDirRect, "Send Dir", STR_CBX_DIR_LIST_LABEL, new BMessage(MSG_PREF_SITE_CBX_INDEX));
51 	// set the checkbox to the value the program has
52 	SetSendDirValue(win->DirListFlag());
53 	webSiteOptions->AddChild(sendDir);
54 
55 
56 	// Finish the Web Site Location Section
57 	BRect webSiteLocationRect;
58 	webSiteLocationRect = webLocationRect;
59 	webSiteLocationRect.InsetBy(10.0, 7.0);
60 	webSiteLocationRect.top += 13.0;
61 	webSiteLocationRect.bottom = webSiteLocationRect.top + 19.0;
62 
63 	// Web Directory Text Control
64 	webDir = new BTextControl(webSiteLocationRect, "Web Dir", STR_TXT_DIRECTORY, NULL, NULL);
65 	webDir->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
66 	webDir->SetDivider(80.0);
67 	SetWebDir(win->WebDir());
68 	webSiteLocation->AddChild(webDir);
69 
70 	// Select Web Directory Button
71 	BRect selectWebDirRect;
72 	selectWebDirRect.top = webSiteLocationRect.bottom + 5.0;
73 	selectWebDirRect.right = webSiteLocationRect.right + 2.0;
74 	selectWebDirRect.left = selectWebDirRect.right - 123.0;
75 	selectWebDirRect.bottom = selectWebDirRect.top + 19.0;
76 
77 	selectWebDir = new BButton(selectWebDirRect, "Select Web Dir", STR_BTN_DIRECTORY, new BMessage(MSG_PREF_SITE_BTN_SELECT));
78 	webSiteLocation->AddChild(selectWebDir);
79 
80 	// Index File Name Text Control
81 	//webDirRect.InsetBy(10.0, 7.0);
82 	webSiteLocationRect.top += 63.0;
83 	webSiteLocationRect.bottom = webSiteLocationRect.top + 19.0;
84 
85 	indexFileName = new BTextControl(webSiteLocationRect, "Index File Name", STR_TXT_INDEX, NULL, NULL);
86 	indexFileName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
87 	indexFileName->SetDivider(80.0);
88 	SetIndexFileName(win->IndexFileName());
89 	webSiteLocation->AddChild(indexFileName);
90 
91 }
92