1/* 2 * Copyright 2003-2005, Waldemar Kornewald <wkornew@gmx.net> 3 * Distributed under the terms of the MIT License. 4 */ 5 6//----------------------------------------------------------------------- 7// ConnectionOptionsAddon saves the loaded settings. 8// ConnectionOptionsView saves the current settings. 9//----------------------------------------------------------------------- 10 11#ifndef _CONNECTION_OPTIONS_ADDON__H 12#define _CONNECTION_OPTIONS_ADDON__H 13 14#include <DialUpAddon.h> 15 16#include <CheckBox.h> 17#include <RadioButton.h> 18 19class ConnectionOptionsView; 20 21 22class ConnectionOptionsAddon : public DialUpAddon { 23 public: 24 ConnectionOptionsAddon(BMessage *addons); 25 virtual ~ConnectionOptionsAddon(); 26 27 bool IsNew() const 28 { return fIsNew; } 29 30 bool AskBeforeConnecting() const 31 { return fAskBeforeConnecting; } 32 bool DoesAutoReconnect() const 33 { return fDoesAutoReconnect; } 34 35 BMessage *Settings() const 36 { return fSettings; } 37 38 virtual int32 Position() const 39 { return 50; } 40 virtual bool LoadSettings(BMessage *settings, bool isNew); 41 virtual void IsModified(bool *settings) const; 42 virtual bool SaveSettings(BMessage *settings); 43 virtual bool GetPreferredSize(float *width, float *height) const; 44 virtual BView *CreateView(BPoint leftTop); 45 46 private: 47 bool fIsNew, fDeleteView; 48 bool fAskBeforeConnecting, fDoesAutoReconnect; 49 BMessage *fSettings; 50 // saves last settings state 51 ConnectionOptionsView *fConnectionOptionsView; 52}; 53 54 55class ConnectionOptionsView : public BView { 56 public: 57 ConnectionOptionsView(ConnectionOptionsAddon *addon, BRect frame); 58 59 ConnectionOptionsAddon *Addon() const 60 { return fAddon; } 61 void Reload(); 62 63 bool AskBeforeConnecting() const 64 { return fAskBeforeConnecting->Value(); } 65 bool DoesAutoReconnect() const 66 { return fAutoReconnect->Value(); } 67 68 virtual void AttachedToWindow(); 69 70 private: 71 ConnectionOptionsAddon *fAddon; 72 BCheckBox *fAskBeforeConnecting, *fAutoReconnect; 73}; 74 75 76#endif 77