OWLNext
7.0
Borland's Object Windows Library for the modern age
Toggle main menu visibility
Loading...
Searching...
No Matches
trayicon.h
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
// ObjectWindows
3
// Copyright (c) 1998 bBidus Yura, All Rights Reserved
4
//
5
//------------------------------------------------------------------------------
6
7
#if !defined(OWL_TRAYICON_H)
8
#define OWL_TRAYICON_H
9
10
#include <
owl/private/defs.h
>
11
#if defined(BI_HAS_PRAGMA_ONCE)
12
# pragma once
13
#endif
14
15
#include <
owl/defs.h
>
16
#include <
owl/wsyscls.h
>
17
#include <
owl/gdiobjec.h
>
18
#include <
owl/eventhan.h
>
19
20
#include <shellapi.h>
21
22
namespace
owl
{
23
24
class
_OWLCLASS
TModule
;
25
26
#include <
owl/preclass.h
>
27
28
//
29
/// \class TTrayIcon
30
// ~~~~~ ~~~~~~~~~
31
//
32
class
_OWLCLASS
TTrayIcon
:
protected
NOTIFYICONDATA {
33
public
:
34
TTrayIcon
(
TModule
* module = &
GetGlobalModule
());
35
TTrayIcon
(
TWindow
* parent,
TMsgId
,
const
tstring
& tip,
TIcon
& icon,
uint
id
,
TModule
* module = &
GetGlobalModule
());
36
TTrayIcon
(
TWindow
* parent,
TMsgId
,
const
tstring
& tip,
TResId
icon,
uint
id
,
TModule
* module = &
GetGlobalModule
());
37
virtual
void
Init
(
TWindow
* parent,
TMsgId
,
const
tstring
& tip,
TIcon
* icon=0,
uint
id
=0);
38
virtual
~TTrayIcon
();
39
40
// Operations
41
public
:
42
bool
Enabled
()
const
;
43
bool
Visible
()
const
;
44
45
/// Create the tray icon => must have valid hWnd => call in SetupWindow();
46
bool
Create
();
47
48
//Change or retrieve the Tooltip text
49
bool
SetText
(
const
tstring
& text);
50
bool
SetText
(
TResId
resId);
51
tstring
GetText
()
const
;
52
53
//Change or retrieve the window to send notification messages to
54
bool
SetParent
(
TWindow
* wnd);
55
TWindow
*
GetParent
()
const
;
56
57
//Change or retrieve the icon displayed
58
bool
SetIcon
(
TIcon
& icon,
TAutoDelete
=
NoAutoDelete
);
59
bool
SetIcon
(
TResId
resId);
60
TIcon
*
GetIcon
()
const
;
61
62
63
void
HideIcon
();
64
void
ShowIcon
();
65
void
RemoveIcon
();
66
void
MoveToRight
();
67
68
/// Default handler for tray notification message
69
TResult
EvTrayNotification
(
TParam1
,
TParam2
);
70
71
// Implementation
72
protected
:
73
bool
bEnabled
;
///< does O/S support tray icon?
74
bool
bHidden
;
///< Has the icon been hidden?
75
TWindow
*
Parent
;
76
TModule
*
Module
;
77
TIcon
*
Icon
;
78
bool
ShouldDelete
;
79
80
//DECLARE_DYNAMIC(TTrayIcon)
81
};
82
83
#include <
owl/posclass.h
>
84
85
inline
bool
TTrayIcon::Enabled
()
const
{
86
return
bEnabled
;
87
}
88
inline
bool
TTrayIcon::Visible
()
const
{
89
return
!
bHidden
;
90
}
91
inline
TWindow
*
TTrayIcon::GetParent
()
const
{
92
return
Parent
;
93
}
94
inline
bool
TTrayIcon::SetText
(
TResId
resId){
95
return
SetText
(
Module
->
LoadString
(resId.
GetInt
()));
96
}
97
98
inline
bool
TTrayIcon::SetIcon
(
TResId
resId){
99
return
SetIcon
(*
new
TIcon
(
Module
? (HINSTANCE)*
Module
: HINSTANCE(
nullptr
), resId),
AutoDelete
);
100
}
101
102
}
// OWL namespace
103
104
105
#endif
// #define OWL_TRAYICON_H
106
owl::TIcon
TIcon, derived from TGdiObject, represents the GDI object icon class.
Definition
gdiobjec.h:670
owl::TIcon::TIcon
TIcon(HICON handle, TAutoDelete autoDelete=NoAutoDelete)
Creates a TIcon object and sets the Handle data member to the given borrowed handle.
Definition
icon.cpp:22
owl::TModule
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition
module.h:78
owl::TResId
Definition
wsyscls.h:206
owl::TResIdT::GetInt
WORD GetInt() const
Returns the encapsulated numerical identifier, provided this resource identifier encodes a numerical ...
Definition
wsyscls.h:92
owl::TTrayIcon::SetParent
bool SetParent(TWindow *wnd)
Definition
trayicon.cpp:268
owl::TTrayIcon::SetText
bool SetText(const tstring &text)
Definition
trayicon.cpp:244
owl::TTrayIcon::Parent
TWindow * Parent
Definition
trayicon.h:75
owl::TTrayIcon::MoveToRight
void MoveToRight()
Definition
trayicon.cpp:166
owl::TTrayIcon::bEnabled
bool bEnabled
does O/S support tray icon?
Definition
trayicon.h:73
owl::TTrayIcon::GetText
tstring GetText() const
Definition
trayicon.cpp:199
owl::TTrayIcon::HideIcon
void HideIcon()
Definition
trayicon.cpp:188
owl::TTrayIcon::bHidden
bool bHidden
Has the icon been hidden?
Definition
trayicon.h:74
owl::TTrayIcon::RemoveIcon
void RemoveIcon()
Definition
trayicon.cpp:175
owl::TTrayIcon::ShowIcon
void ShowIcon()
Definition
trayicon.cpp:207
owl::TTrayIcon::Init
virtual void Init(TWindow *parent, TMsgId, const tstring &tip, TIcon *icon=0, uint id=0)
Definition
trayicon.cpp:95
owl::TTrayIcon::EvTrayNotification
TResult EvTrayNotification(TParam1, TParam2)
Default handler for tray notification message.
Definition
trayicon.cpp:287
owl::TTrayIcon::ShouldDelete
bool ShouldDelete
Definition
trayicon.h:78
owl::TTrayIcon::SetIcon
bool SetIcon(TIcon &icon, TAutoDelete=NoAutoDelete)
Definition
trayicon.cpp:225
owl::TTrayIcon::Enabled
bool Enabled() const
Definition
trayicon.h:85
owl::TTrayIcon::GetIcon
TIcon * GetIcon() const
owl::TTrayIcon::Icon
TIcon * Icon
Definition
trayicon.h:77
owl::TTrayIcon::Create
bool Create()
Create the tray icon => must have valid hWnd => call in SetupWindow();.
Definition
trayicon.cpp:138
owl::TTrayIcon::Visible
bool Visible() const
Definition
trayicon.h:88
owl::TTrayIcon::GetParent
TWindow * GetParent() const
Definition
trayicon.h:91
owl::TTrayIcon::TTrayIcon
TTrayIcon(TModule *module=&GetGlobalModule())
Definition
trayicon.cpp:55
owl::TTrayIcon::Module
TModule * Module
Definition
trayicon.h:76
owl::TWindow
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition
window.h:414
eventhan.h
Definition of TEventHandler and related classes & macros.
gdiobjec.h
Definition of abstract GDI object class and derived classes.
owl::TAutoDelete
TAutoDelete
Flag for Handle ctors to control Handle deletion in dtor.
Definition
gdibase.h:70
owl::AutoDelete
@ AutoDelete
Definition
gdibase.h:70
owl::NoAutoDelete
@ NoAutoDelete
Definition
gdibase.h:70
owl::TModule::LoadString
int LoadString(uint id, TCHAR *buf, int maxChars) const
Loads a string resource identified by id into the buffer pointed to by buff.
Definition
module.cpp:586
owl
Object Windows Library (OWLNext Core).
Definition
animctrl.h:22
owl::TMsgId
UINT TMsgId
Message ID type.
Definition
dispatch.h:53
owl::TParam2
LPARAM TParam2
Second parameter type.
Definition
dispatch.h:55
owl::TParam1
WPARAM TParam1
First parameter type.
Definition
dispatch.h:54
owl::TResult
LRESULT TResult
Result type.
Definition
dispatch.h:52
owl::tstring
std::string tstring
Definition
defs.h:79
owl::uint
unsigned int uint
Definition
number.h:25
owl::GetGlobalModule
TModule & GetGlobalModule()
Definition
global.cpp:48
defs.h
General definitions used by all ObjectWindows programs.
defs.h
_OWLCLASS
#define _OWLCLASS
Definition
defs.h:338
posclass.h
preclass.h
wsyscls.h
Classes for window system structure and type encapsulation.
include
owl
trayicon.h
Generated by
1.18.0