Fix coding nits.

- enums shouldn't be DLL-exported,
- Placement of "{"
- Always have dtor of wxGuage and wxFrame.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77636 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2014-09-10 14:57:20 +00:00
parent cf5b3021c6
commit 0c6b03c392
10 changed files with 53 additions and 40 deletions

View File

@@ -24,15 +24,14 @@
#define wxGA_HORIZONTAL wxHORIZONTAL
#define wxGA_VERTICAL wxVERTICAL
// Available since Windows 7 only. With this style, the value of guage will
// reflect on the taskbar button.
#define wxGA_PROGRESS 0x0010
// Win32 only, is default (and only) on some other platforms
#define wxGA_SMOOTH 0x0020
// QT only, display current completed percentage (text default format "%p%")
#define wxGA_TEXT 0x0040
#if wxUSE_TASKBARBUTTON
#define wxGA_PROGRESS 0x0010
#endif
// GTK and Mac always have native implementation of the indeterminate mode
// wxMSW has native implementation only if comctl32.dll >= 6.00
#if !defined(__WXGTK20__) && !defined(__WXMAC__)

View File

@@ -40,9 +40,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxFrameNameStr);
#if wxUSE_TASKBARBUTTON
virtual ~wxFrame();
#endif
// implement base class pure virtuals
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);

View File

@@ -37,9 +37,7 @@ public:
(void)Create(parent, id, range, pos, size, style, validator, name);
}
#if wxUSE_TASKBARBUTTON
virtual ~wxGauge();
#endif
bool Create(wxWindow *parent,
wxWindowID id,

View File

@@ -10,9 +10,10 @@
#ifndef _WX_MSW_TASKBARBUTTON_H_
#define _WX_MSW_TASKBARBUTTON_H_
#include "wx/defs.h"
#if wxUSE_TASKBARBUTTON
#include "wx/defs.h"
#include "wx/vector.h"
#include "wx/taskbarbutton.h"
@@ -62,6 +63,8 @@ private:
int m_progressRange;
bool m_hasInitThumbnailToolbar;
wxDECLARE_NO_COPY_CLASS(wxTaskBarButtonImpl);
};
#endif // wxUSE_TASKBARBUTTON

View File

@@ -11,9 +11,12 @@
#ifndef _WX_TASKBARBUTTON_H_
#define _WX_TASKBARBUTTON_H_
#include "wx/defs.h"
#if wxUSE_TASKBARBUTTON
#include "wx/defs.h"
#include "wx/icon.h"
#include "wx/string.h"
class WXDLLIMPEXP_FWD_CORE wxTaskBarButton;
class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListCategory;
@@ -27,7 +30,7 @@ class WXDLLIMPEXP_FWD_CORE wxTaskBarJumpListImpl;
/**
State of the task bar button.
*/
enum WXDLLIMPEXP_CORE wxTaskBarButtonState
enum wxTaskBarButtonState
{
wxTASKBAR_BUTTON_NO_PROGRESS = 0,
wxTASKBAR_BUTTON_INDETERMINATE = 1,
@@ -36,9 +39,12 @@ enum WXDLLIMPEXP_CORE wxTaskBarButtonState
wxTASKBAR_BUTTON_PAUSED = 8
};
class WXDLLIMPEXP_CORE wxThumbBarButton : public wxObject {
class WXDLLIMPEXP_CORE wxThumbBarButton : public wxObject
{
public:
wxThumbBarButton() : m_taskBarButtonParent(NULL) { }
wxThumbBarButton() : m_taskBarButtonParent(NULL)
{ }
wxThumbBarButton(int id,
const wxIcon& icon,
const wxString& tooltip = wxString(),
@@ -48,8 +54,6 @@ public:
bool shown = true,
bool interactive = true);
virtual ~wxThumbBarButton() {}
bool Create(int id,
const wxIcon& icon,
const wxString& tooltip = wxString(),
@@ -96,7 +100,7 @@ private:
bool m_interactive;
wxTaskBarButton *m_taskBarButtonParent;
DECLARE_DYNAMIC_CLASS(wxThumbBarButton)
wxDECLARE_DYNAMIC_CLASS(wxThumbBarButton);
};
class WXDLLIMPEXP_CORE wxTaskBarButton
@@ -141,9 +145,11 @@ private:
WXWidget m_parent;
int m_maxValue;
wxTaskBarButton* m_taskBarButton;
wxDECLARE_NO_COPY_CLASS(wxAppProgressIndicator);
};
enum WXDLLIMPEXP_CORE wxTaskBarJumpListItemType
enum wxTaskBarJumpListItemType
{
wxTASKBAR_JUMP_LIST_SEPARATOR,
wxTASKBAR_JUMP_LIST_TASK,
@@ -188,6 +194,8 @@ private:
wxString m_tooltip;
wxString m_iconPath;
int m_iconIndex;
wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpListItem);
};
typedef wxVector<wxTaskBarJumpListItem*> wxTaskBarJumpListItems;
@@ -217,6 +225,8 @@ private:
wxTaskBarJumpList *m_parent;
wxTaskBarJumpListItems m_items;
wxString m_title;
wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpListCategory);
};
typedef wxVector<wxTaskBarJumpListCategory*> wxTaskBarJumpListCategories;
@@ -240,12 +250,13 @@ public:
wxTaskBarJumpListCategory* RemoveCustomCategory(const wxString& title);
void DeleteCustomCategory(const wxString& title);
private:
friend class wxTaskBarJumpListCategory;
void Update();
wxTaskBarJumpListImpl *m_jumpListImpl;
wxDECLARE_NO_COPY_CLASS(wxTaskBarJumpList);
};
#endif // wxUSE_TASKBARBUTTON

View File

@@ -13,15 +13,14 @@
#define wxGA_HORIZONTAL wxHORIZONTAL
#define wxGA_VERTICAL wxVERTICAL
// Available since Windows 7 only. With this style, the value of guage will
// reflect on the taskbar button.
#define wxGA_PROGRESS 0x0010
// Win32 only, is default (and only) on some other platforms
#define wxGA_SMOOTH 0x0020
// QT only, display current completed percentage (text default format "%p%")
#define wxGA_TEXT 0x0040
// Available since Windows 7 only. With this style, the value of guage will
// reflect on the taskbar button.
#define wxGA_PROGRESS 0x0010
/**
@class wxGauge
@@ -53,6 +52,10 @@
Display current completed percentage: text default format "%p%"
(only supported in wxQt, may be not available on all platforms).
@since 3.1.0
@style{wxGA_PROGRESS}
Reflect the value of guage on the taskbar button, available since
Windows 7 only.
@since 3.1.0
@endStyleTable
@library{wxcore}

View File

@@ -7,6 +7,7 @@
/**
State of the taskbar button.
@since 3.1.0
*/
enum wxTaskBarButtonState
{
@@ -29,6 +30,7 @@ enum wxTaskBarButtonState
@onlyfor{wxmsw}
@see wxTaskBarButton
@since 3.1.0
*/
class WXDLLIMPEXP_CORE wxThumbBarButton {
public:
@@ -187,6 +189,7 @@ public:
@onlyfor{wxmsw}
@see wxFrame::MSWGetTaskBarButton()
@since 3.1.0
*/
class WXDLLIMPEXP_CORE wxTaskBarButton
{
@@ -339,6 +342,7 @@ public:
@onlyfor{wxmsw}
@see wxTaskBarButton
@since 3.1.0
*/
class WXDLLIMPEXP_CORE wxAppProgressIndicator
{
@@ -376,6 +380,8 @@ public:
/**
Type of jump list item.
@since 3.1.0
*/
enum wxTaskBarJumpListItemType
{
@@ -398,6 +404,7 @@ enum wxTaskBarJumpListItemType
@category{misc}
@onlyfor{wxmsw}
@since 3.1.0
*/
class WXDLLIMPEXP_CORE wxTaskBarJumpListItem
{
@@ -521,6 +528,8 @@ public:
/**
A vector of wxTaskBarJumpListItem pointers.
@since 3.1.0
*/
typedef wxVector<wxTaskBarJumpListItem*> wxTaskBarJumpListItems;
@@ -537,6 +546,8 @@ typedef wxVector<wxTaskBarJumpListItem*> wxTaskBarJumpListItems;
@onlyfor{wxmsw}
@see wxTaskBarJumpList, wxTaskBarJumpListItem
@since 3.1.0
*/
class WXDLLIMPEXP_CORE wxTaskBarJumpListCategory
{
@@ -644,6 +655,7 @@ typedef wxVector<wxTaskBarJumpListCategory*> wxTaskBarJumpListCategories;
@onlyfor{wxmsw}
@see wxTaskBarJumpListCategory, wxTaskBarJumpListItem
@since 3.1.0
*/
class WXDLLIMPEXP_CORE wxTaskBarJumpList
{

View File

@@ -206,9 +206,7 @@ bool wxGenericProgressDialog::Create( const wxString& title,
int gauge_style = wxGA_HORIZONTAL;
if ( style & wxPD_SMOOTH )
gauge_style |= wxGA_SMOOTH;
#if wxUSE_TASKBARBUTTON
gauge_style |= wxGA_PROGRESS;
#endif
#ifdef __WXMSW__
maximum /= m_factor;

View File

@@ -182,13 +182,12 @@ bool wxFrame::Create(wxWindow *parent,
return true;
}
#if wxUSE_TASKBARBUTTON
wxFrame::~wxFrame()
{
if ( m_taskBarButton )
delete m_taskBarButton;
}
#if wxUSE_TASKBARBUTTON
delete m_taskBarButton;
#endif
}
// ----------------------------------------------------------------------------
// wxFrame client size calculations

View File

@@ -99,11 +99,7 @@ bool wxGauge::Create(wxWindow *parent,
m_appProgressIndicator = NULL;
if ( (style & wxGA_PROGRESS) != 0 )
{
wxWindow* topParent = GetParent();
while (topParent != NULL && topParent->GetParent() != NULL)
{
topParent = topParent->GetParent();
}
wxWindow* topParent = wxGetTopLevelParent(this);
if ( topParent != NULL )
{
m_appProgressIndicator =
@@ -117,16 +113,12 @@ bool wxGauge::Create(wxWindow *parent,
return true;
}
#if wxUSE_TASKBARBUTTON
wxGauge::~wxGauge()
{
if ( m_appProgressIndicator )
{
delete m_appProgressIndicator;
m_appProgressIndicator = NULL;
}
}
#if wxUSE_TASKBARBUTTON
delete m_appProgressIndicator;
#endif
}
WXDWORD wxGauge::MSWGetStyle(long style, WXDWORD *exstyle) const
{