diff --git a/src/prefs/devices/DevicesViews.cpp b/src/prefs/devices/DevicesViews.cpp index 0ee9867ade..08f4484e34 100644 --- a/src/prefs/devices/DevicesViews.cpp +++ b/src/prefs/devices/DevicesViews.cpp @@ -71,3 +71,10 @@ MemoryRangeView::MemoryRangeView (BRect frame) : BView (frame, "MemoryRangeView" SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); } // ---------------------------------------------------------------------------------------------------------- // + +// ModemView - Constructor +ModemView::ModemView (BRect frame) : BView (frame, "ModemView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW ) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); +} +// ---------------------------------------------------------------------------------------------------------- // diff --git a/src/prefs/devices/DevicesViews.h b/src/prefs/devices/DevicesViews.h index c2a9db855e..2eada09bf7 100644 --- a/src/prefs/devices/DevicesViews.h +++ b/src/prefs/devices/DevicesViews.h @@ -27,6 +27,13 @@ class ResourceUsageView : public BView }; +class ModemView : public BView +{ + public: + ModemView(BRect frame); +}; + + class IRQView : public BView { public: @@ -54,5 +61,7 @@ class MemoryRangeView : public BView MemoryRangeView(BRect frame); }; + + #endif diff --git a/src/prefs/devices/DevicesWindow.cpp b/src/prefs/devices/DevicesWindow.cpp index 4ca1b73fff..929eecf484 100644 --- a/src/prefs/devices/DevicesWindow.cpp +++ b/src/prefs/devices/DevicesWindow.cpp @@ -286,6 +286,11 @@ void DevicesWindow::MessageReceived (BMessage *message) QuitRequested(); } break; + case MENU_DEVICES_NEW_JUMPERED_DEVICE_MODEM: + { + ptrModemWindow = new ModemWindow(BRect (0,0,200,194)); + } + break; case MENU_DEVICES_RESOURCE_USAGE: { ptrResourceUsageWindow = new ResourceUsageWindow(BRect (0,0,430,350)); diff --git a/src/prefs/devices/DevicesWindows.h b/src/prefs/devices/DevicesWindows.h index cf8b9f99a9..06c95f90c7 100644 --- a/src/prefs/devices/DevicesWindows.h +++ b/src/prefs/devices/DevicesWindows.h @@ -15,6 +15,8 @@ Devices Windows Header by Sikosis class DevicesView; class ResourceUsageView; class IRQView; +class ModemView; + class ResourceUsageWindow : public BWindow { @@ -31,6 +33,21 @@ class ResourceUsageWindow : public BWindow }; +class ModemWindow : public BWindow +{ + public: + ModemWindow(BRect frame); + ~ModemWindow(); + virtual void MessageReceived(BMessage *message); + private: + void InitWindow(void); + ModemView* ptrModemView; + + BButton *btnAdd; + BButton *btnCancel; +}; + + class DevicesWindow : public BWindow { public: @@ -43,7 +60,8 @@ class DevicesWindow : public BWindow void InitWindow(void); void LoadSettings(BMessage *msg); void SaveSettings(void); - ResourceUsageWindow* ptrResourceUsageWindow; + ResourceUsageWindow* ptrResourceUsageWindow; + ModemWindow* ptrModemWindow; BStringView *stvDeviceName; BStringView *stvCurrentState; diff --git a/src/prefs/devices/ModemView.cpp b/src/prefs/devices/ModemView.cpp new file mode 100644 index 0000000000..f062e2460f --- /dev/null +++ b/src/prefs/devices/ModemView.cpp @@ -0,0 +1,29 @@ +/* + +ModemView + +Author: Sikosis + +(C)2003 OBOS - Released under the MIT License + +*/ + +// Includes ------------------------------------------------------------------------------------------ // +#include +#include +#include +#include +#include +#include + +#include "DevicesWindows.h" +#include "DevicesViews.h" +// -------------------------------------------------------------------------------------------------- // + +// ModemView - Constructor +ModemView::ModemView (BRect frame) : BView (frame, "ModemView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW ) +{ + SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); +} +// ------------------------------------------------------------------------------------------------- // + diff --git a/src/prefs/devices/ModemWindow.cpp b/src/prefs/devices/ModemWindow.cpp new file mode 100644 index 0000000000..5c0d4e4061 --- /dev/null +++ b/src/prefs/devices/ModemWindow.cpp @@ -0,0 +1,104 @@ +/* + +ModemWindow + +Author: Sikosis + +(C)2003 OBOS - Released under the MIT License + +*/ + +// Includes ------------------------------------------------------------------------------------------ // +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Devices.h" +#include "DevicesWindows.h" +#include "DevicesViews.h" +// -------------------------------------------------------------------------------------------------- // +const uint32 BTN_ADD = 'badd'; +const uint32 BTN_CANCEL = 'bcnl'; + +// CenterWindowOnScreen -- Centers the BWindow to the Current Screen +static void CenterWindowOnScreen(BWindow* w) +{ + BRect screenFrame = (BScreen(B_MAIN_SCREEN_ID).Frame()); + BPoint pt; + pt.x = screenFrame.Width()/2 - w->Bounds().Width()/2; + pt.y = screenFrame.Height()/2 - w->Bounds().Height()/2; + + if (screenFrame.Contains(pt)) + w->MoveTo(pt); +} +// -------------------------------------------------------------------------------------------------- // + + +// ModemWindow - Constructor +ModemWindow::ModemWindow(BRect frame) : BWindow (frame, "ModemWindow", B_MODAL_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, 0) +{ + InitWindow(); + CenterWindowOnScreen(this); + Show(); +} +// -------------------------------------------------------------------------------------------------- // + + +// ModemWindow - Destructor +ModemWindow::~ModemWindow() +{ + //exit(0); +} +// -------------------------------------------------------------------------------------------------- // + + +// ModemWindow::InitWindow -- Initialization Commands here +void ModemWindow::InitWindow(void) +{ + BRect r; + r = Bounds(); + + BRect CancelButtonRect(27,r.bottom-35,103,r.bottom-15); + btnCancel = new BButton(CancelButtonRect,"btnCancel","Cancel", + new BMessage(BTN_CANCEL), B_FOLLOW_LEFT | B_FOLLOW_TOP, + B_WILL_DRAW | B_NAVIGABLE); + + BRect AddButtonRect(110,r.bottom-35,186,r.bottom-15); + btnAdd = new BButton(AddButtonRect,"btnAdd","Add", + new BMessage(BTN_ADD), B_FOLLOW_LEFT | B_FOLLOW_TOP, + B_WILL_DRAW | B_NAVIGABLE); + + // Create the Views + AddChild(ptrModemView = new ModemView(r)); + ptrModemView->AddChild(btnCancel); + ptrModemView->AddChild(btnAdd); +} +// -------------------------------------------------------------------------------------------------- // + + +// ModemWindow::MessageReceived -- receives messages +void ModemWindow::MessageReceived (BMessage *message) +{ + switch(message->what) + { + case BTN_CANCEL: + { + Quit(); + } + break; + default: + BWindow::MessageReceived(message); + break; + } +} +// -------------------------------------------------------------------------------------------------- // + + + + +