/****************************************************************************** |* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF |* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO |* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A |* PARTICULAR PURPOSE. |* |* Copyright 1995-2005 Nero AG. All Rights Reserved. |*----------------------------------------------------------------------------- |* NeroSDK / NeroRobo |* |* PROGRAM: AbstractUserDialog.h |* |* PURPOSE: Interface for GUI ******************************************************************************/ /* This file defines an abstract way to represent a dialog with an interface exported to e.g. a DLL * or a separate thread. */ #ifndef ABSTRACTUSERDIALOG_H #define ABSTRACTUSERDIALOG_H #include #include "AbstractConfigurationStorage.h" /* Event received through the watchdog when dialog is closed */ #define ABSTRACTUSERDIALOG_CANCEL "CANCEL" class CUserDialogHandle { public: /* Feed back enums returned by the dialog on special user action. */ typedef enum { DLGRESULT_OK, DLGRESULT_CANCEL, DLGRESULT_NONE // no user feedback received } UserDlgFeedbackType; /* Waits for the user to answer the dialog. */ virtual void WaitForUserFeedback() = 0; /* Retrieve feedback. Will return the type of button the user has pressed to quit the dialog. * Querying this method should be enough for most dialogs. However, if additional informations * are obtained from the user, GetFeedbackData() can be used to return those. */ virtual UserDlgFeedbackType GetFeedback() = 0; /* Get the result of the dialog. Depending on the kind of dialog this handle is associated with * this may e.g. return a string or a filename. * The default implementation of this method will just return NULL. */ virtual const char *GetFeedbackData() { return NULL; }; /* Close the dialog and destroy it's handle */ virtual ~CUserDialogHandle() {}; }; class IUserDialogContainer; /* Interface enabling limited manipulation of dialog elemnts. */ class IUserDialogElement { public: /* Show (bShow = TRUE) and hide (bShow = FALSE) current dialog element respectively. */ virtual void SetShow(BOOL bShow) = 0; /* Enable (bSensitive = TRUE) and hide (bSensitive = FALSE) current dialog element respectively. */ virtual void SetSensitive(BOOL bSensitive) = 0; virtual ~IUserDialogElement() {}; /* Called by the container to set the position of dialog element. */ virtual void SetPosition(int xpos, int ypos) = 0; /* Retrieve the size of dialog element. */ virtual void GetSize(int &iXSize, int &iYSize) const = 0; }; class IUserDialogContainer :public IUserDialogElement { public: /* Options valid for every container element */ #define DE_OPTION_ALIGN_LEFT 0 #define DE_OPTION_ALIGN_RIGHT 1 #define DE_OPTION_ALIGN_CENTER 3 /* Factory methods for some controls. */ virtual IUserDialogElement *CreateCheckBox(DWORD dwOptions, const char *szName, const char *szText, BOOL bDefaultState = FALSE) = 0; virtual IUserDialogElement *CreatePushButton(int iMinXsize, int iMinYsize, DWORD dwOptions, const char *szName, const char *szText) = 0; virtual IUserDialogContainer *CreateHBox(DWORD dwOptions = 0) = 0; virtual IUserDialogContainer *CreateVBox(DWORD dwOptions = 0) = 0; virtual ~IUserDialogContainer() {}; /* Called by a child to notify the parent about a size change */ virtual void SizeChanged(IUserDialogElement *pElement) = 0; /* Called by a child's destructor */ virtual void Unref(IUserDialogElement *pElement) = 0; }; class IUserDialog :public IUserDialogContainer { public: /* Call this from within a watchdog callback to quit the dialog */ virtual void Quit() = 0; /* Call this to execute the dialog */ virtual void Exec() = 0; virtual ~IUserDialog() {}; }; class IUserDialogFactory :virtual public IConfigurationStorage { public: /* Create a dialog. The dialog is being shown immediately with szTitle and allign options * specified in IUserDialogContainer. Default all dialog elements are left alligned. */ virtual IUserDialog *CreateUserDialog(const char *szTitle, DWORD dwOptions = 0) = 0; /* This method can be used to estimate current Nero language to localize special driver * messages. */ virtual const char *GetCurrentLanguage() = 0; /* Return the currently set OEM name for some device given in szTemplateName. * If no matching OEM substitution could be found, return szTemplateName. */ virtual const char *GetOEMName(const char *szTemplateName) = 0; /* Create simple message box which can only be confirmed by the user. */ virtual CUserDialogHandle::UserDlgFeedbackType CreateMessageBox(const char *szText) = 0; virtual ~IUserDialogFactory() {}; }; #endif // ABSTRACTUSERDIALOG_H