1 /* PoorManAdvancedView.cpp 2 * 3 * Philip Harrison 4 * Started: 5/12/2004 5 * Version: 0.1 6 */ 7 8 #include <Box.h> 9 10 #include "constants.h" 11 #include "PoorManAdvancedView.h" 12 #include "PoorManWindow.h" 13 #include "PoorManApplication.h" 14 15 PoorManAdvancedView::PoorManAdvancedView(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 // Console Logging BBox 24 BRect maxRect; 25 maxRect = rect; 26 maxRect.top -= 5.0; 27 maxRect.left -= 5.0; 28 maxRect.right -= 7.0; 29 maxRect.bottom -= 118.0; 30 31 BBox * connectionOptions = new BBox(maxRect, "Connection Options"); 32 connectionOptions->SetLabel(STR_BBX_CONNECTION); 33 AddChild(connectionOptions); 34 35 BRect sliderRect; 36 sliderRect = connectionOptions->Bounds(); 37 sliderRect.InsetBy(10.0f, 10.0f); 38 sliderRect.top += 10; 39 sliderRect.bottom = sliderRect.top + 50.0; 40 41 maxConnections = new StatusSlider(sliderRect, "Max Slider", STR_SLD_LABEL, 42 STR_SLD_STATUS_LABEL, new BMessage(MSG_PREF_ADV_SLD_MAX_CONNECTION), 1, 200); 43 44 // labels below the slider 1 and 200 45 maxConnections->SetLimitLabels("1", "200"); 46 SetMaxSimutaneousConnections(win->MaxConnections()); 47 connectionOptions->AddChild(maxConnections); 48 } 49 50 void 51 PoorManAdvancedView::SetMaxSimutaneousConnections(int32 num) 52 { 53 if (num <= 0 || num > 200) 54 maxConnections->SetValue(32); 55 else 56 maxConnections->SetValue(num); 57 } 58