Added NewConnectionWindow plus fixed Jam/make

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2262 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Phil Greenway 2002-12-17 00:37:02 +00:00
parent 4d50901035
commit a47165f500
5 changed files with 146 additions and 13 deletions

View File

@ -12,18 +12,28 @@ Authors: Sikosis (beos@gravity24hr.com)
#ifndef __DUNVIEW_H__ #ifndef __DUNVIEW_H__
#define __DUNVIEW_H__ #define __DUNVIEW_H__
class DUNView : public BView { class DUNView : public BView
public: {
DUNView(BRect frame); public:
DUNView(BRect frame);
}; };
class ModemView : public BView { class ModemView : public BView
public: {
ModemView(BRect frame); public:
ModemView(BRect frame);
}; };
class SettingsView : public BView { class SettingsView : public BView
public: {
SettingsView(BRect frame); public:
SettingsView(BRect frame);
}; };
class NewConnectionWindowView : public BView
{
public:
NewConnectionWindowView(BRect frame);
};
#endif #endif

View File

@ -2,6 +2,6 @@ SubDir OBOS_TOP src prefs dun ;
AddResources DialUpNetworking : DUN.rsrc ; AddResources DialUpNetworking : DUN.rsrc ;
Preference DialUpNetworking : DUN.cpp DUNView.cpp TreeView.cpp SettingsWindow.cpp ModemWindow.cpp LocationView.cpp DetailsView.cpp DUNWindow.cpp ; Preference DialUpNetworking : DUN.cpp DUNView.cpp TreeView.cpp SettingsWindow.cpp ModemWindow.cpp LocationView.cpp DetailsView.cpp DUNWindow.cpp NewConnectionWindow.cpp;
LinkSharedOSLibs DialUpNetworking : be tracker stdc++.r4 ; LinkSharedOSLibs DialUpNetworking : be tracker stdc++.r4 ;

View File

@ -0,0 +1,116 @@
/*
NewConnectionWindow - DialUp Networking
Author: Sikosis (beos@gravity24hr.com)
(C) 2002 OpenBeOS under MIT license
*/
// Includes -------------------------------------------------------------------------------------------------- //
#include <Alert.h>
#include <Application.h>
#include <Button.h>
#include <Directory.h>
#include <Path.h>
#include <Screen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <TextControl.h>
#include <Window.h>
#include <View.h>
#include "NewConnectionWindow.h"
#include "DUNView.h"
// Constants ------------------------------------------------------------------------------------------------- //
const uint32 BTN_OKAY = 'BOky';
const uint32 BTN_CANCEL = 'BCnl';
const uint32 TXT_NEW_CONNECTION = 'TxCx';
// ---------------------------------------------------------------------------------------------------------- //
// 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);
}
// ---------------------------------------------------------------------------------------------------------- //
// NewConnectionWindow - Constructor
NewConnectionWindow::NewConnectionWindow(BRect frame) : BWindow (frame, "NewConnectionWindow", B_MODAL_WINDOW , B_NOT_RESIZABLE , 0)
{
InitWindow();
CenterWindowOnScreen(this);
Show();
}
// NewConnectionWindow - Destructor
NewConnectionWindow::~NewConnectionWindow()
{
//exit(0);
}
// NewConnectionWindow::InitWindow
void NewConnectionWindow::InitWindow(void)
{
BRect r;
r = Bounds(); // the whole view
int LeftMargin = 6;
int OkayButtonSize = 60;
int CancelButtonSize = 60;
float CancelLeftMargin = (r.right / 2) - ((OkayButtonSize + 20 + CancelButtonSize) / 2);
float OkayLeftMargin = CancelLeftMargin + CancelButtonSize + 20;;
int NewConnectionTop = 20;
txtNewConnection = new BTextControl(BRect(LeftMargin,NewConnectionTop,r.right-LeftMargin+2,NewConnectionTop+10), "txtNewConnection","New Connection:","New Connection",new BMessage(TXT_NEW_CONNECTION), B_FOLLOW_LEFT | B_FOLLOW_TOP , B_WILL_DRAW | B_NAVIGABLE);
txtNewConnection->SetDivider(65);
btnCancel = new BButton(BRect (CancelLeftMargin,r.bottom-35,CancelLeftMargin+CancelButtonSize,r.bottom-15),"Cancel","Cancel", new BMessage(BTN_CANCEL), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
btnOkay = new BButton(BRect (OkayLeftMargin,r.bottom-35,OkayLeftMargin+OkayButtonSize,r.bottom-15),"Okay","Okay", new BMessage(BTN_OKAY), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
btnOkay->MakeDefault(true);
//AddChild(ptrNewConnectionWindowView = new NewConnectionWindowView(r));
AddChild(txtNewConnection);
AddChild(btnCancel);
AddChild(btnOkay);
txtNewConnection->MakeFocus(true);
}
// ---------------------------------------------------------------------------------------------------------- //
// NewConnectionWindow::MessageReceived -- receives messages
void NewConnectionWindow::MessageReceived (BMessage *message)
{
switch(message->what)
{
case BTN_OKAY:
char tmp[256];
sprintf(tmp,"%s",txtNewConnection->Text());
(new BAlert("",tmp,"tmp"))->Go();
Hide(); // change later
break;
case BTN_CANCEL:
Hide(); // change later
break;
default:
BWindow::MessageReceived(message);
break;
}
}
// ---------------------------------------------------------------------------------------------------------- //

View File

@ -3,13 +3,20 @@ I put this "stdc++.r4" in the Jamfile so it links against libstdc++.r4.so in /sy
Added some simple makefiles :-) Added some simple makefiles :-)
TODO TODO
-Save Preferences in Home/Work profiles
-Add NewConnectionWindow functions (window added)
-Fix ModemWindow dropdowns
-Integrate the code for DunApplet into the main app. -Integrate the code for DunApplet into the main app.
-enable NAT checkbox - todo -enable NAT checkbox - todo
- a redial if disconnected checkbox - a redial if disconnected checkbox
- plus commands on disconnection, connection like in ~/config/etc/ppp-script - plus commands on disconnection, connection like in ~/config/etc/ppp-script
DONE DONE
Resizing window with the TreeView "controls" AND Saving window state and position work perfectly now! yeah baby!!!!! Resizing window with the TreeView "controls" AND Saving window state and position work perfectly now! yeah baby!!!!!
NEARLY THERE! :-) NEARLY THERE! :-)
Sikosis - Phil Greenway
Mizsa - Brent Mizsa

View File

@ -30,7 +30,7 @@ TYPE := APP
# if two source files with the same name (source.c or source.cpp) # if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces # are included from different directories. Also note that spaces
# in folder names do not work well with this makefile. # in folder names do not work well with this makefile.
SRCS := DUN.cpp DUNView.cpp TreeView.cpp SettingsWindow.cpp ModemWindow.cpp LocationView.cpp DetailsView.cpp DUNWindow.cpp SRCS := DUN.cpp DUNView.cpp TreeView.cpp SettingsWindow.cpp ModemWindow.cpp LocationView.cpp DetailsView.cpp DUNWindow.cpp NewConnectionWindow.cpp
# specify the resource files to use # specify the resource files to use
# full path or a relative path to the resource file can be used. # full path or a relative path to the resource file can be used.