OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TApplication Class Reference

Derived from TModule and TMsgThread and virtually derived from TEventHandler, TApplication acts as an object-oriented stand-in for an application module. More...

#include <owl/applicat.h>

Inheritance diagram for owl::TApplication:
owl::TEventHandler owl::TModule owl::TMsgThread owl::TStreamableBase

Public Member Functions

 TApplication (LPCTSTR name=0, TModule *&=owl::Module, TAppDictionary *=0)
 Constructor for use in OwlMain().
 
 TApplication (const tstring &name, TModule *&=owl::Module, TAppDictionary *=0)
 String-aware overload.
 
 TApplication (LPCTSTR name, HINSTANCE hInstance, HINSTANCE hPrevInstance, const tstring &cmdLine, int cmdShow, TModule *&=owl::Module, TAppDictionary *=0)
 Constructor for use in user defined WinMain() when all the args are available.
 
 TApplication (const tstring &name, HINSTANCE hInstance, HINSTANCE hPrevInstance, const tstring &cmdLine, int cmdShow, TModule *&=owl::Module, TAppDictionary *=0)
 String-aware overload.
 
 ~TApplication ()
 ~TApplication destroys the TApplication object.
 
TFrameWindowGetMainWindow ()
 Return the current main window.
 
TDocManagerGetDocManager ()
 Return the current document manager.
 
TLangId GetLangId () const
 Returns identifier of language used by application.
 
void SetLangId (TLangId landid)
 Sets new language for use with application.
 
void ClearMainWindow ()
 Called by the main window (TFrameWindow) destructor to zero the MainWindow member.
 
void GetWinMainParams ()
 Retrieve the WinMain parameters.
 
HINSTANCE GetPrevInstance () const
 Return the HINSTANCE of the previous running instance.
 
void SetPrevInstance (HINSTANCE pi)
 Set the previous instance.
 
int GetCmdShow () const
 Retrieve the initial state of the main window.
 
void SetCmdShow (int cmdshow)
 Sets the initial state of the main window.
 
TCurrentEventGetCurrentEvent ()
 Return the current event from the message queue.
 
virtual bool CanClose ()
 Determine whether the application can be closed.
 
auto Run () -> int override
 Run this application, return when application terminates.
 
virtual int Start () noexcept
 Start this application and return immediately. Used for component DLLs.
 
virtual void WaitOnObject (HANDLE handle, bool wait)
 
virtual void ObjectSignaled (HANDLE, bool)
 
TWindowGetWindowPtr (HWND hWnd) const
 Get the TWindow pointer belonging to this app given an hWnd.
 
void PostDispatchAction ()
 Call this function after each msg dispatch if TApplication's message loop is not used.
 
int MessageBox (HWND wnd, const tstring &text, const tstring &caption=tstring(), uint type=MB_OK) const
 
virtual int MessageBox (HWND wnd, LPCTSTR text, LPCTSTR caption=0, uint type=MB_OK) const
 Open a modal message box, Under WIN32 the language id setting is used.
 
virtual TTooltipGetTooltip () const
 Get Tooltip.
 
virtual void EnableTooltip (bool enable=true)
 
Message queue loop & response functions
auto MessageLoop () -> int override
 Operates the application's message loop, which runs during the lifetime of the application.
 
auto IdleAction (long idleCount) -> bool override
 Called each time there are no messages in the queue.
 
auto ProcessMsg (MSG &) -> bool override
 Called for each message that is pulled from the queue, to perform all translation & dispatching.
 
virtual bool ProcessAppMsg (MSG &msg)
 Called after each message is pulled from the queue, and before it is dispatched.
 
Exception propagation mechanism
void SuspendThrow (std::exception_ptr)
 Stores the given exception so that it can be rethrown later by a call to ResumeThrow.
 
void ResumeThrow ()
 Rethrows the suspended exception stored by a previous call to SuspendThrow.
 
bool HasSuspendedException () const
 
Begin and end of a modal window's modal message loop
int BeginModal (TWindow *window, int flags=MB_APPLMODAL)
 Called to begin a modal window's modal message loop.
 
void EndModal (int result)
 Cause the current modal message loop to break and have it return a result Re-enable the disabled windows here, if the EnumInfo is available.
 
virtual void PreProcessMenu (HMENU hMenubar)
 Called by the main window to provide an oportunity to preprocess the main window's menubar before it is installed.
 
Dead TWindow garbage collection
void Condemn (TWindow *win)
 Condemns the given window to be deleted the at the next available safe time.
 
void Uncondemn (TWindow *win)
 Removes the given window from the list of condemned windows.
 
TEventHandler overrides
auto Find (TEventInfo &, TEqualOperator=nullptr) -> bool override
 Overrides TEventHandler::Find.
 
- Public Member Functions inherited from owl::TEventHandler
TResult Dispatch (TEventInfo &info, TParam1, TParam2=0)
 Takes the message data from TEventInfo's Msg data member and dispatches it to the correct event-handling function.
 
TResult DispatchMsg (TMsgId, uint id, TParam1, TParam2)
 Search for the event given the message and it and dispatch to the event handler if found.
 
- Public Member Functions inherited from owl::TModule
 TModule (const tstring &name, bool shouldLoad=true, bool mustLoad=true, bool addToList=true)
 Constructs a TModule object that is used as an alias for a DLL.
 
 TModule (LPCTSTR name, THandle handle, bool addToList=true)
 Constructs a TModule object that is an alias for an already loaded DLL or program with an available HInstance.
 
 TModule (const tstring &name, THandle handle, bool addToList=true)
 String-aware overload.
 
 TModule (LPCTSTR name, THandle handle, const tstring &cmdLine, bool addToList=true)
 Constructs a TModule object for an ObjectWindows DLL or program from within LibMain or WinMain.
 
 TModule (const tstring &name, THandle handle, const tstring &cmdLine, bool addToList=true)
 String-aware overload.
 
virtual ~TModule ()
 Destructs a TModule, freeing the instance if appropriate, and deleting new'd strings.
 
void InitModule (THandle handle, const tstring &cmdLine)
 Finish-up initialization of a module.
 
virtual int Error (TXBase &x, uint captionResId, uint promptResId=0)
 Replaceable exception handler; may be redefined to process OWL exceptions if canResume is false, then the user doesn't have the option of ignoring.
 
LPCTSTR GetName () const
 Returns the name of the module.
 
void SetName (LPCTSTR name)
 Accessor function that sets the name of the module.
 
void SetName (const tstring &name)
 String-aware overload.
 
THandle GetHandle () const
 Return the instance handle of the library module represented by the TModule obect.
 
 operator THandle () const
 Returns the handle of the application or DLL module represented by this TModule.
 
bool operator== (const TModule &m) const
 Returns true if this instance is equal to the other instance; otherwise, returns false.
 
bool IsLoaded () const
 Returns a nonzero value if the instance handle is loaded.
 
int GetModuleFileName (TCHAR *buff, int maxChars) const
 Returns the expanded file name (path and file name) of the file from which this module was loaded.
 
tstring GetModuleFileName () const
 String-aware overload.
 
FARPROC GetProcAddress (TNarrowResId) const
 Returns the entry-point address of the specified exported function if found, otherwise returns NULL.
 
HRSRC FindResource (TResId id, TResId type) const
 Wrapper for the Windows API to find a particular resource.
 
HRSRC FindResourceEx (TResId id, TResId type, TLangId langId=LangNeutral) const
 Wrapper for the Windows API to find a particular resource.
 
HGLOBAL LoadResource (HRSRC hRsrc) const
 Wrapper for the Windows API.
 
uint32 SizeofResource (HRSRC hRsrc) const
 Wrapper for the Windows API.
 
int LoadString (uint id, TCHAR *buf, int maxChars) const
 Loads a string resource identified by id into the buffer pointed to by buff.
 
tstring LoadString (uint id) const
 Loads a string resource identified by id.
 
HBITMAP LoadBitmap (TResId id) const
 Wrapper for the Windows API.
 
HACCEL LoadAccelerators (TResId id) const
 Wrapper for the Windows API.
 
HMENU LoadMenu (TResId id) const
 Wrapper for the Windows API.
 
HCURSOR LoadCursor (TResId id) const
 Wrapper for the Windows API.
 
HICON LoadIcon (TResId name) const
 Wrapper for the Windows API.
 
std::string LoadHtml (TResId) const
 Loads the given HTML resource and returns it as a narrow string.
 
HICON CopyIcon (HICON hIcon) const
 Wrapper for the Windows API.
 
auto GetClassInfo (TWindowClassName, WNDCLASS *wndclass) const -> bool
 Retrieves information about the given window class.
 
auto GetClassInfo (TWindowClassName) const -> WNDCLASS
 Functional-style overload.
 
auto IsRegisteredClass (TWindowClassName) const -> bool
 Returns true if the given window class has been registered.
 
- Public Member Functions inherited from owl::TStreamableBase
virtual ~TStreamableBase ()
 
- Public Member Functions inherited from owl::TMsgThread
 TMsgThread (TCurrent)
 Attaches to the current running thread.
 
bool PumpWaitingMessages ()
 The inner message loop.
 
void FlushQueue ()
 Flushes all real messages from the message queue.
 
bool IsRunning () const
 Is this queue thread running its message loop?
 

Static Public Member Functions

static void SetWinMainParams (HINSTANCE hInstance, HINSTANCE hPrevInstance, const tstring &cmdLine, int cmdShow)
 Set the data members with data from WinMain.
 
static tstringGetCmdLine ()
 Return the command line of the application.
 
- Static Public Member Functions inherited from owl::TModule
static TModuleFindResModule (TResId id, TResId type)
 Global search for resources.
 
static TModuleNextModule (TModule *module=0)
 

Protected Member Functions

virtual void InitApplication ()
 Handle initialization for the first executing instance of the OWL application.
 
void InitInstance () override
 Performs each instance initialization necessary for the application.
 
virtual void InitMainWindow ()
 Initialize the application's main window.
 
auto TermInstance (int status) -> int override
 Handle termination for each executing instance of the application.
 
void SetTooltip (TTooltip *tooltip)
 Assigns tooltip.
 
TFrameWindowSetMainWindow (TFrameWindow *window)
 Set (or reset) the main window.
 
auto SetMainWindow (std::unique_ptr< TFrameWindow >) -> std::unique_ptr< TFrameWindow >
 Smart-pointer-aware overload.
 
TDocManagerSetDocManager (TDocManager *docManager)
 Set (or resets) the document manager, return the previous one if present.
 
auto SetDocManager (std::unique_ptr< TDocManager >) -> std::unique_ptr< TDocManager >
 Smart-pointer-aware overload.
 
- Protected Member Functions inherited from owl::TEventHandler
bool SearchEntries (const TGenericTableEntry *entries, TEventInfo &info, TEqualOperator op)
 Low-level response table search function.
 
- Protected Member Functions inherited from owl::TModule
void SetHandle (THandle handle)
 Set the module instance handle.
 

Additional Inherited Members

- Public Types inherited from owl::TEventHandler
typedef bool(* TEqualOperator) (const TGenericTableEntry &, const TEventInfo &)
 
- Public Types inherited from owl::TModule
typedef HINSTANCE THandle
 TModule encapsulates an HINSTANCE.
 
- Public Types inherited from owl::TMsgThread
enum  TCurrent { Current }
 
- Protected Attributes inherited from owl::TMsgThread
bool BreakMessageLoop
 Message loop is broken via WM_QUIT.
 
int MessageLoopResult
 Return value from message loop.
 
bool LoopRunning
 Track if the loop is running.
 

Detailed Description

Derived from TModule and TMsgThread and virtually derived from TEventHandler, TApplication acts as an object-oriented stand-in for an application module.

TApplication and TModule supply the basic behavior required of an application. TApplication member functions create instances of a class, create main windows, and process messages.

To create an OLE-enabled Doc/View application, you need to derive your application from both TApplication and TOcAppHost.

Note
If a document manager is installed (see SetDocManager), TApplication will give the document manager the first stab at event handling. See the TApplication::Find implementation.

Definition at line 138 of file applicat.h.

Constructor & Destructor Documentation

◆ TApplication() [1/4]

owl::TApplication::TApplication ( LPCTSTR name = 0,
TModule *& module = owl::Module,
TAppDictionary * appDict = 0 )

Constructor for use in OwlMain().

Gets members from statics set earlier by a call to InitWinMainParams() in Owl's WinMain. Creates a new TApplication object named name. You can use owl::Module to specify the global module pointer that points to this application. The appDict parameter specifies which dictionary this application will insert itself into. To override the default ObjectWindows TAppDictionary object, pass a pointer to a user-supplied appDict object.

Definition at line 288 of file applicat.cpp.

References _T, owl::TAppDictionary::Add(), owl::LangUserDefault, OWL_CDLEVEL, owl::OWLGetAppDictionary(), and TRACEX.

◆ TApplication() [2/4]

owl::TApplication::TApplication ( const tstring & name,
TModule *& module = owl::Module,
TAppDictionary * appDict = 0 )

String-aware overload.

Definition at line 324 of file applicat.cpp.

References _T, owl::TAppDictionary::Add(), OWL_CDLEVEL, and TRACEX.

◆ TApplication() [3/4]

owl::TApplication::TApplication ( LPCTSTR name,
HINSTANCE instance,
HINSTANCE prevInstance,
const tstring & cmdLine,
int cmdShow,
TModule *& module = owl::Module,
TAppDictionary * appDict = 0 )

Constructor for use in user defined WinMain() when all the args are available.

Creates a TApplication object with the application name (name), the application instance handle (instance), the previous application instance handle (prevInstance), the command line invoked (cmdLine), and the main window show flag (cmdShow). The appDict parameter specifies which dictionary this application will insert itself into. To override the default ObjectWindows TAppDictionary object, pass a pointer to a user-supplied appDict object.

If you want to create your own WinMain, use this constructor because it provides access to the various arguments provided by WinMain. You can use module to to specify the global module pointer that points to this application.

Definition at line 372 of file applicat.cpp.

References _T, owl::TAppDictionary::Add(), OWL_CDLEVEL, and TRACEX.

◆ TApplication() [4/4]

owl::TApplication::TApplication ( const tstring & name,
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
const tstring & cmdLine,
int cmdShow,
TModule *& module = owl::Module,
TAppDictionary * appDict = 0 )

String-aware overload.

Definition at line 414 of file applicat.cpp.

References _T, owl::TAppDictionary::Add(), OWL_CDLEVEL, and TRACEX.

◆ ~TApplication()

owl::TApplication::~TApplication ( )

~TApplication destroys the TApplication object.

Definition at line 456 of file applicat.cpp.

References _T, OWL_CDLEVEL, owl::TAppDictionary::Remove(), SetMainWindow(), and TRACEX.

Member Function Documentation

◆ BeginModal()

int owl::TApplication::BeginModal ( TWindow * window,
int flags = MB_APPLMODAL )

Called to begin a modal window's modal message loop.

After determining which window to disable, BeginModal saves the current status of the window, disables the window, calls MessageLoop, and then reenables the window when the message loop is finished. The flags determine how BeginModal treats the window. flags can be one of the following values:

  • MB_APPLMODAL The window to be disabled (which is usually an ancestor of the modal window) is identified by window. If window is 0, no window is disabled.
  • MB_SYSTEMMODAL The window to become system modal is identified by window.
  • MB_TASKMODAL All top-level windows are disabled, and window is ignored.

BeginModal returns -1 if an error occurs.

Definition at line 1438 of file applicat.cpp.

References CHECK, owl::TWindow::EnableWindow(), owl::TWindow::GetHandle(), LOCKENUMINFO, and MessageLoop().

◆ CanClose()

bool owl::TApplication::CanClose ( )
virtual

Determine whether the application can be closed.

Makes sure the MainWindow can close & doc manager can close. Returns true if it is OK for the application to close. By default, CanClose calls the CanClose member function of its main window and returns true if both the main window and the document manager (TDocManager) can be closed. If any of the CanClose functions return false, the application does not close.

This member function is seldom redefined; closing behavior is usually redefined in the main window's CanClose member function, if needed.

Definition at line 1217 of file applicat.cpp.

References owl::TWindow::CanClose(), owl::TEventHandler::Dispatch(), owl::TEventHandler::Find(), and WM_OWLCANCLOSE.

◆ ClearMainWindow()

void owl::TApplication::ClearMainWindow ( )
inline

Called by the main window (TFrameWindow) destructor to zero the MainWindow member.

Definition at line 768 of file applicat.h.

◆ Condemn()

void owl::TApplication::Condemn ( TWindow * win)

Condemns the given window to be deleted the at the next available safe time.

Appends the window to the list of condemned windows.

Note
Condemned windows should be removed (see TApplication::Uncondemn) if they are destructed in the mean time through some other mechanism (i.e. stack, aggregate, etc).
It is assumed that the condemned window was constructed using new. If it was constructed by other means, do not pass it to this function. Instead ensure it is destructed in the appropriate way.
While it in previous versions of OWLNext was unsafe for a window in the process of destruction to condemn other windows (e.g. child or buddy), it is now safe to do so.

Definition at line 1256 of file applicat.cpp.

References _T, CHECK, PRECONDITION, owl::TWindow::SetNext(), owl::TWindow::SetParent(), and TRACEX.

◆ EnableTooltip()

void owl::TApplication::EnableTooltip ( bool enable = true)
virtual

Definition at line 1058 of file applicat.cpp.

References owl::TTooltip::Activate(), owl::TWindow::GetHandle(), and SetTooltip().

◆ EndModal()

void owl::TApplication::EndModal ( int result)

Cause the current modal message loop to break and have it return a result Re-enable the disabled windows here, if the EnumInfo is available.

Definition at line 1528 of file applicat.cpp.

References owl::TMsgThread::BreakMessageLoop, LOCKENUMINFO, and owl::TMsgThread::MessageLoopResult.

◆ Find()

auto owl::TApplication::Find ( TEventInfo & eventInfo,
TEqualOperator equal = nullptr ) -> bool
overridevirtual

Overrides TEventHandler::Find.

If a DocManager has been installed, TDocManager::Find is called first to give it an opportunity to handle the event.

Note
Since TApplication needs a custom implementation of Find, the common implementation provided by the response table macros can not be used. For that reason, the response table for TApplication is implemented explicitly within this function.

Reimplemented from owl::TEventHandler.

Definition at line 1176 of file applicat.cpp.

References EV_COMMAND, owl::EV_WM_SYSCOMMAND, and owl::TEventHandler::Find().

◆ GetCmdLine()

tstring & owl::TApplication::GetCmdLine ( )
inlinestatic

Return the command line of the application.

Most programs do not need to call this because OwlMain has the parameters already parsed.

Definition at line 644 of file applicat.h.

◆ GetCmdShow()

int owl::TApplication::GetCmdShow ( ) const
inline

Retrieve the initial state of the main window.

Definition at line 625 of file applicat.h.

◆ GetCurrentEvent()

TCurrentEvent & owl::TApplication::GetCurrentEvent ( )
inline

Return the current event from the message queue.

Definition at line 652 of file applicat.h.

◆ GetDocManager()

TDocManager * owl::TApplication::GetDocManager ( )
inline

Return the current document manager.

Definition at line 600 of file applicat.h.

◆ GetLangId()

TLangId owl::TApplication::GetLangId ( ) const
inline

Returns identifier of language used by application.

Definition at line 673 of file applicat.h.

◆ GetMainWindow()

TFrameWindow * owl::TApplication::GetMainWindow ( )
inline

Return the current main window.

Definition at line 592 of file applicat.h.

◆ GetPrevInstance()

HINSTANCE owl::TApplication::GetPrevInstance ( ) const
inline

Return the HINSTANCE of the previous running instance.

Definition at line 608 of file applicat.h.

◆ GetTooltip()

TTooltip * owl::TApplication::GetTooltip ( ) const
inlinevirtual

Get Tooltip.

Definition at line 762 of file applicat.h.

◆ GetWindowPtr()

TWindow * owl::TApplication::GetWindowPtr ( HWND hWnd) const
inline

Get the TWindow pointer belonging to this app given an hWnd.

Return the window pointer given a window's handle.

Retrieves a TWindow pointer associated with the handle to a window (hWnd), allowing more than one application to share the same HWND.

Definition at line 665 of file applicat.h.

◆ GetWinMainParams()

void owl::TApplication::GetWinMainParams ( )
inline

Retrieve the WinMain parameters.

Initializes a static instance of an application. ObjectWindows OwlMain uses this function to support static application instances.

Definition at line 713 of file applicat.h.

References owl::TModule::InitModule().

◆ HasSuspendedException()

bool owl::TApplication::HasSuspendedException ( ) const
inline

Definition at line 242 of file applicat.h.

◆ IdleAction()

bool owl::TApplication::IdleAction ( long idleCount) -> bool
overridevirtual

Called each time there are no messages in the queue.

Idle count is incremented each time, & zeroed when messages are pumped. Return whether or not more processing needs to be done. Default behavior is to give the main window an opportunity to do idle processing by invoking its IdleAction() member function when "idleCount" is 0

Reimplemented from owl::TMsgThread.

Definition at line 840 of file applicat.cpp.

References _T, owl::TTraceWindow::GetInstance(), owl::TFrameWindow::IdleAction(), LOCKAPPLDATA, and TRACEX.

◆ InitApplication()

void owl::TApplication::InitApplication ( )
protectedvirtual

Handle initialization for the first executing instance of the OWL application.

Under Win32, every app instance is treated as the first. Derived classes can override this to perform app initialization, or they can use the derived class constructor. The following sample program calls InitApplication the first time an instance of the program begins.

class TTestApp : public TApplication {
public:
TTestApp(): TApplication("Instance Tester")
{ strcpy(WindowTitle, "Additional Instance");}
protected:
char WindowTitle[20];
void InitApplication() { strcpy(WindowTitle, "First Instance"); }
void InitMainWindow() { MainWindow = new TFrameWindow(0, WindowTitle); }
};
static TTestApp App;
Derived from TModule and TMsgThread and virtually derived from TEventHandler, TApplication acts as an...
Definition applicat.h:141

Definition at line 560 of file applicat.cpp.

References _T, and TRACEX.

◆ InitInstance()

void owl::TApplication::InitInstance ( )
overrideprotectedvirtual

Performs each instance initialization necessary for the application.

Unlike InitApplication(), which is called for the first instance of an application, InitInstance is called whether or not there are other executing instances of the application. InitInstance calls InitMainWindow(), and then creates and shows the main window element by TWindow::Create and TWindow::Show. If the main window cannot be created, a TXInvalidMainWindow exception is thrown.

Note
If you redefine this member function, be sure to explicitly call TApplication::InitInstance.

Reimplemented from owl::TMsgThread.

Definition at line 578 of file applicat.cpp.

References _T, owl::TWindow::Create(), owl::TWindow::GetHandle(), owl::TMsgThread::InitInstance(), InitMainWindow(), owl::TXInvalidMainWindow::Raise(), owl::ScmTrace, owl::TWindow::SetFlag(), owl::TWindow::ShowWindow(), TRACEX, and owl::wfMainWindow.

◆ InitMainWindow()

void owl::TApplication::InitMainWindow ( )
protectedvirtual

Initialize the application's main window.

Derived classes should override this to construct, initialize and set the main window using SetMainWindow(). By default, InitMainWindow constructs a generic TFrameWindow object with the name of the application as its caption. You can redefine InitMainWindow to construct a useful main window object of TFrameWindow (or a class derived from TFrameWindow) and store it in MainWindow. The main window must be a top-level window; that is, it must be derived from TFrameWindow. A typical use is

virtual void TMyApp_InitMainWindow(){
}
TFrameWindow * SetMainWindow(TFrameWindow *window)
Set (or reset) the main window.
Definition applicat.cpp:658

InitMainWindow can be overridden to create your own custom window.

Definition at line 625 of file applicat.cpp.

References owl::TModule::GetName(), and SetMainWindow().

◆ MessageBox() [1/2]

int owl::TApplication::MessageBox ( HWND wnd,
const tstring & text,
const tstring & caption = tstring(),
uint type = MB_OK ) const
inline

Definition at line 774 of file applicat.h.

References MessageBox().

◆ MessageBox() [2/2]

int owl::TApplication::MessageBox ( HWND wnd,
LPCTSTR text,
LPCTSTR caption = 0,
uint type = MB_OK ) const
virtual

Open a modal message box, Under WIN32 the language id setting is used.

Definition at line 502 of file applicat.cpp.

References owl::TModule::GetName().

◆ MessageLoop()

int owl::TApplication::MessageLoop ( ) -> int
overridevirtual

Operates the application's message loop, which runs during the lifetime of the application.

MessageLoop queries for messages. If one is received, it processes it by calling ProcessAppMsg. If the query returns without a message, MessageLoop calls IdleAction to perform some processing during the idle time.

MessageLoop calls PumpWaitingMessages to get and dispatch waiting messages. MessageLoop can be broken if BreakMessageLoop is set by EndModal.

Reimplemented from owl::TMsgThread.

Definition at line 799 of file applicat.cpp.

References owl::TMsgThread::BreakMessageLoop, IdleAction(), owl::TMsgThread::MessageLoopResult, ObjectSignaled(), owl::TMsgThread::PumpWaitingMessages(), and ResumeThrow().

◆ ObjectSignaled()

virtual void owl::TApplication::ObjectSignaled ( HANDLE ,
bool  )
inlinevirtual

Definition at line 236 of file applicat.h.

◆ PostDispatchAction()

void owl::TApplication::PostDispatchAction ( )

Call this function after each msg dispatch if TApplication's message loop is not used.

If TApplication's message loop is not used, this function should be called after each message is dispatched.

Definition at line 1043 of file applicat.cpp.

References IdleAction(), and ResumeThrow().

◆ PreProcessMenu()

void owl::TApplication::PreProcessMenu ( HMENU hMenubar)
virtual

Called by the main window to provide an oportunity to preprocess the main window's menubar before it is installed.

Normally delegated to the doc manager to install a file menu as needed

Definition at line 1231 of file applicat.cpp.

References owl::TEventHandler::Dispatch(), owl::TWindow::DrawMenuBar(), owl::TEventHandler::Find(), and WM_OWLPREPROCMENU.

◆ ProcessAppMsg()

bool owl::TApplication::ProcessAppMsg ( MSG & msg)
virtual

Called after each message is pulled from the queue, and before it is dispatched.

Return true if the message was handled completely here. Checks for any special processing that is required for modeless dialog box, accelerator, and MDI accelerator messages. Calls the virtual TWindow::PreProcessMsg function of the window receiving the message. If your application does not create modeless dialog boxes, does not respond to accelerators, and is not an MDI application, you can improve performance by overriding this member function to return false.

Definition at line 918 of file applicat.cpp.

References GetWindowPtr(), owl::TWindow::IsChild(), owl::TWindow::IsWindow(), owl::TWindow::PreProcessMsg(), and owl::TTooltip::RelayEvent().

◆ ProcessMsg()

bool owl::TApplication::ProcessMsg ( MSG & msg) -> bool
overridevirtual

Called for each message that is pulled from the queue, to perform all translation & dispatching.

Return true to drop out of pump

Reimplemented from owl::TMsgThread.

Definition at line 877 of file applicat.cpp.

References owl::TEventHandler::Dispatch(), Find(), ProcessAppMsg(), and ResumeThrow().

◆ ResumeThrow()

void owl::TApplication::ResumeThrow ( )

Rethrows the suspended exception stored by a previous call to SuspendThrow.

Otherwise, if no exception has been suspended, does nothing.

Definition at line 1027 of file applicat.cpp.

References _T, and TRACEX.

◆ Run()

int owl::TApplication::Run ( ) -> int
overridevirtual

Run this application, return when application terminates.

Initialize instances, create and display their main window (calls InitApplication for the first executing instance and calls InitInstance for all instances). Run the application's message loop. Each of the virtual functions called are expected to throw an exception if there is an error.

Exceptions are propagated out of this function, but the message queue is still flushed and TermInstance called in the event of an exception.

Reimplemented from owl::TMsgThread.

Definition at line 739 of file applicat.cpp.

References owl::TMsgThread::FlushQueue(), InitApplication(), InitInstance(), owl::TMsgThread::LoopRunning, MessageLoop(), and TermInstance().

◆ SetCmdShow()

void owl::TApplication::SetCmdShow ( int cmdshow)
inline

Sets the initial state of the main window.

Typically passed by the operating system.

Definition at line 634 of file applicat.h.

◆ SetDocManager() [1/2]

auto owl::TApplication::SetDocManager ( std::unique_ptr< TDocManager > d) -> std::unique_ptr<TDocManager>
protected

Smart-pointer-aware overload.

Definition at line 708 of file applicat.cpp.

◆ SetDocManager() [2/2]

TDocManager * owl::TApplication::SetDocManager ( TDocManager * docManager)
protected

Set (or resets) the document manager, return the previous one if present.

Definition at line 698 of file applicat.cpp.

◆ SetLangId()

void owl::TApplication::SetLangId ( TLangId landid)
inline

Sets new language for use with application.

Note that it only sets the variable LangId.

Definition at line 680 of file applicat.h.

◆ SetMainWindow() [1/2]

auto owl::TApplication::SetMainWindow ( std::unique_ptr< TFrameWindow > f) -> std::unique_ptr<TFrameWindow>
protected

Smart-pointer-aware overload.

Definition at line 687 of file applicat.cpp.

◆ SetMainWindow() [2/2]

TFrameWindow * owl::TApplication::SetMainWindow ( TFrameWindow * window)
protected

Set (or reset) the main window.

Return, but do not destroy the previous main window.

Definition at line 658 of file applicat.cpp.

References owl::TWindow::ClearFlag(), owl::TWindow::GetExStyle(), owl::TWindow::GetHandle(), owl::TWindow::GetParentO(), owl::TWindow::SetExStyle(), owl::TWindow::SetFlag(), owl::TWindow::SetParent(), owl::wfMainWindow, and WS_EX_APPWINDOW.

◆ SetPrevInstance()

void owl::TApplication::SetPrevInstance ( HINSTANCE pi)
inline

Set the previous instance.

This should not be called by normal programs.

Definition at line 617 of file applicat.h.

◆ SetTooltip()

void owl::TApplication::SetTooltip ( TTooltip * tooltip)
protected

Assigns tooltip.

Set tooltip . Assume we now own the ToolTip.

Definition at line 1082 of file applicat.cpp.

References owl::TWindow::Create(), owl::TWindow::GetHandle(), owl::TWindow::GetParentO(), owl::TWindow::ModifyStyle(), owl::TWindow::SendMessage(), and owl::TWindow::SetParent().

◆ SetWinMainParams()

void owl::TApplication::SetWinMainParams ( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
const tstring & cmdLine,
int cmdShow )
inlinestatic

Set the data members with data from WinMain.

The ObjectWindows default WinMain function calls SetMainWinParams so that TApplication can store the parameters for future use. To construct an application instance, WinMain calls the OwlMain function that is in the user's code. As it is being constructed, the application instance can fill in the parameters using those set earlier by SetMainWinParams.

Definition at line 693 of file applicat.h.

◆ Start()

int owl::TApplication::Start ( )
virtualnoexcept

Start this application and return immediately. Used for component DLLs.

Initializes instances, creating and displaying their main window (calls InitApplication for the first executing instance and calls InitInstance for all instances). Each of the virtual functions called are expected to throw an exception if there is an error. Any exceptions are handled and converted to an error code which is then returned. Returns 0 on success. Does not run message loop.

Definition at line 775 of file applicat.cpp.

References owl::TModule::Error(), InitApplication(), InitInstance(), and owl::TXOwl::Unhandled().

◆ SuspendThrow()

void owl::TApplication::SuspendThrow ( std::exception_ptr )

Stores the given exception so that it can be rethrown later by a call to ResumeThrow.

Calls PostQuitMessage to break the application message loop, thus ensuring that the application will not linger in a corrupt state.

Definition at line 1015 of file applicat.cpp.

References _T, and TRACEX.

◆ TermInstance()

int owl::TApplication::TermInstance ( int status) -> int
overrideprotectedvirtual

Handle termination for each executing instance of the application.

Called at the end of a Run() with the final return status.

Reimplemented from owl::TMsgThread.

Definition at line 636 of file applicat.cpp.

References _T, owl::TTraceWindow::DestroyInstance(), owl::TTraceWindow::GetInstance(), owl::TMsgThread::TermInstance(), and TRACEX.

◆ Uncondemn()

void owl::TApplication::Uncondemn ( TWindow * win)

Removes the given window from the list of condemned windows.

If the given window is not in the list of condemned windows, the function does nothing.

Definition at line 1286 of file applicat.cpp.

References _T, owl::TWindow::Next(), and TRACEX.

◆ WaitOnObject()

void owl::TApplication::WaitOnObject ( HANDLE handle,
bool wait )
virtual

Definition at line 954 of file applicat.cpp.


The documentation for this class was generated from the following files: