xref: /haiku/src/preferences/screensaver/Constants.h (revision cbe35e2031cb2bfb757422f35006bb9bd382bed1)
1 #ifndef __CONSTANTS__
2 #define __CONSTANTS__
3 
4 int secondsToSlider(int val);
5 
6 inline BPoint
7 scaleDirect(float x, float y,BRect area)
8 {
9 	return BPoint(area.Width()*x+area.left,area.Height()*y+area.top);
10 }
11 
12 
13 inline BRect scaleDirect (float x1,float x2,float y1,float y2,BRect area)
14 {
15 	return BRect(area.Width()*x1+area.left,area.Height()*y1+area.top, area.Width()*x2+area.left,area.Height()*y2+area.top);
16 }
17 
18 static const float kPositionalX[]= {0,.1,.25,.3,.7,.75,.9,1.0};
19 static const float kPositionalY[]= {0,.1,.7,.8,.9,1.0};
20 
21 inline BPoint
22 scale(int x, int y,BRect area)
23 {
24 	return scaleDirect(kPositionalX[x],kPositionalY[y],area);
25 }
26 
27 
28 inline BRect
29 scale(int x1, int x2, int y1, int y2,BRect area)
30 {
31 	return scaleDirect(kPositionalX[x1],kPositionalX[x2],kPositionalY[y1],kPositionalY[y2],area);
32 }
33 
34 
35 inline BPoint
36 scale3(int x, int y,BRect area,bool invertX,bool invertY)
37 {
38 	float arrowX[]= {0,.25,.5,.66667,.90,.9};
39 	float arrowY[]= {0,.15,.25,.3333333,.6666667,1.0};
40 
41 	return scaleDirect(((invertX)?1-arrowX[x]:arrowX[x]),((invertY)?1-arrowY[y]:arrowY[y]),area);
42 }
43 
44 
45 
46 const int32 kTab1_chg       ='TAB1';
47 const int32 kTab2_chg       ='TAB2';
48 const int32 kPwbutton       ='PWBT';
49 const int32 kDone_clicked   ='DONE';
50 const int32 kCancel_clicked ='CNCL';
51 const int32 kButton_changed ='BTNC';
52 const int32 kShow           ='SHOW';
53 const int32 kPopulate       ='POPU';
54 const int32 kUtilize        ='UTIL';
55 const int32 kSaver_sel      ='SSEL';
56 const int32 kTest_btn       ='TEST';
57 const int32 kAdd_btn        ='ADD ';
58 const int32 kUpdatelist     ='UPDL';
59 const int32 kPasswordCheckbox = 'PWCB';
60 const int32 kRunSliderChanged = 'RSCG';
61 const int32 kPasswordSliderChanged = 'PWCG';
62 const int32 kTurnOffSliderChanged = 'TUCG';
63 const int32 kEnableScreenSaverChanged = 'ESCH';
64 
65 const rgb_color kBlack      = {0,0,0,0};
66 const rgb_color kDarkGrey   = {150,150,150,0};
67 const rgb_color kGrey       = {200,200,200,0};
68 const rgb_color kLightBlue  = {200,200,255,0};
69 const rgb_color kLightGreen = {255,200,200,0};
70 
71 
72 #endif
73