xref: /haiku/src/apps/poorman/PoorManSiteView.cpp (revision f2b4344867e97c3f4e742a1b4a15e6879644601a)
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",
65 		STR_TXT_DIRECTORY, NULL, NULL);
66 	webDir->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
67 	webDir->SetDivider(80.0);
68 	SetWebDir(win->WebDir());
69 	webSiteLocation->AddChild(webDir);
70 
71 	// Select Web Directory Button
72 	BRect selectWebDirRect;
73 
74 	selectWebDirRect.top = webSiteLocationRect.bottom + 5.0;
75 	selectWebDirRect.right = webSiteLocationRect.right + 2.0;
76 	selectWebDirRect.left = selectWebDirRect.right
77 		- webSiteLocation->StringWidth("Select Web Dir") - 24.0;
78 	selectWebDirRect.bottom = selectWebDirRect.top + 19.0;
79 
80 	selectWebDir = new BButton(selectWebDirRect, "Select Web Dir",
81 		STR_BTN_DIRECTORY, new BMessage(MSG_PREF_SITE_BTN_SELECT));
82 	webSiteLocation->AddChild(selectWebDir);
83 
84 	// Index File Name Text Control
85 	//webDirRect.InsetBy(10.0, 7.0);
86 	webSiteLocationRect.top += 63.0;
87 	webSiteLocationRect.bottom = webSiteLocationRect.top + 19.0;
88 
89 	indexFileName = new BTextControl(webSiteLocationRect,
90 		"Index File Name", STR_TXT_INDEX, NULL, NULL);
91 	indexFileName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
92 	indexFileName->SetDivider(80.0);
93 	SetIndexFileName(win->IndexFileName());
94 	webSiteLocation->AddChild(indexFileName);
95 
96 }
97