10#if !defined(OWL_APPLICAT_H)
14#if defined(BI_HAS_PRAGMA_ONCE)
30#if defined(OWL_SUPPORT_BWCC)
34#define BWCC_LANG_GERMAN 0x07
35#define BWCC_LANG_US 0x09
36#define BWCC_LANG_FRENCH 0x0c
45#if defined(OWL_SUPPORT_BWCC)
49#if defined(OWL_SUPPORT_CTL3D)
57typedef int (*
TMessageBox)(HWND wnd, LPCTSTR text,
const LPCTSTR caption,
uint type);
149 LPCTSTR name =
nullptr,
165 HINSTANCE hPrevInstance,
176 HINSTANCE hPrevInstance,
195 HINSTANCE hPrevInstance,
212 auto Run() ->
int override;
213 virtual int Start()
noexcept;
217#if defined(BI_MULTI_THREAD_RTL)
218 typedef TMsgThread::TQueueLock TAppLock;
230 auto IdleAction(
long idleCount) ->
bool override;
240 void SuspendThrow(std::exception_ptr);
251 int BeginModal(
TWindow* window,
int flags=MB_APPLMODAL);
252 void EndModal(
int result);
253 virtual void PreProcessMenu(HMENU hMenubar);
265 void PostDispatchAction();
268#if defined(OWL_SUPPORT_BWCC)
270 void EnableBWCC(
bool enable =
true,
uint language = 0);
271 bool BWCCEnabled()
const;
272 TBwccDll* GetBWCCModule()
const;
275#if defined(OWL_SUPPORT_CTL3D)
276 void EnableCtl3d(
bool enable =
true);
277 void EnableCtl3dAutosubclass(
bool enable)
const;
278 bool Ctl3dEnabled()
const;
279 TCtl3dDll* GetCtl3dModule()
const;
293 virtual int MessageBox
297 LPCTSTR caption =
nullptr,
303 virtual TTooltip* GetTooltip()
const;
304 virtual void EnableTooltip(
bool enable=
true);
309 auto Find(TEventInfo&, TEqualOperator =
nullptr) ->
bool override;
314 virtual void InitApplication();
315 void InitInstance()
override;
316 virtual void InitMainWindow();
317 auto TermInstance(
int status) ->
int override;
326 auto SetMainWindow(std::unique_ptr<TFrameWindow>) -> std::unique_ptr<TFrameWindow>;
328 auto SetDocManager(std::unique_ptr<TDocManager>) -> std::unique_ptr<TDocManager>;
333 HINSTANCE hPrevInstance;
344 LPHANDLE WaitHandles;
347#if defined(OWL_SUPPORT_BWCC)
349 TBwccDll* BWCCModule;
352#if defined(OWL_SUPPORT_CTL3D)
354 TCtl3dDll* Ctl3dModule;
358 std::exception_ptr CurrentException;
362 void DeleteCondemned();
373 static HINSTANCE InitHInstance;
374 static HINSTANCE InitHPrevInstance;
375 static tstring& GetInitCmdLine();
376 static int InitCmdShow;
398#if defined(OWL_SUPPORT_BWCC)
419class _OWLCLASS TBwccDll :
public TModule {
425 TModuleProc1<bool,uint> IntlInit;
426 TModuleProc1<bool,HINSTANCE> Register;
427 TModuleProc0<bool> IntlTerm;
430 TModuleProc3<HGLOBAL,HINSTANCE,LPCTSTR,DLGPROC> SpecialLoadDialog;
431 TModuleProc3<HGLOBAL,HGLOBAL,HINSTANCE,DLGPROC> MangleDialog;
432 TModuleProc4<LRESULT,HWND,UINT,WPARAM,LPARAM> DefDlgProc;
433 TModuleProc4<LRESULT,HWND,UINT,WPARAM,LPARAM> DefGrayDlgProc;
434 TModuleProc4<LRESULT,HWND,UINT,WPARAM,LPARAM> DefWindowProc;
435 TModuleProc4<LRESULT,HWND,UINT,WPARAM,LPARAM> DefMDIChildProc;
436 TModuleProc4<int,HWND,LPCTSTR,LPCTSTR,UINT> MessageBox;
437 TModuleProc0<HBRUSH> GetPattern;
438 TModuleProc0<DWORD> GetVersion;
444#if defined(OWL_SUPPORT_CTL3D)
467 TModuleProc1<BOOL,HANDLE> Register;
468 TModuleProc1<BOOL,HANDLE> Unregister;
469 TModuleProc1<BOOL,HANDLE> AutoSubclass;
472 TModuleProc3<HBRUSH,uint,WPARAM,LPARAM> CtlColorEx;
473 TModuleProc2<BOOL,HWND,uint16> SubclassDlg;
476 TModuleProc2<BOOL,HWND,DWORD> SubclassDlgEx;
477 TModuleProc0<WORD> GetVer;
478 TModuleProc0<BOOL> Enabled;
479 TModuleProc0<BOOL> ColorChange;
480 TModuleProc1<BOOL,HWND> SubclassCtl;
481 TModuleProc4<LONG,HWND,UINT,WPARAM,LPARAM> DlgFramePaint;
483 TModuleProc0<int> WinIniChange;
546 void SetLanguage(
const TLangId& langId);
610 return hPrevInstance;
646 return GetInitCmdLine();
667 return ::owl::GetWindowPtr(hWnd,
this);
696 HINSTANCE hPrevInstance,
701 InitHInstance = hInstance;
702 InitHPrevInstance = hPrevInstance;
703 GetInitCmdLine() = cmdLine;
704 InitCmdShow = cmdShow;
716 hPrevInstance = InitHPrevInstance;
717 nCmdShow = InitCmdShow;
720#if defined(OWL_SUPPORT_BWCC)
725inline bool TApplication::BWCCEnabled()
const
734inline TBwccDll* TApplication::GetBWCCModule()
const
740#if defined(OWL_SUPPORT_CTL3D)
745inline bool TApplication::Ctl3dEnabled()
const
753inline TCtl3dDll* TApplication::GetCtl3dModule()
const
770 MainWindow =
nullptr;
776 return MessageBox(wnd, text.c_str(), caption.empty() ?
nullptr : caption.c_str(), type);
TAppDictionary implementation for DLLs only.
Derived from TModule and TMsgThread and virtually derived from TEventHandler, TApplication acts as an...
virtual bool ProcessAppMsg(MSG &msg)
Called after each message is pulled from the queue, and before it is dispatched.
TDocManager * GetDocManager()
Return the current document manager.
int GetCmdShow() const
Retrieve the initial state of the main window.
TCurrentEvent & GetCurrentEvent()
Return the current event from the message queue.
virtual void ObjectSignaled(HANDLE, bool)
void SetPrevInstance(HINSTANCE pi)
Set the previous instance.
static tstring & GetCmdLine()
Return the command line of the application.
void GetWinMainParams()
Retrieve the WinMain parameters.
int MessageBox(HWND wnd, const tstring &text, const tstring &caption=tstring(), uint type=MB_OK) const
virtual void WaitOnObject(HANDLE handle, bool wait)
HINSTANCE GetPrevInstance() const
Return the HINSTANCE of the previous running instance.
auto IdleAction(long idleCount) -> bool override
Called each time there are no messages in the queue.
auto MessageLoop() -> int override
Operates the application's message loop, which runs during the lifetime of the application.
TWindow * GetWindowPtr(HWND hWnd) const
Get the TWindow pointer belonging to this app given an hWnd.
void ClearMainWindow()
Called by the main window (TFrameWindow) destructor to zero the MainWindow member.
void SetLangId(TLangId landid)
Sets new language for use with application.
auto Run() -> int override
Run this application, return when application terminates.
void SetCmdShow(int cmdshow)
Sets the initial state of the main window.
auto ProcessMsg(MSG &) -> bool override
Called for each message that is pulled from the queue, to perform all translation & dispatching.
virtual bool CanClose()
Determine whether the application can be closed.
bool HasSuspendedException() const
TLangId GetLangId() const
Returns identifier of language used by application.
TApplication(LPCTSTR name=nullptr, TModule *&=owl::Module, TAppDictionary *=nullptr)
Constructor for use in OwlMain().
virtual int Start() noexcept
Start this application and return immediately. Used for component DLLs.
static void SetWinMainParams(HINSTANCE hInstance, HINSTANCE hPrevInstance, const tstring &cmdLine, int cmdShow)
Set the data members with data from WinMain.
TFrameWindow * GetMainWindow()
Return the current main window.
virtual TTooltip * GetTooltip() const
Get Tooltip.
TCursor, derived from TGdiBase, represents the GDI cursor object class.
TDocManager creates a document manager object that manages the list of current documents and register...
A nested class, TEventInfo provides specific information about the type of message sent,...
TEventHandler is a base class from which you can derive classes that handle messages.
TResult Dispatch(TEventInfo &info, TParam1, TParam2=0)
Takes the message data from TEventInfo's Msg data member and dispatches it to the correct event-handl...
Derived from TWindow, TFrameWindow controls such window-specific behavior as keyboard navigation and ...
TApplication * Application
TLangId GetLanguage() const
TLangModule(const tstring &prefix, const TApplication &appl)
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TMsgThread(TCurrent)
Attaches to the current running thread.
TPoint is a support class, derived from tagPOINT.
void Restore()
Restores old state of cursor.
void Message(const tstring &text)
Sends text to the applications TMessageBar::SetHintText function if it has one.
TWaitCursor()
Activates the wait cursor.
void SetCursor(TCursor *cursor, TAutoDelete=AutoDelete)
Changes the cursor to cursor.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
A nested class, TXInvalidMainWindow describes an exception that results from an invalid Window.
TXInvalidMainWindow * Clone()
TXInvalidMainWindow()
Constructs a TXInvalidMainWindow object with a default IDS_INVALIDMAINWINDOW.
static void Raise()
Throws a TXInvalidMainWindow exception.
void Throw()
Throws the exception object.
Definition of TEventHandler and related classes & macros.
Definition of base most abstract GDI object class, and associated exception class.
#define DECLARE_STREAMABLE_OWL(cls, ver)
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
#define DECLARE_STREAMABLE_INLINES(cls)
TXOwl(const tstring &msg, uint resId=0)
An OWL exception with a given message for displaying and an unsigned Id that can be used for identifi...
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.
void InitModule(THandle handle, const tstring &cmdLine)
Finish-up initialization of a module.
TLocaleString - localized name support.
Definition of class TModule.
Definition of message queue oriented thread class support.
Object Windows Library (OWLNext Core).
TMessageBox SetDefMessageBox(TMessageBox)
UINT TMsgId
Message ID type.
int(*) TMessageBox(HWND wnd, LPCTSTR text, const LPCTSTR caption, uint type)
int OWLMessageBox(HWND wnd, const tstring &text, const tstring &caption, uint type)
TWindow * GetWindowPtr(HWND, const TApplication *)
Raw function to retrieve a TWindow pointer given an HWND from the a given app, or any app (app==0).
owl::uint16 TLangId
Holds a language ID, a predefined number that represents a base language and dialect.
LPARAM TParam2
Second parameter type.
WPARAM TParam1
First parameter type.
LRESULT TResult
Result type.
General definitions used by all ObjectWindows programs.
Current event structure for windows events.
TMsgId Message
Message ID.
TWindow * Win
Window that message was sent/dispatched to.
TParam1 Param1
First parameter (WPARAM).
TParam2 Param2
Second parameter (LPARAM).