diff --git a/src/prefs/scrollbar/Jamfile b/src/prefs/scrollbar/Jamfile index 0b84253307..f9a63c0102 100644 --- a/src/prefs/scrollbar/Jamfile +++ b/src/prefs/scrollbar/Jamfile @@ -2,6 +2,6 @@ SubDir OBOS_TOP src prefs scrollbar ; AddResources ScrollBar : ScrollBar.rdef ; -Preference ScrollBar : ScrollBar.cpp ScrollBarApp.cpp ScrollBarWindow.cpp ; +Preference ScrollBar : ScrollBar.cpp ScrollBarApp.cpp ScrollBarWindow.cpp ScrollBarView.cpp ; -LinkSharedOSLibs ScrollBar : be root ; +LinkSharedOSLibs ScrollBar : be root libopenbeos.so ; diff --git a/src/prefs/scrollbar/ScrollBarApp.cpp b/src/prefs/scrollbar/ScrollBarApp.cpp index 5fd544ef8b..4e6b06f9cc 100644 --- a/src/prefs/scrollbar/ScrollBarApp.cpp +++ b/src/prefs/scrollbar/ScrollBarApp.cpp @@ -1,5 +1,5 @@ -#include -#include +#include "ScrollBarApp.h" +#include "ScrollBarWindow.h" ScrollBarApp * scroll_bar_app = 0; diff --git a/src/prefs/scrollbar/ScrollBarView.cpp b/src/prefs/scrollbar/ScrollBarView.cpp new file mode 100644 index 0000000000..c1dcbe0c76 --- /dev/null +++ b/src/prefs/scrollbar/ScrollBarView.cpp @@ -0,0 +1,113 @@ +#include "ScrollBarView.h" +#include "messages.h" + +// our own homegrown private cheat function for controlling scrollbars +status_t control_scrollbar(int8 command, void *data, BScrollBar *sb); + +// Magic numbers for control_scrollbar() +#define CONTROL_SET_DOUBLE 1 +#define CONTROL_SET_PROPORTIONAL 2 +#define CONTROL_SET_STYLE 3 + +ScrollBarView::ScrollBarView(void) + : BView(BRect(0,0,348,280),"scrollbarview", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW) +{ + SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) ); + + arrowstyleBox = new BBox( BRect( 12, 7, 169, 119) ); + arrowstyleBox->SetLabel( "Arrow Style" ); + + float doubleWidth = StringWidth("Double:"); + bool tempbool; + int8 tempint; + + doubleStringView = new BStringView( BRect(25,20,25+doubleWidth,38), "doubleStringView", "Double:"); + sbdouble=new BScrollBar(BRect(12,38,145,58),"doublearrowsbar",NULL,0,100,B_HORIZONTAL); + arrowstyleBox->AddChild( sbdouble ); + + tempbool=true; + control_scrollbar(CONTROL_SET_DOUBLE,&tempbool,sbdouble); + + float singleWidth = StringWidth("Single:"); + singleStringView = new BStringView( BRect(25,60,25+singleWidth,87), "singleStringView", "Single:"); + sbsingle=new BScrollBar(BRect(12,82,145,102),"singlearrowsbar",NULL,0,100,B_HORIZONTAL); + arrowstyleBox->AddChild( sbsingle ); + + tempbool=false; + control_scrollbar(CONTROL_SET_DOUBLE,&tempbool,sbsingle); + + + + knobtypeBox = new BBox( BRect( 180, 7, 338, 119) ); + knobtypeBox->SetLabel( "Knob Type" ); + + float proportionalWidth = StringWidth("Proportional"); + proportionalStringView = new BStringView( BRect(193,20,193+proportionalWidth,38), "proportionalStringView", "Proportional" ); + sbproportional=new BScrollBar(BRect(12,38,145,58),"proportionalbar",NULL,0,100,B_HORIZONTAL); + knobtypeBox->AddChild( sbproportional ); + + tempbool=true; + control_scrollbar(CONTROL_SET_PROPORTIONAL, &tempbool,sbdouble); + + float fixedWidth = StringWidth("Fixed"); + fixedStringView = new BStringView( BRect(193,60,193+fixedWidth,87), "fixedStringView", "Fixed" ); + sbfixed=new BScrollBar(BRect(12,87,145,105),"fixedbar",NULL,0,100,B_HORIZONTAL); + knobtypeBox->AddChild( sbfixed ); + + tempbool=false; + control_scrollbar(CONTROL_SET_PROPORTIONAL,&tempbool,sbfixed); + + minknobsizeBox = new BBox( BRect( 12, 123, 169, 232) ); + minknobsizeBox->SetLabel( "Minimum Knob Size" ); + + knobstyleBox = new BBox( BRect( 180, 123, 338, 232) ); + knobstyleBox->SetLabel( "Knob Style" ); + + sbflat=new BScrollBar(BRect(12,22,145,42),"flatbar",NULL,0,100,B_HORIZONTAL); + knobstyleBox->AddChild( sbflat ); + tempint=0; + control_scrollbar(CONTROL_SET_STYLE,&tempbool,sbflat); + + sbdots=new BScrollBar(BRect(12,52,145,72),"dotbar",NULL,0,100,B_HORIZONTAL); + knobstyleBox->AddChild( sbdots ); + tempint=1; + control_scrollbar(CONTROL_SET_STYLE,&tempbool,sbdots); + + sblines=new BScrollBar(BRect(12,82,145,102),"linebar",NULL,0,100,B_HORIZONTAL); + knobstyleBox->AddChild( sblines ); + tempint=2; + control_scrollbar(CONTROL_SET_STYLE,&tempbool,sblines); + + + + defaultsButton = new BButton( BRect( 10, 242, 85, 265), "defaultsButton", "Defaults", NULL ); + revertButton = new BButton( BRect( 95, 242, 170, 265), "revertButton", "Revert", NULL ); + revertButton->SetEnabled( FALSE ); + + AddChild( arrowstyleBox ); + AddChild( doubleStringView ); + AddChild( singleStringView ); + + AddChild( knobtypeBox ); + AddChild( proportionalStringView ); + AddChild( fixedStringView ); + + AddChild( minknobsizeBox ); + AddChild( knobstyleBox ); + + AddChild( defaultsButton ); + AddChild( revertButton ); +} + +ScrollBarView::~ScrollBarView(void) +{ +} + +void ScrollBarView::MessageReceived(BMessage *msg) +{ + switch(msg->what) + { + default: + break; + } +} diff --git a/src/prefs/scrollbar/ScrollBarView.h b/src/prefs/scrollbar/ScrollBarView.h new file mode 100644 index 0000000000..edd98f0a73 --- /dev/null +++ b/src/prefs/scrollbar/ScrollBarView.h @@ -0,0 +1,27 @@ +#ifndef SCROLLBAR_VIEW +#define SCROLLBAR_VIEW + +#include +#include +#include +#include +#include + + +class ScrollBarView : public BView +{ +public: + ScrollBarView(void); + ~ScrollBarView(void); + void MessageReceived(BMessage *msg); + + BBox *arrowstyleBox, *knobtypeBox, *knobstyleBox, *minknobsizeBox; + BStringView *singleStringView,*doubleStringView, *proportionalStringView, + *fixedStringView; + BButton *defaultsButton, *revertButton; + + BScrollBar *sbsingle, *sbdouble, *sbproportional, *sbfixed, + *sbflat, *sbdots, *sblines; +}; + +#endif \ No newline at end of file diff --git a/src/prefs/scrollbar/ScrollBarWindow.cpp b/src/prefs/scrollbar/ScrollBarWindow.cpp index f814bba5f4..0e9740abf2 100644 --- a/src/prefs/scrollbar/ScrollBarWindow.cpp +++ b/src/prefs/scrollbar/ScrollBarWindow.cpp @@ -3,75 +3,15 @@ #include #include #include -#include -#include +#include "ScrollBarWindow.h" +#include "ScrollBarApp.h" +#include "ScrollBarView.h" ScrollBarWindow::ScrollBarWindow(void) : BWindow( BRect(50,50,398,325), "Scroll Bar", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE ) { - BBox* bigBox = new BBox( BRect(0,0,348,275), NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER ); - BView* mainView = new BView( BRect(0,0,348,280),"mainView",B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ); - mainView->SetViewColor( ui_color(B_PANEL_BACKGROUND_COLOR) ); - - BBox* arrowstyleBox = new BBox( BRect( 12, 7, 169, 119) ); - arrowstyleBox->SetLabel( "Arrow Style" ); - char * doubleLabel = "Double:"; - float doubleWidth = mainView->StringWidth(doubleLabel); - BStringView* doubleStringView = new BStringView( BRect(25,20,25+doubleWidth,38), "doubleStringView", doubleLabel ); - BView* doublearrowView = new BView( BRect(24,38,157,58), "doublearrowView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ); - char * singleLabel = "Single:"; - float singleWidth = mainView->StringWidth(singleLabel); - BStringView* singleStringView = new BStringView( BRect(25,60,25+singleWidth,87), "singleStringView", singleLabel ); - BView* singlearrowView = new BView( BRect(24,87,157,107), "singlearrowView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ); - - BBox* knobtypeBox = new BBox( BRect( 180, 7, 338, 119) ); - knobtypeBox->SetLabel( "Knob Type" ); - char * proportionalLabel = "Proportional:"; - float proportionalWidth = mainView->StringWidth(proportionalLabel); - BStringView* proportionalStringView = new BStringView( BRect(193,20,193+proportionalWidth,38), "proportionalStringView", proportionalLabel ); - BView* proportionalknobView = new BView( BRect(192,38,326,58), "proportionalknobView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ); - char * fixedLabel = "Fixed:"; - float fixedWidth = mainView->StringWidth(fixedLabel); - BStringView* fixedStringView = new BStringView( BRect(193,60,193+fixedWidth,87), "fixedStringView", fixedLabel ); - BView* fixedknobView = new BView( BRect(192,87,326,107), "fixedknobView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ); - - - BBox* minknobsizeBox = new BBox( BRect( 12, 123, 169, 232) ); - minknobsizeBox->SetLabel( "Minimum Knob Size" ); - - BBox* knobstyleBox = new BBox( BRect( 180, 123, 338, 232) ); - knobstyleBox->SetLabel( "Knob Style" ); - BView* flatknobView = new BView( BRect(192,142,326,162), "flatknobView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ); - BView* dotknobView = new BView( BRect(192,173,326,193), "dotknobView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ); - BView* lineknobView = new BView( BRect(192,203,326,223), "lineknobView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ); - - BButton* defaultsButton = new BButton( BRect( 10, 242, 85, 265), "defaultsButton", "Defaults", NULL ); - BButton* revertButton = new BButton( BRect( 95, 242, 170, 265), "revertButton", "Revert", NULL ); - revertButton->SetEnabled( FALSE ); - - AddChild( mainView ); - mainView->AddChild( bigBox ); - - mainView->AddChild( arrowstyleBox ); - mainView->AddChild( doubleStringView ); - mainView->AddChild( doublearrowView ); - mainView->AddChild( singleStringView ); - mainView->AddChild( singlearrowView ); - - mainView->AddChild( knobtypeBox ); - mainView->AddChild( proportionalStringView ); - mainView->AddChild( proportionalknobView ); - mainView->AddChild( fixedStringView ); - mainView->AddChild( fixedknobView ); - - mainView->AddChild( minknobsizeBox ); - mainView->AddChild( knobstyleBox ); - mainView->AddChild( flatknobView ); - mainView->AddChild( lineknobView ); - mainView->AddChild( dotknobView ); - - mainView->AddChild( defaultsButton ); - mainView->AddChild( revertButton ); + sbview=new ScrollBarView; + AddChild(sbview); } ScrollBarWindow::~ScrollBarWindow(void) diff --git a/src/prefs/scrollbar/ScrollBarWindow.h b/src/prefs/scrollbar/ScrollBarWindow.h index 9104baad40..b4faabc11a 100644 --- a/src/prefs/scrollbar/ScrollBarWindow.h +++ b/src/prefs/scrollbar/ScrollBarWindow.h @@ -3,11 +3,15 @@ #include +class ScrollBarView; + class ScrollBarWindow : public BWindow { public: ScrollBarWindow(void); virtual ~ScrollBarWindow(void); virtual bool QuitRequested(void); + + ScrollBarView *sbview; }; #endif // SCROLL_BAR_WINDOW_H