- Added code documentation for SysTray

- Added own doxygen generation file and additional a generated CHM file
This commit is contained in:
andre@woesten.com 2008-09-03 15:47:49 +00:00
parent 248b2eb33e
commit 56d9c246a5
4 changed files with 449 additions and 10 deletions

Binary file not shown.

View File

@ -0,0 +1,283 @@
# Doxyfile 1.5.6
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = win32cpp
PROJECT_NUMBER =
OUTPUT_DIRECTORY = win32cpp
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class " \
"The $name widget " \
"The $name file " \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH = ../src/win32cpp
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = YES
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
SORT_BRIEF_DOCS = YES
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = NO
SHOW_DIRECTORIES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text "
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src/win32cpp
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.d \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.idl \
*.odl \
*.cs \
*.php \
*.php3 \
*.inc \
*.m \
*.mm \
*.dox \
*.py \
*.f90
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = YES
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
HTML_DYNAMIC_SECTIONS = NO
CHM_FILE = win32cpp.chm
HHC_LOCATION = "C:/Program Files (x86)/HTML Help Workshop/hhc.exe"
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = YES
TOC_EXPAND = YES
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
FORMULA_FONTSIZE = 10
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_FONTNAME = FreeSans
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH = "C:/Program Files (x86)/doxygen/graphviz/bin"
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 1000
DOT_TRANSPARENT = YES
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

View File

@ -43,9 +43,17 @@
using namespace win32cpp;
///\brief Contains the list of notify icons
IconList SysTray::iconList;
///\brief Contains a list of menus for each icon
MenuList SysTray::menuList;
///\brief Contains a list of options for each icon
OptionsList SysTray::optionsList;
///\brief Each notify icon has its own UID. This counter increments
///when an icon is created.
int SysTray::uidCounter = 100;
SysTray::SysTray()
@ -61,15 +69,54 @@ SysTray::~SysTray()
}
}
///\brief
///Deletes an icon from the tray and all internal structures
///
///\param uid
///The Icon ID
///
///\return bool
bool SysTray::DeleteIcon(UINT uid)
{
if(SysTray::iconList.find(uid) != SysTray::iconList.end()) {
return (::Shell_NotifyIcon(NIM_DELETE, &SysTray::iconList[uid]) != 0);
if(::Shell_NotifyIcon(NIM_DELETE, &SysTray::iconList[uid]) != 0) {
SysTray::iconList.erase(uid);
SysTray::menuList.erase(uid);
SysTray::optionsList.erase(uid);
return true;
}
}
return false;
}
///\brief
///Shows a balloon tip over the tray icon
///
///\note
///Windows XP is required for this feature!
///
///\param uid
///The Icon ID
///
///\param title
///Balloon title
///
///\param text
///Balloon inner text
///
///\param timeout
///Time to show the balloon in seconds. There are special restrictions defined
///by the Windows-API. Look here:
///http://msdn.microsoft.com/en-us/library/bb773352(VS.85).aspx
///
///\param text
///Icon to show. Select from NIIF_NONE, NIIF_INFO, NIIF_WARNING, NIIF_ERROR
///
///\return bool
bool SysTray::ShowBalloon(UINT uid, const uistring& title, const uistring& text, UINT timeout, UINT icon)
{
if(SysTray::iconList.find(uid) != SysTray::iconList.end()) {
@ -86,6 +133,17 @@ bool SysTray::ShowBalloon(UINT uid, const uistring& title, const uistring& text,
return false;
}
///\brief
///Sets a new icon for the specified tray icon.
///
///\param uid
///The Icon ID
///
///\param icon
///New Icon
///
///\return bool
bool SysTray::SetIcon(UINT uid, HICON icon)
{
if(SysTray::iconList.find(uid) != SysTray::iconList.end()) {
@ -96,6 +154,17 @@ bool SysTray::SetIcon(UINT uid, HICON icon)
return false;
}
///\brief
///Sets the tooltip for the specified tray icon.
///
///\param uid
///The Icon ID
///
///\param tooltip
///Tooltip to show
///
///\return bool
bool SysTray::SetTooltip(UINT uid, const uistring& tooltip)
{
if(SysTray::iconList.find(uid) != SysTray::iconList.end()) {
@ -107,6 +176,18 @@ bool SysTray::SetTooltip(UINT uid, const uistring& tooltip)
return false;
}
///\brief
///Sets the popup menu for the specified tray icon.
///
///\param uid
///The Icon ID
///
///\param menu
///Reference to the menu which should be displayed
///
///\return bool
bool SysTray::SetPopupMenu(UINT uid, MenuRef menu)
{
if(menu) {
@ -117,6 +198,22 @@ bool SysTray::SetPopupMenu(UINT uid, MenuRef menu)
return false;
}
///\brief
///Window procedure for all SysTray handling. Here WM_RBUTTONDOWN (for popup menu),
///WM_LBUTTONDOWN (for restoring the window after it has been minimized to tray) &
///WM_SIZE for the Minimize to tray feature are handled.
///
///\param window
///Affected window handle
///
///\param message
///Message-ID
///
///\param wParam
///\param lParam
///\return LRESULT
///In this case always 0
LRESULT SysTray::WindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
{
if(SysTray::menuList.find(message - WM_W32CPP_SYSTRAY) != SysTray::menuList.end()) {
@ -177,11 +274,32 @@ LRESULT SysTray::WindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lPa
return 0;
}
///\brief
///Activates minimize to tray for the icon specified by uid.
///
///\param uid
///The Icon ID
void SysTray::EnableMinimizeToTray(UINT uid)
{
SysTray::optionsList[uid] |= SysTray::MINIMIZE_TO_TRAY;
}
///\brief
///Creates and add a notify icon
///
///\param window
///The window to associate the icon with
///
///\param icon
///The Icon to show as HICON
///
///\param tooltip
///The tooltip to show. Leave it empty to show no tooltip
///
///\return int
///Returns the new Icon ID or -1 on failure
int SysTray::AddIcon(Window* window, HICON icon, const uistring& tooltip)
{
UINT uid = SysTray::uidCounter++;

View File

@ -53,23 +53,61 @@ typedef std::map<UINT, NOTIFYICONDATA> IconList;
typedef std::map<UINT, MenuRef> MenuList;
typedef std::map<UINT, UINT> OptionsList;
///\brief
///The SysTray class is used for managing icons in the Taskbar. It must be
///seen as pure manager for the icons in the SysTray bar. Thus there are no
///special classes for TrayIcons.
///
///Since SysTray communicates using the handle of its associated window, it is
///necessary, that icons are associated to a window handle.
///
///That's why the SysTray component should NOT be used directly, but from the
///Application Singleton. Use Application::Instance().SysTrayManager() to
///get the SysTray object!
///
///Internally each icon has three lists associated:
///
/// - IconList iconList - with NOTIFYICONDATA structures
/// - MenuList menuList - with references to win32cpp's MenuRef
/// - OptionsList optionsList - option bits are set here
///
///Each notify icon is represted by its unique ID, which is assigned by
///AddIcon(). Using this ID you can access all other methods.
///
///Code example:
///\Example
///\code
///
/// // Create Menu
/// MenuRef myMenu = Menu::CreatePopup();
/// myMenu->Items().Append(MenuItem::Create(_T("Test 1")));
/// myMenu->Items().Append(MenuItem::Create(_T("Test 2")));
/// MenuItemRef trayExit = myMenu->Items().Append(MenuItem::Create(_T("E&xit")));
///
/// // Bind Exit to a handler
/// trayExit->Activated.connect(this, &MainWindowController::OnFileExit);
///
/// // Init tray icon
/// UINT uidTrayIcon = Application::Instance().SysTrayManager()->AddIcon(Application::Instance().MainWindow(), icon16);
/// Application::Instance().SysTrayManager()->SetTooltip(uidTrayIcon, _T("Test");
/// Application::Instance().SysTrayManager()->SetPopupMenu(uidTrayIcon, myMenu);
/// Application::Instance().SysTrayManager()->ShowBalloon(uidTrayIcon, _T("Test"), _T("Welcome to this application!"), 2);
/// Application::Instance().SysTrayManager()->EnableMinimizeToTray(uidTrayIcon);
///\endcode
///\see
///Application
///TopLevelWindow
///MenuRef
class SysTray {
private:
private: // types
///\brief List with per-icon options - need to be power of 2!
enum Options {
MINIMIZE_TO_TRAY = 1
};
// Contains the list of notify icons
static IconList iconList;
// Contains a list of menus for each icon
static MenuList menuList;
// Contains a list of options for each icon
static OptionsList optionsList;
// Each notify icon has its own UID. This counter increments
// when an icon is created.
static int uidCounter;
public: