3 DetailsView - View for Details
5 Author: Misza (misza@ihug.com.au)
7 (C) 2002 OpenBeOS under MIT license
12 #include "DetailsView.h"
17 DetailsView::DetailsView() :
18 BView(BRect(40,31,290,157),"detailsview",B_FOLLOW_NONE
,B_WILL_DRAW
)
20 SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR
));
22 BRect btnr
= Bounds();
23 BRect
texties(0,0,239,20);
24 phoneno
= new BTextControl(texties
,"phoneno","Phone number:",NULL
,
25 new BMessage(CHANGE_PHONENO
));
26 phoneno
->SetAlignment(B_ALIGN_RIGHT
,B_ALIGN_LEFT
);
27 phoneno
->SetDivider(80);
30 texties
.OffsetBy(0,24);
31 username
= new BTextControl(texties
,"username","User name:",NULL
,
32 new BMessage(CHANGE_USERNAME
));
33 username
->SetAlignment(B_ALIGN_RIGHT
,B_ALIGN_LEFT
);
34 username
->SetDivider(80);
38 texties
.OffsetBy(0,24);
39 passwd
= new BTextControl(texties
,"passwd","Password:",NULL
,
40 new BMessage(CHANGE_PASSWORD
));
41 passwd
->SetAlignment(B_ALIGN_RIGHT
,B_ALIGN_LEFT
);
42 passwd
->SetDivider(80);
43 //we don't want any people seeing our "3y3lurveBe05" password ;)
44 passwd
->TextView()->HideTyping(true);
47 texties
.OffsetBy(0,24);
49 savepasswd
= new BCheckBox(texties
,"savepasswd","Save Password", new BMessage(SAVEPASSWORD
),B_FOLLOW_LEFT
| B_FOLLOW_TOP
, B_WILL_DRAW
| B_NAVIGABLE
);
50 savepasswd
->SetLabel("Save Password");
55 btnr
.top
= btnr
.bottom
- 24;
56 btnr
.left
= btnr
.right
- 70;
58 settingsbtn
= new BButton(btnr
,"Settings","Settings" B_UTF8_ELLIPSIS
", new BMessage(BTN_SETTINGS), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
59 AddChild(settingsbtn);
61 void DetailsView::MessageReceived(BMessage* msg)
70 cout << "\n\nPhone number
: ";
71 cout << phoneno->Text();
72 cout << "\nUser name
: ";
73 cout << username->Text();
74 cout << "\nPassword
: ";
75 cout << passwd->Text();
76 cout << "\nSave Password
? ";
77 if(savepasswd->Value() == B_CONTROL_ON)
79 cout << "YES
\n" << endl;
81 cout << "NO
\n" << endl;
85 BView::MessageReceived(msg);
89 void DetailsView::AttachedToWindow()
91 phoneno->SetTarget(this);
92 username->SetTarget(this);
93 passwd->SetTarget(this);
94 savepasswd->SetTarget(this);