38 #include <wx/sysopt.h>
39 #include <wx/window.h>
52 #if defined(__WXMAC__) && !defined(__WXUNIVERSAL__)
53 #include <ApplicationServices/ApplicationServices.h>
56 #include <wx/filename.h>
100 arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
112 wxAppInitializerFunction fnCreate = wxApp::GetInitializerFunction();
114 wxAppConsole* app = (*fnCreate)();
115 wxApp::SetInstance(app);
147 int retcode = wxEntry(
i, (
char**)
NULL);
175 , m_UseJobDisp( use_job_disp )
178 , m_RegistryLoaded(
false)
180 SetVendorName(
wxT(
"NCBI"));
190 #if defined(__WXMAC__) && !defined(__WXUNIVERSAL__)
191 wxSystemOptions::SetOption(
wxT(
"mac.listctrl.always_use_generic"),
true );
222 return wxApp::OnExit();
259 string action =
"Loading app gui registry - ";
262 if( wxFileName::FileExists( path ) ){
268 LOG_POST(
Error << action <<
"registry file is invalid " << path );
271 LOG_POST(
Info << action <<
"skipping, no file " << path );
274 LOG_POST(
Info << action <<
"skipping, path is empty." );
287 LOG_POST(
Info <<
"Saving app gui registry - skipping, path is empty" );
293 return wxEmptyString;
299 wxImage::AddHandler(
new wxXPMHandler);
302 wxImage::AddHandler(
new wxPNGHandler);
305 wxImage::AddHandler(
new wxJPEGHandler);
308 wxImage::AddHandler(
new wxGIFHandler);
314 static bool fReentry =
false;
322 if (wxWindow::GetCapture())
345 bool handled =
false;
351 const int kPostEventCount = 10;
352 for (
int i = 0;
i < kPostEventCount; ++
i) {
static bool InsideAsyncCall()
void Write(CNcbiOstream &ostr, int priority=ePriority_Local) const
Write the local policy to a specified stream.
static CGuiRegistry & GetInstance()
access the application-wide singleton
void SetLocal(CNcbiIstream &istr)
establish our "local" repository.
static CJobHandler & Instance()
virtual int Run(void)
Run the application.
virtual ~CNCBIwxApplication()
CNCBIwxApplication(const string &app_name)
CNCBIwxApplication.
virtual void Exit(void)
Cleanup on application exit.
virtual void x_Init_wxApplication()
virtual void x_SetupArgDescriptions()
virtual void Init(void)
Initialize the application.
CwxNCBIApp - this class should be used in NCBI applications instead of wxApp it provides polling supp...
virtual bool x_TestNcbiConnection()
override this to test/configure NCBI connection before access to NCBI network services
virtual bool x_CreateGUI()
create main application window and initialize associated objects return true if successful
void OnIdle(wxIdleEvent &event)
virtual void x_DestroyGUI()
destroy application GUI objects
virtual void x_SaveGuiRegistry()
virtual void x_InitAppJobDispatcher()
override this function to configure / register engines
virtual void x_LoadGuiRegistry()
virtual bool OnInit()
Initialises the application.
virtual bool x_OnIdle()
called from OnIdle() and can be overridden in derived classes returns true if something was done
virtual int OnExit()
Called on exit.
virtual void x_RegisterImageHandlers()
register wxWidgets image handlers
virtual wxString x_GetGuiRegistryPath()
IMPLEMENT_CLASS(CFloatingFrame, CFloatingFrameBaseClass) const static long kFloatFrameStyle
CFloatingFrame.
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
const string & GetProgramDisplayName(void) const
Get the application's "display" name.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void SetDiagStream(CNcbiOstream *os, bool quick_flush=true, FDiagCleanup cleanup=0, void *cleanup_data=0, const string &stream_name="")
Set diagnostic stream.
@ eDiag_Trace
Trace message.
@ eDiag_Info
Informational message.
void Error(CExceptionArgs_Base &args)
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
void Info(CExceptionArgs_Base &args)
void ShutDown()
Terminates all jobs and releases Engines.
static CAppJobDispatcher & GetInstance()
static bool HandlePostRequest()
bool IdleCallback()
this function shall be called in the the application idle function.
static void ReleaseInstance()
get the Singleton Dispatcher
bool RegisterEngine(const string &name, IAppJobEngine &engine)
Registers a new Engine, returns true if successful.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
virtual void Process(SOCK sock)=0
Runs asynchronously (from a separate thread) for each request.
unsigned int m_MaxThreads
Maximum simultaneous threads.
void CONNECT_Init(const IRWRegistry *reg=0, CRWLock *lock=0, TConnectInitFlags flag=eConnectInit_OwnNothing, FSSLSetup ssl=0)
Init [X]CONNECT library with the specified "reg" and "lock" (ownership for either or both can be deta...
wxString ToWxString(const string &s)