Added Basic ModemWindow (one of the menu options)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4363 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -71,3 +71,10 @@ MemoryRangeView::MemoryRangeView (BRect frame) : BView (frame, "MemoryRangeView"
|
|||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
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));
|
||||||
|
}
|
||||||
|
// ---------------------------------------------------------------------------------------------------------- //
|
||||||
|
|||||||
@@ -27,6 +27,13 @@ class ResourceUsageView : public BView
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class ModemView : public BView
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ModemView(BRect frame);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class IRQView : public BView
|
class IRQView : public BView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -54,5 +61,7 @@ class MemoryRangeView : public BView
|
|||||||
MemoryRangeView(BRect frame);
|
MemoryRangeView(BRect frame);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -286,6 +286,11 @@ void DevicesWindow::MessageReceived (BMessage *message)
|
|||||||
QuitRequested();
|
QuitRequested();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case MENU_DEVICES_NEW_JUMPERED_DEVICE_MODEM:
|
||||||
|
{
|
||||||
|
ptrModemWindow = new ModemWindow(BRect (0,0,200,194));
|
||||||
|
}
|
||||||
|
break;
|
||||||
case MENU_DEVICES_RESOURCE_USAGE:
|
case MENU_DEVICES_RESOURCE_USAGE:
|
||||||
{
|
{
|
||||||
ptrResourceUsageWindow = new ResourceUsageWindow(BRect (0,0,430,350));
|
ptrResourceUsageWindow = new ResourceUsageWindow(BRect (0,0,430,350));
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ Devices Windows Header by Sikosis
|
|||||||
class DevicesView;
|
class DevicesView;
|
||||||
class ResourceUsageView;
|
class ResourceUsageView;
|
||||||
class IRQView;
|
class IRQView;
|
||||||
|
class ModemView;
|
||||||
|
|
||||||
|
|
||||||
class ResourceUsageWindow : public BWindow
|
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
|
class DevicesWindow : public BWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -43,7 +60,8 @@ class DevicesWindow : public BWindow
|
|||||||
void InitWindow(void);
|
void InitWindow(void);
|
||||||
void LoadSettings(BMessage *msg);
|
void LoadSettings(BMessage *msg);
|
||||||
void SaveSettings(void);
|
void SaveSettings(void);
|
||||||
ResourceUsageWindow* ptrResourceUsageWindow;
|
ResourceUsageWindow* ptrResourceUsageWindow;
|
||||||
|
ModemWindow* ptrModemWindow;
|
||||||
|
|
||||||
BStringView *stvDeviceName;
|
BStringView *stvDeviceName;
|
||||||
BStringView *stvCurrentState;
|
BStringView *stvCurrentState;
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
ModemView
|
||||||
|
|
||||||
|
Author: Sikosis
|
||||||
|
|
||||||
|
(C)2003 OBOS - Released under the MIT License
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Includes ------------------------------------------------------------------------------------------ //
|
||||||
|
#include <Alert.h>
|
||||||
|
#include <Application.h>
|
||||||
|
#include <Screen.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <Window.h>
|
||||||
|
#include <View.h>
|
||||||
|
|
||||||
|
#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));
|
||||||
|
}
|
||||||
|
// ------------------------------------------------------------------------------------------------- //
|
||||||
|
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
ModemWindow
|
||||||
|
|
||||||
|
Author: Sikosis
|
||||||
|
|
||||||
|
(C)2003 OBOS - Released under the MIT License
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Includes ------------------------------------------------------------------------------------------ //
|
||||||
|
#include <Application.h>
|
||||||
|
#include <Button.h>
|
||||||
|
#include <Path.h>
|
||||||
|
#include <Screen.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <String.h>
|
||||||
|
#include <Window.h>
|
||||||
|
#include <View.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// -------------------------------------------------------------------------------------------------- //
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user