1/* ----------------------------------------------------------------------- 2 * Copyright (c) 2003-2004 Waldemar Kornewald, Waldemar.Kornewald@web.de 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 * DEALINGS IN THE SOFTWARE. 21 * ----------------------------------------------------------------------- */ 22 23//----------------------------------------------------------------------- 24// PPPoEAddon saves the loaded settings. 25// PPPoEView saves the current settings. 26//----------------------------------------------------------------------- 27 28#ifndef _PPPoE_ADDON__H 29#define _PPPoE_ADDON__H 30 31#include <DialUpAddon.h> 32 33#include <String.h> 34#include <TextControl.h> 35 36class PPPoEView; 37 38 39class PPPoEAddon : public DialUpAddon { 40 public: 41 PPPoEAddon(BMessage *addons); 42 virtual ~PPPoEAddon(); 43 44 bool IsNew() const 45 { return fIsNew; } 46 47 const char *InterfaceName() const 48 { return fInterfaceName.String(); } 49 const char *ServiceName() const 50 { return fServiceName.String(); } 51 52 BMessage *Settings() const 53 { return fSettings; } 54 BMessage *Profile() const 55 { return fProfile; } 56 57 virtual const char *FriendlyName() const; 58 virtual const char *TechnicalName() const; 59 virtual const char *KernelModuleName() const; 60 61 virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew); 62 63 virtual void IsModified(bool *settings, bool *profile) const; 64 65 virtual bool SaveSettings(BMessage *settings, BMessage *profile, 66 bool saveTemporary); 67 virtual bool GetPreferredSize(float *width, float *height) const; 68 virtual BView *CreateView(BPoint leftTop); 69 70 void UnregisterView() 71 { fPPPoEView = NULL; } 72 73 private: 74 bool fIsNew; 75 BString fInterfaceName, fServiceName; 76 BMessage *fSettings, *fProfile; 77 // saves last settings state 78 PPPoEView *fPPPoEView; 79 float fHeight; 80 // height of PPPoEView 81}; 82 83 84class PPPoEView : public BView { 85 public: 86 PPPoEView(PPPoEAddon *addon, BRect frame); 87 virtual ~PPPoEView(); 88 89 PPPoEAddon *Addon() const 90 { return fAddon; } 91 void Reload(); 92 93 const char *InterfaceName() const 94 { return fInterfaceName.String(); } 95 const char *ServiceName() const 96 { return fServiceName->Text(); } 97 98 virtual void AttachedToWindow(); 99 virtual void MessageReceived(BMessage *message); 100 101 private: 102 void ReloadInterfaces(); 103 104 private: 105 PPPoEAddon *fAddon; 106 BMenuField *fInterface; 107 BMenuItem *fOtherInterface; 108 BString fInterfaceName; 109 BTextControl *fServiceName; 110}; 111 112 113#endif 114