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:
@@ -19,6 +19,7 @@ ModemWindow by Sikosis ([email protected])
|
||||
#include <MenuItem.h>
|
||||
#include <OutlineListView.h>
|
||||
#include <Point.h>
|
||||
#include <RadioButton.h>
|
||||
#include <Shape.h>
|
||||
#include <stdio.h>
|
||||
#include <TextControl.h>
|
||||
@@ -39,75 +40,91 @@ const uint32 MENU = 'Menu';
|
||||
const uint32 CHK_MAKE_CONNECTION = 'CKMC';
|
||||
const uint32 CHK_SHOW_TERMINAL = 'CKST';
|
||||
const uint32 CHK_LOG_ALL = 'CKLA';
|
||||
const uint32 RB_TONE_DIALING = 'RBTn';
|
||||
const uint32 RB_PULSE_DIALING = 'RBPd';
|
||||
|
||||
// ModemWindow -- constructor for ModemWindow Class
|
||||
ModemWindow::ModemWindow(BRect frame) : BWindow (frame, "", B_MODAL_WINDOW, B_NOT_RESIZABLE , 0)
|
||||
{
|
||||
InitWindow();
|
||||
Show();
|
||||
InitWindow();
|
||||
Show();
|
||||
}
|
||||
// ------------------------------------------------------------------------------- //
|
||||
|
||||
// ModemWindow::InitWindow -- Initialization Commands here
|
||||
void ModemWindow::InitWindow(void)
|
||||
{
|
||||
BRect r;
|
||||
r = Bounds();
|
||||
BRect r;
|
||||
r = Bounds();
|
||||
|
||||
// Buttons
|
||||
BRect btn1(10,r.bottom - 34,83,r.bottom - 16);
|
||||
BRect btn2(108,r.bottom - 34,184,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);
|
||||
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);
|
||||
// Buttons
|
||||
BRect btn1(10,r.bottom - 34,83,r.bottom - 16);
|
||||
BRect btn2(108,r.bottom - 34,184,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);
|
||||
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);
|
||||
|
||||
// YourModemIs MenuField
|
||||
BRect mfld1(15,20,350,30);
|
||||
BMenuItem *menu[100];
|
||||
YourModemIsMenu = new BMenu("<Pick One> ");
|
||||
YourModemIsMenu->AddSeparatorItem();
|
||||
YourModemIsMenu->AddItem(menu[1] = new BMenuItem("New...", new BMessage(MENU)));
|
||||
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->SetDivider(76);
|
||||
YourModemIsMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
// YourModemIs MenuField
|
||||
BRect mfld1(15,20,350,30);
|
||||
BMenuItem *menu[100];
|
||||
YourModemIsMenu = new BMenu("<Pick One> ");
|
||||
YourModemIsMenu->AddSeparatorItem();
|
||||
YourModemIsMenu->AddItem(menu[1] = new BMenuItem("New...", new BMessage(MENU)));
|
||||
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->SetDivider(76);
|
||||
YourModemIsMenuField->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
// ConnectVia MenuField
|
||||
BRect mfld2(28,45,350,55);
|
||||
BMenuItem *menu2[100];
|
||||
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));
|
||||
// ConnectVia MenuField
|
||||
BRect mfld2(28,45,350,55);
|
||||
BMenuItem *menu2[100];
|
||||
ConnectViaMenu = new BMenu("serial 1 ");
|
||||
|
||||
// Speed MenuField
|
||||
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));
|
||||
//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
|
||||
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
|
||||
BRect RedialLocation (15,112,350,132);
|
||||
tvRedial = new BTextView(r, "Redial", RedialLocation, B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
tvRedial->SetText("Redial");
|
||||
tvRedial->MakeSelectable(false);
|
||||
tvRedial->MakeEditable(false);
|
||||
|
||||
// TextView - Redial
|
||||
BRect RedialLocation (15,112,350,132);
|
||||
tvRedial = new BTextView(r, "Redial", RedialLocation, B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
tvRedial->SetText("Redial");
|
||||
tvRedial->MakeSelectable(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
|
||||
BRect TimesBusySignalLocation (82,112,400,132);
|
||||
tvTimesBusySignal = new BTextView(r, "TimesBusySignal", TimesBusySignalLocation, B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
tvTimesBusySignal->SetText("time(s) on busy signal");
|
||||
tvTimesBusySignal->MakeSelectable(false);
|
||||
tvTimesBusySignal->MakeEditable(false);
|
||||
|
||||
|
||||
// TextView - ReadLogPath
|
||||
BRect ReadLogPathLocation (32,238,350,258);
|
||||
tvReadLogPath = new BTextView(r, "ReadLogPath", ReadLogPathLocation, B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
@@ -147,11 +164,14 @@ void ModemWindow::InitWindow(void)
|
||||
AddChild(chkMakeConnection);
|
||||
AddChild(chkShowTerminal);
|
||||
AddChild(chkLogAll);
|
||||
AddChild(rbPulse);
|
||||
AddChild(rbTone);
|
||||
AddChild(tvUse);
|
||||
AddChild(tvRedial);
|
||||
AddChild(tvTimesBusySignal);
|
||||
AddChild(tvReadLogPath);
|
||||
AddChild(tvWriteLogPath);
|
||||
|
||||
|
||||
btnModemWindowDone->MakeDefault(true);
|
||||
|
||||
// Add the Drawing View
|
||||
@@ -162,24 +182,25 @@ void ModemWindow::InitWindow(void)
|
||||
// ModemWindow::~ModemWindow -- destructor
|
||||
ModemWindow::~ModemWindow()
|
||||
{
|
||||
exit(0);
|
||||
exit(0);
|
||||
}
|
||||
// ------------------------------------------------------------------------------- //
|
||||
|
||||
// ModemWindow::MessageReceived -- receives messages
|
||||
void ModemWindow::MessageReceived (BMessage *message)
|
||||
{
|
||||
switch(message->what)
|
||||
{
|
||||
case BTN_MODEM_WINDOW_DONE:
|
||||
Quit(); // debugging purposes
|
||||
break;
|
||||
case BTN_MODEM_WINDOW_CANCEL:
|
||||
Hide(); // must find a better way to close this window and not the entire application
|
||||
break;
|
||||
default:
|
||||
BWindow::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
switch(message->what)
|
||||
{
|
||||
case BTN_MODEM_WINDOW_DONE:
|
||||
Quit(); // debugging purposes
|
||||
break;
|
||||
case BTN_MODEM_WINDOW_CANCEL:
|
||||
Hide(); // must find a better way to close this window and not the entire application
|
||||
// any suggestions would be greatly appreciated ;)
|
||||
break;
|
||||
default:
|
||||
BWindow::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// end
|
||||
|
||||
Reference in New Issue
Block a user