/* WARNING: This file was generated by dkct. Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: WxpqdicFrame.wxc */ /* Copyright (C) 2016-2017, Dirk Krause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above opyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** @file WxpqdicFrame.h Header file for the WxpqdicFrame module. */ #ifndef WXPQDICFRAME_H_INCLUDED /** Avoid multiple inclusions. */ #define WXPQDICFRAME_H_INCLUDED 1 #line 133 "WxpqdicFrame.wxc" #line 137 "WxpqdicFrame.wxc" class WxpqdicFrame : public Dk4WxFrame { private: /** Event table for frame. */ DECLARE_EVENT_TABLE() protected: /** Buffer for response processing. */ char bResponse[32 * sizeof(dk4_um_t)]; /** Address pair, 0=remote, 1=local. */ dk4_sockaddr_storage_t aAddresses[2]; /** Remote host name as wxChar string. */ wxString sHostname; /** Queue name as wxChar string. */ wxString sQueuename; /** User name as wxChar string. */ wxString sUsername; /** Localized texts. */ wxChar const * const *sTexts; /** Non-localized texts. */ wxChar const * const *sNlWx; /** Non-localized texts. */ dkChar const * const *sNlDk; /** Copy of the command line arguments poiner. */ wxChar **copyArgv; /* __CHANGE__ 011: Add further member variables. */ /** Critical section to protect socket and timer. */ wxCriticalSection csProtect; /** Black color for normal status text. */ wxColour cBlack; /** Red color for not allowed to print. */ wxColour cRed; /** Green color for allowed to print. */ wxColour cGreen; /** Timer for periodic updates. */ wxTimer timer; /** Error report from socket subsystem initialization. */ dk4_er_t sockerr; /** Host name to query. */ dkChar *pHostname; /** Print queue to check. */ char *pQueuename; /** User name to use in check. */ char *pUsername; /** Request to send to server. */ char *pRequest; /** Previous limit value. */ dk4_um_t uLimit; /** Previous used value. */ dk4_um_t uUsed; /** Previous account value. */ dk4_um_t uAccount; /** Length of request. */ size_t szRequest; /** Size of response buffer. */ size_t szResponse; /** Time last request was sended. */ dk4_time_t tRequestSended; /** Update interval in seconds. */ long lUpdateInterval; /** Timeout interval before complaining about missing response. */ long lWaitResponse; /** Previous summary value. */ int iSummary; /** Number of command line arguments. */ int copyArgc; /** Current state. */ int iState; /** Socket for data exchange */ dk4_socket_t sock; /** Port number on remote host. */ unsigned short usPortnumber; /** Local port number to use. */ unsigned short usLocalPort; /** Flag: Socket subsystem initialized. */ bool bSockInit; /** Flag: Remote host uses UTF-8 encoding (user name and queue name). */ bool bIsUtf8; /** Flag: This idle event is the first one (no idle events before). */ bool bFirstIdle; /** Flag: All components initialized completely. */ bool bIsInitialized; /** Flag: This is the first response. */ bool bFirstResponse; /** Flag: GUI ok. */ bool dkctGUILayoutOK; /** Contents panel. */ wxPanel *dkctGUIContentsPanel; /** GUI element mainSizer. */ #line 58 "WxpqdicFrame.wxc" wxBoxSizer *mainSizer; /** GUI element mbMain. */ #line 20 "WxpqdicFrame.wxc" wxMenuBar *mbMain; /** GUI element tbMain. */ #line 115 "WxpqdicFrame.wxc" wxToolBar *tbMain; /** GUI element menuFile. */ #line 25 "WxpqdicFrame.wxc" wxMenu *menuFile; /** GUI element menuView. */ #line 34 "WxpqdicFrame.wxc" wxMenu *menuView; /** GUI element menuHelp. */ #line 43 "WxpqdicFrame.wxc" wxMenu *menuHelp; /** GUI element miFileExit. */ #line 29 "WxpqdicFrame.wxc" wxMenuItem *miFileExit; /** GUI element miViewUpdate. */ #line 38 "WxpqdicFrame.wxc" wxMenuItem *miViewUpdate; /** GUI element miHelpAbout. */ #line 48 "WxpqdicFrame.wxc" wxMenuItem *miHelpAbout; /** GUI element miHelpContents. */ #line 53 "WxpqdicFrame.wxc" wxMenuItem *miHelpContents; /** GUI element verticalSizer. */ #line 64 "WxpqdicFrame.wxc" wxBoxSizer *verticalSizer; /** GUI element contentsSizer. */ #line 72 "WxpqdicFrame.wxc" wxGridBagSizer *contentsSizer; /** GUI element lLimit. */ #line 87 "WxpqdicFrame.wxc" wxStaticText *lLimit; /** GUI element tLimit. */ #line 90 "WxpqdicFrame.wxc" wxStaticText *tLimit; /** GUI element lUsed. */ #line 93 "WxpqdicFrame.wxc" wxStaticText *lUsed; /** GUI element tUsed. */ #line 96 "WxpqdicFrame.wxc" wxStaticText *tUsed; /** GUI element lAccount. */ #line 99 "WxpqdicFrame.wxc" wxStaticText *lAccount; /** GUI element tAccount. */ #line 102 "WxpqdicFrame.wxc" wxStaticText *tAccount; /** GUI element lAllowed. */ #line 105 "WxpqdicFrame.wxc" wxStaticText *lAllowed; /** GUI element tAllowed. */ #line 108 "WxpqdicFrame.wxc" wxStaticText *tAllowed; /** GUI element lStatus. */ #line 111 "WxpqdicFrame.wxc" wxStaticText *lStatus; /** GUI element bUpdate. */ #line 119 "WxpqdicFrame.wxc" wxToolBarToolBase *bUpdate; /** GUI element bExit. */ #line 125 "WxpqdicFrame.wxc" wxToolBarToolBase *bExit; #line 303 "WxpqdicFrame.wxc" public: /** Constructor. @param wxid Window ID. @param applicationHelper Application helper object. @param hc Help controller for online help. @param argc Number of command line arguments. @param argv Command line arguments array. @param localizedTexts Localized wxChar texts. @param nlWx Non-localized wxChar texts. @param nlDk Non-localized dkChar texts. @param bSocketsInitialized Flag: Socket subsys initialized. @param psockerr Error report from socket initialization. */ WxpqdicFrame( int wxid, Dk4WxApplicationHelper *applicationHelper, Dk4WxHelpController *hc, int argc, wxChar **argv, wxChar const * const *localizedTexts, wxChar const * const *nlWx, dkChar const * const *nlDk, bool bSocketsInitialized, dk4_er_t *psockerr ); /** Destructor. */ ~WxpqdicFrame(); /** Check whether we can close the window. @param isLast Flag: Last main window to close. */ bool CanClose(bool isFinal); /** Handler for File/Exit. @param event Event to process. */ void OnQuit(wxCommandEvent & event); /** Handler for File/Update. @param event Event to process. */ void OnRun(wxCommandEvent & event); /** Handler for Help/About. @param event Event to process. */ void OnAbout(wxCommandEvent & event); /** Handler for Help/Contents. @param event Event to process. */ void OnHelpContents(wxCommandEvent & event); /* __CHANGE__ 008: Remove OnIdle if no idle processing required. */ /** Handler for idle events. */ void OnIdle(wxIdleEvent & event); /* __CHANGE__ 017: Event handlers for further events. */ /** Handler for timer event. @param event Timer event to process. */ void OnTimer(wxTimerEvent & event); /* __CHANGE__ 014: Add further methods. */ private: /** Attempt to configure. @param perrc Address of error code variable. @return True if configuration failed and the application should exit, false on success. */ bool ConfigureAndCheckNeedToClose(int *perrc); /** Attempt to receive data, send request again if interval is over. @return True if the windows requires an update, false otherwise. */ bool DataExchangeWithServer(void); bool RetrieveResponse(void); bool ProcessResponse(bool & found); bool SendRequest(bool force = false); }; #line 413 "WxpqdicFrame.wxc" #endif