Added rbTone and rbPulse - Radio Buttons

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@583 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Phil Greenway
2002-08-05 02:27:50 +00:00
parent 151edf0672
commit 6c657a0ed5
+83 -62
View File
@@ -19,6 +19,7 @@ ModemWindow by Sikosis ([email protected])
#include <MenuItem.h> #include <MenuItem.h>
#include <OutlineListView.h> #include <OutlineListView.h>
#include <Point.h> #include <Point.h>
#include <RadioButton.h>
#include <Shape.h> #include <Shape.h>
#include <stdio.h> #include <stdio.h>
#include <TextControl.h> #include <TextControl.h>
@@ -39,75 +40,91 @@ const uint32 MENU = 'Menu';
const uint32 CHK_MAKE_CONNECTION = 'CKMC'; const uint32 CHK_MAKE_CONNECTION = 'CKMC';
const uint32 CHK_SHOW_TERMINAL = 'CKST'; const uint32 CHK_SHOW_TERMINAL = 'CKST';
const uint32 CHK_LOG_ALL = 'CKLA'; const uint32 CHK_LOG_ALL = 'CKLA';
const uint32 RB_TONE_DIALING = 'RBTn';
const uint32 RB_PULSE_DIALING = 'RBPd';
// ModemWindow -- constructor for ModemWindow Class // ModemWindow -- constructor for ModemWindow Class
ModemWindow::ModemWindow(BRect frame) : BWindow (frame, "", B_MODAL_WINDOW, B_NOT_RESIZABLE , 0) ModemWindow::ModemWindow(BRect frame) : BWindow (frame, "", B_MODAL_WINDOW, B_NOT_RESIZABLE , 0)
{ {
InitWindow(); InitWindow();
Show(); Show();
} }
// ------------------------------------------------------------------------------- // // ------------------------------------------------------------------------------- //
// ModemWindow::InitWindow -- Initialization Commands here // ModemWindow::InitWindow -- Initialization Commands here
void ModemWindow::InitWindow(void) void ModemWindow::InitWindow(void)
{ {
BRect r; BRect r;
r = Bounds(); r = Bounds();
// Buttons // Buttons
BRect btn1(10,r.bottom - 34,83,r.bottom - 16); BRect btn1(10,r.bottom - 34,83,r.bottom - 16);
BRect btn2(108,r.bottom - 34,184,r.bottom - 16); BRect btn2(108,r.bottom - 34,184,r.bottom - 16);
BRect btn3(196,r.bottom - 34,271,r.bottom - 16); BRect btn3(196,r.bottom - 34,271,r.bottom - 16);
btnModemWindowCustom = new BButton(btn1,"Custom"," Custom ... ", new BMessage(BTN_MODEM_WINDOW_CUSTOM), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); btnModemWindowCustom = new BButton(btn1,"Custom"," Custom ... ", new BMessage(BTN_MODEM_WINDOW_CUSTOM), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
btnModemWindowCancel = new BButton(btn2,"Cancel"," Cancel ", new BMessage(BTN_MODEM_WINDOW_CANCEL), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); btnModemWindowCancel = new BButton(btn2,"Cancel"," Cancel ", new BMessage(BTN_MODEM_WINDOW_CANCEL), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
btnModemWindowDone = new BButton(btn3,"Done"," Done ", new BMessage(BTN_MODEM_WINDOW_DONE), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); btnModemWindowDone = new BButton(btn3,"Done"," Done ", new BMessage(BTN_MODEM_WINDOW_DONE), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
// YourModemIs MenuField // YourModemIs MenuField
BRect mfld1(15,20,350,30); BRect mfld1(15,20,350,30);
BMenuItem *menu[100]; BMenuItem *menu[100];
YourModemIsMenu = new BMenu("<Pick One> "); YourModemIsMenu = new BMenu("<Pick One> ");
YourModemIsMenu->AddSeparatorItem(); YourModemIsMenu->AddSeparatorItem();
YourModemIsMenu->AddItem(menu[1] = new BMenuItem("New...", new BMessage(MENU))); YourModemIsMenu->AddItem(menu[1] = new BMenuItem("New...", new BMessage(MENU)));
menu[1]->SetTarget(be_app); menu[1]->SetTarget(be_app);
YourModemIsMenuField = new BMenuField(mfld1,"yourmodem_menufield","Your modem is:",YourModemIsMenu,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); YourModemIsMenuField = new BMenuField(mfld1,"yourmodem_menufield","Your modem is:",YourModemIsMenu,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
YourModemIsMenuField->SetDivider(76); YourModemIsMenuField->SetDivider(76);
YourModemIsMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); YourModemIsMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// ConnectVia MenuField // ConnectVia MenuField
BRect mfld2(28,45,350,55); BRect mfld2(28,45,350,55);
BMenuItem *menu2[100]; BMenuItem *menu2[100];
ConnectViaMenu = new BMenu("serial 1 "); ConnectViaMenu = new BMenu("serial 1 ");
//ConnectViaMenu->AddSeparatorItem();
ConnectViaMenu->AddItem(menu2[1] = new BMenuItem("serial 2 ", new BMessage(MENU)));
menu2[1]->SetTarget(be_app);
ConnectViaMenuField = new BMenuField(mfld2,"connectvia_menufield","Connect via:",ConnectViaMenu,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
ConnectViaMenuField->SetDivider(63);
ConnectViaMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// Speed MenuField //ConnectViaMenu->AddSeparatorItem();
BRect mfld3(54,70,350,80); ConnectViaMenu->AddItem(menu2[1] = new BMenuItem("serial 2 ", new BMessage(MENU)));
BMenuItem *menu3[100]; menu2[1]->SetTarget(be_app);
SpeedMenu = new BMenu("9600 "); ConnectViaMenuField = new BMenuField(mfld2,"connectvia_menufield","Connect via:",ConnectViaMenu,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
SpeedMenu->AddItem(menu3[1] = new BMenuItem("19200 ", new BMessage(MENU))); ConnectViaMenuField->SetDivider(63);
menu3[1]->SetTarget(be_app); ConnectViaMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SpeedMenuField = new BMenuField(mfld3,"speed_menufield","Speed:",SpeedMenu,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
SpeedMenuField->SetDivider(37); // Speed MenuField
SpeedMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); BRect mfld3(54,70,350,80);
BMenuItem *menu3[100];
SpeedMenu = new BMenu("9600 ");
SpeedMenu->AddItem(menu3[1] = new BMenuItem("19200 ", new BMessage(MENU)));
menu3[1]->SetTarget(be_app);
SpeedMenuField = new BMenuField(mfld3,"speed_menufield","Speed:",SpeedMenu,B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
SpeedMenuField->SetDivider(37);
SpeedMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// TextView - Redial // TextView - Redial
BRect RedialLocation (15,112,350,132); BRect RedialLocation (15,112,350,132);
tvRedial = new BTextView(r, "Redial", RedialLocation, B_FOLLOW_ALL, B_WILL_DRAW); tvRedial = new BTextView(r, "Redial", RedialLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvRedial->SetText("Redial"); tvRedial->SetText("Redial");
tvRedial->MakeSelectable(false); tvRedial->MakeSelectable(false);
tvRedial->MakeEditable(false); tvRedial->MakeEditable(false);
// TextView - Use:
BRect UseLocation (15,142,40,154);
tvUse = new BTextView(r, "Use", UseLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvUse->SetText("Use:");
tvUse->MakeSelectable(false);
tvUse->MakeEditable(false);
// RadioButton - Use Tone or Pulse
BRect RBToneLocation(42,140,350,152);
rbTone = new BRadioButton(RBToneLocation,"Tone","Tone dialing", new BMessage(RB_TONE_DIALING), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
BRect RBPulseLocation(125,140,350,152);
rbPulse = new BRadioButton(RBPulseLocation,"Pulse","Pulse dialing", new BMessage(RB_PULSE_DIALING), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
// TextView - TimesBusySignal // TextView - TimesBusySignal
BRect TimesBusySignalLocation (82,112,400,132); BRect TimesBusySignalLocation (82,112,400,132);
tvTimesBusySignal = new BTextView(r, "TimesBusySignal", TimesBusySignalLocation, B_FOLLOW_ALL, B_WILL_DRAW); tvTimesBusySignal = new BTextView(r, "TimesBusySignal", TimesBusySignalLocation, B_FOLLOW_ALL, B_WILL_DRAW);
tvTimesBusySignal->SetText("time(s) on busy signal"); tvTimesBusySignal->SetText("time(s) on busy signal");
tvTimesBusySignal->MakeSelectable(false); tvTimesBusySignal->MakeSelectable(false);
tvTimesBusySignal->MakeEditable(false); tvTimesBusySignal->MakeEditable(false);
// TextView - ReadLogPath // TextView - ReadLogPath
BRect ReadLogPathLocation (32,238,350,258); BRect ReadLogPathLocation (32,238,350,258);
tvReadLogPath = new BTextView(r, "ReadLogPath", ReadLogPathLocation, B_FOLLOW_ALL, B_WILL_DRAW); tvReadLogPath = new BTextView(r, "ReadLogPath", ReadLogPathLocation, B_FOLLOW_ALL, B_WILL_DRAW);
@@ -147,11 +164,14 @@ void ModemWindow::InitWindow(void)
AddChild(chkMakeConnection); AddChild(chkMakeConnection);
AddChild(chkShowTerminal); AddChild(chkShowTerminal);
AddChild(chkLogAll); AddChild(chkLogAll);
AddChild(rbPulse);
AddChild(rbTone);
AddChild(tvUse);
AddChild(tvRedial); AddChild(tvRedial);
AddChild(tvTimesBusySignal); AddChild(tvTimesBusySignal);
AddChild(tvReadLogPath); AddChild(tvReadLogPath);
AddChild(tvWriteLogPath); AddChild(tvWriteLogPath);
btnModemWindowDone->MakeDefault(true); btnModemWindowDone->MakeDefault(true);
// Add the Drawing View // Add the Drawing View
@@ -162,24 +182,25 @@ void ModemWindow::InitWindow(void)
// ModemWindow::~ModemWindow -- destructor // ModemWindow::~ModemWindow -- destructor
ModemWindow::~ModemWindow() ModemWindow::~ModemWindow()
{ {
exit(0); exit(0);
} }
// ------------------------------------------------------------------------------- // // ------------------------------------------------------------------------------- //
// ModemWindow::MessageReceived -- receives messages // ModemWindow::MessageReceived -- receives messages
void ModemWindow::MessageReceived (BMessage *message) void ModemWindow::MessageReceived (BMessage *message)
{ {
switch(message->what) switch(message->what)
{ {
case BTN_MODEM_WINDOW_DONE: case BTN_MODEM_WINDOW_DONE:
Quit(); // debugging purposes Quit(); // debugging purposes
break; break;
case BTN_MODEM_WINDOW_CANCEL: case BTN_MODEM_WINDOW_CANCEL:
Hide(); // must find a better way to close this window and not the entire application Hide(); // must find a better way to close this window and not the entire application
break; // any suggestions would be greatly appreciated ;)
default: break;
BWindow::MessageReceived(message); default:
break; BWindow::MessageReceived(message);
} break;
}
} }
// end // end