1 /* 2 * Copyright 2003-2004 Waldemar Kornewald. All rights reserved. 3 * Copyright 2017 Haiku, Inc. All rights reserved. 4 * Distributed under the terms of the MIT License. 5 */ 6 7 /*! \class DialUpAddon 8 \brief Base class for DialUpPreflet add-ons. 9 10 Dial-Up add-ons must export the following function: \n 11 bool register(BMessage *addons) \n 12 You should add your DialUpAddon object to the given BMessage. \n 13 \n 14 Most add-ons are simple pointers to a DialUpAddon object. \n 15 \n 16 Note for tab-addons: The BView object is deleted AFTER the DialUpAddon (except you 17 remove and delete it in the DialUpAddon destructor). 18 */ 19 20 #ifndef _DIAL_UP_ADDON__H 21 #define _DIAL_UP_ADDON__H 22 23 #include <SupportDefs.h> 24 #include <Point.h> 25 26 class BMessage; 27 class BView; 28 class DialUpView; 29 30 31 #define DUN_MAXIMUM_PRIORITY 50 32 33 // add-on types 34 #define DUN_TAB_ADDON_TYPE "Tab" 35 #define DUN_AUTHENTICATOR_ADDON_TYPE "Authenticator" 36 #define DUN_DEVICE_ADDON_TYPE "Device" 37 #define DUN_PROTOCOL_ADDON_TYPE "Protocol" 38 39 // other information contained in the add-ons BMessage object 40 #define DUN_DELETE_ON_QUIT "DeleteMe" 41 // the DialUpAddon objects in this list will be deleted when the preflet quits 42 #define DUN_MESSENGER "Messenger" 43 #define DUN_TAB_VIEW_RECT "TabViewRect" 44 #define DUN_DEVICE_VIEW_WIDTH "DeviceViewWidth" 45 46 47 class DialUpAddon { 48 friend class DialUpView; 49 50 public: 51 //! Constructor. The BMessage is the one passed to the \c register() function. DialUpAddon(BMessage * addons)52 DialUpAddon(BMessage *addons) : fAddons(addons) {} 53 //! Destructor. Does nothing. ~DialUpAddon()54 virtual ~DialUpAddon() {} 55 56 //! Returns the BMessage object holding all add-ons. Addons()57 BMessage *Addons() const 58 { return fAddons; } 59 60 //! Returns a name readable by humans without much technical knowledge. FriendlyName()61 virtual const char *FriendlyName() const 62 { return NULL; } 63 //! Returns the technical name of this module. TechnicalName()64 virtual const char *TechnicalName() const 65 { return NULL; } 66 //! Returns the name of the associated kernel module or \c NULL. KernelModuleName()67 virtual const char *KernelModuleName() const 68 { return NULL; } 69 //! Mostly used by tabs to describe where they should appear. Position()70 virtual int32 Position() const 71 { return -1; } 72 //! Allows setting an order in which modules are asked to add the settings. Priority()73 virtual int32 Priority() const 74 { return 0; } 75 76 /*! \brief Load the given settings and profile. 77 78 \param isNew Specifies if this is a newly created interface. 79 80 \return \c true if loading was successful or \c false otherwise. 81 */ LoadSettings(BMessage * settings,BMessage * profile,bool isNew)82 virtual bool LoadSettings(BMessage *settings, BMessage *profile, bool isNew) 83 { return false; } 84 /*! \brief Returns if this module has a temporary profile. 85 86 A temporary profile is never stored on the hard-disk, but only passed 87 to the interface on connection. This can include passwords, for example. 88 */ HasTemporaryProfile()89 virtual bool HasTemporaryProfile() const 90 { return false; } 91 //! Are the settings or the profile modified? IsModified(bool * settings,bool * profile)92 virtual void IsModified(bool *settings, bool *profile) const 93 { *settings = *profile = false; } 94 /*! \brief Save the given settings and profile. 95 96 \param saveTemporary Specifies if the temporary profile should be written. 97 98 \return \c true if saving was successful or \c false otherwise. 99 */ SaveSettings(BMessage * settings,BMessage * profile,bool saveTemporary)100 virtual bool SaveSettings(BMessage *settings, BMessage *profile, 101 bool saveTemporary) 102 { return false; } 103 /*! \brief Get the preferred view size. 104 105 \return \c false if this module does not export a BView object. 106 */ GetPreferredSize(float * width,float * height)107 virtual bool GetPreferredSize(float *width, float *height) const 108 { return false; } 109 /*! \brief Returns the module's BView object. 110 111 \param leftTop Specifies the view's left-top coordinates. 112 */ CreateView()113 virtual BView *CreateView() 114 { return NULL; } 115 116 private: _Reserved1()117 virtual void _Reserved1() {} _Reserved2()118 virtual void _Reserved2() {} _Reserved3()119 virtual void _Reserved3() {} _Reserved4()120 virtual void _Reserved4() {} 121 122 private: 123 BMessage *fAddons; 124 125 int32 _reserved[7]; 126 }; 127 128 129 #endif 130