Skip to content

Commit

Permalink
Revert "Allow customizing wxBusyInfo appearance."
Browse files Browse the repository at this point in the history
This reverts commit 434c95e.

Conflicts:
	docs/changes.txt
	include/wx/busyinfo.h
	src/generic/busyinfo.cpp
  • Loading branch information
tgoyne committed Nov 30, 2014
1 parent 2e8ca58 commit 54e23e4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 319 deletions.
1 change: 0 additions & 1 deletion docs/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Unix:
All (GUI):

- Allow requesting modern (3.x+) OpenGL version in wxGLCanvas (Fabio Arnold).
- Allow customizing window shown by wxBusyInfo.
- Make results of wxDC::DrawEllipticArc() consistent across all platforms.
- XRC handler for wxAuiToolBar added (Kinaou Hervé, David Hart).
- Add wxCursor::GetHotSpot().
Expand Down
58 changes: 0 additions & 58 deletions include/wx/busyinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,64 +13,6 @@

#if wxUSE_BUSYINFO

#include "wx/colour.h"
#include "wx/icon.h"

class WXDLLIMPEXP_FWD_CORE wxWindow;

// This class is used to pass all the various parameters to wxBusyInfo ctor.
// According to the usual naming conventions (see wxAboutDialogInfo,
// wxFontInfo, ...) it would be called wxBusyInfoInfo, but this would have been
// rather strange, so we call it wxBusyInfoFlags instead.
//
// Methods are mostly self-explanatory except for the difference between "Text"
// and "Label": the former can contain markup, while the latter is just plain
// string which is not parsed in any way.
class wxBusyInfoFlags
{
public:
wxBusyInfoFlags()
{
m_parent = NULL;
m_alpha = wxALPHA_OPAQUE;
}

wxBusyInfoFlags& Parent(wxWindow* parent)
{ m_parent = parent; return *this; }

wxBusyInfoFlags& Icon(const wxIcon& icon)
{ m_icon = icon; return *this; }
wxBusyInfoFlags& Title(const wxString& title)
{ m_title = title; return *this; }
wxBusyInfoFlags& Text(const wxString& text)
{ m_text = text; return *this; }
wxBusyInfoFlags& Label(const wxString& label)
{ m_label = label; return *this; }

wxBusyInfoFlags& Foreground(const wxColour& foreground)
{ m_foreground = foreground; return *this; }
wxBusyInfoFlags& Background(const wxColour& background)
{ m_background = background; return *this; }

wxBusyInfoFlags& Transparency(wxByte alpha)
{ m_alpha = alpha; return *this; }

private:
wxWindow* m_parent;

wxIcon m_icon;
wxString m_title,
m_text,
m_label;

wxColour m_foreground,
m_background;

wxByte m_alpha;

friend class wxBusyInfo;
};

#include "wx/generic/busyinfo.h"

#endif // wxUSE_BUSYINFO
Expand Down
12 changes: 1 addition & 11 deletions include/wx/generic/busyinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,11 @@ class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_CORE wxBusyInfo : public wxObject
{
public:
wxBusyInfo(const wxBusyInfoFlags& flags)
{
Init(flags);
}

wxBusyInfo(const wxString& message, wxWindow *parent = NULL)
{
Init(wxBusyInfoFlags().Parent(parent).Label(message));
}
wxBusyInfo(const wxString& message, wxWindow *parent = NULL);

virtual ~wxBusyInfo();

private:
void Init(const wxBusyInfoFlags& flags);

wxFrame *m_InfoFrame;

wxDECLARE_NO_COPY_CLASS(wxBusyInfo);
Expand Down
134 changes: 3 additions & 131 deletions interface/wx/busyinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@
@class wxBusyInfo
This class makes it easy to tell your user that the program is temporarily busy.
Normally the main thread should always return to the main loop to continue
dispatching events as quickly as possible, hence this class shouldn't be
needed. However if the main thread does need to block, this class provides
a simple way to at least show this to the user: just create a wxBusyInfo
object on the stack, and within the current scope, a message window will be
shown.
Just create a wxBusyInfo object on the stack, and within the current scope,
a message window will be shown.
For example:
Expand All @@ -31,28 +26,6 @@
It works by creating a window in the constructor, and deleting it
in the destructor.
This window is rather plain by default but can be customized by passing
wxBusyInfo constructor an object of wxBusyInfoFlags class instead of a
simple message. Here is an example from the @ref page_samples_dialogs:
@code
wxBusyInfo info
(
wxBusyInfoFlags()
.Parent(this)
.Icon(wxArtProvider::GetIcon(wxART_PRINT,
wxART_OTHER, wxSize(128, 128)))
.Title("<b>Printing your document</b>")
.Text("Please wait...")
.Foreground(*wxWHITE)
.Background(*wxBLACK)
.Transparency(4*wxALPHA_OPAQUE/5)
);
@endcode
showing that separate title and text can be set, and that simple markup
(@ref wxControl::SetLabelMarkup()) can be used in them, and that it's also
possible to add an icon and customize the colours and transparency of the
window.
You may also want to call wxTheApp->Yield() to refresh the window
periodically (in case it had been obscured by other windows, for
example) like this:
Expand Down Expand Up @@ -84,25 +57,7 @@ class wxBusyInfo
{
public:
/**
General constructor.
This constructor allows to specify all supported attributes by calling
the appropriate methods on wxBusyInfoFlags object passed to it as
parameter. All of them are optional but usually at least the message
should be specified.
@since 3.1.0
*/
wxBusyInfo(const wxBusyInfoFlags& flags);

/**
Simple constructor specifying only the message and the parent.
This constructs a busy info window as child of @a parent and displays
@a msg in it. It is exactly equivalent to using
@code
wxBusyInfo(wxBusyInfoFlags().Parent(parent).Label(message))
@endcode
Constructs a busy info window as child of @a parent and displays @e msg in it.
@note If @a parent is not @NULL you must ensure that it is not
closed while the busy info is shown.
Expand All @@ -115,86 +70,3 @@ class wxBusyInfo
virtual ~wxBusyInfo();
};

/**
Parameters for wxBusyInfo.
This class exists only in order to make passing attributes to wxBusyInfo
constructor easier and the code doing it more readable.
All methods of this class return the reference to the object on which they
are called, making it possible to chain them together, e.g. typically you
would just create a temporary wxBusyInfoFlags object and then call the
methods corresponding to the attributes you want to set, before finally
passing the result to wxBusyInfo constructor, e.g.:
@code
wxBusyInfo info
(
wxBusyInfoFlags()
.Parent(window)
.Icon(icon)
.Title("Some text")
.Text("Some more text")
.Foreground(wxColour(...))
.Background(wxColour(...))
);
@endcode
@since 3.1.0
*/
class wxBusyInfoFlags
{
public:
/**
Default constructor initializes all attributes to default values.
Call the other methods to really fill in the object.
*/
wxBusyInfoFlags();

/// Sets the parent for wxBusyInfo.
wxBusyInfoFlags& Parent(wxWindow* parent);

/// Sets the icon to show in wxBusyInfo.
wxBusyInfoFlags& Icon(const wxIcon& icon);

/**
Sets the title, shown prominently in wxBusyInfo window.
The @a title string may contain markup as described in
wxControl::SetLabelMarkup().
*/
wxBusyInfoFlags& Title(const wxString& title);

/**
Sets the more detailed text, shown under the title, if any.
The @a text string may contain markup as described in
wxControl::SetLabelMarkup().
*/
wxBusyInfoFlags& Text(const wxString& text);

/**
Same as Text() but doesn't interpret the string as containing markup.
This method should be used if the text shown in wxBusyInfo comes from
external source and so may contain characters having special meaning in
simple markup, e.g. '<'.
*/
wxBusyInfoFlags& Label(const wxString& label);

/// Sets the foreground colour of the title and text strings.
wxBusyInfoFlags& Foreground(const wxColour& foreground);

/// Sets the background colour of wxBusyInfo window.
wxBusyInfoFlags& Background(const wxColour& background);

/**
Sets the transparency of wxBusyInfo window.
@param alpha Value in wxALPHA_TRANSPARENT (0) to wxALPHA_OPAQUE (255)
range.
@see wxTopLevelWindow::SetTransparent()
*/
wxBusyInfoFlags& Transparency(wxByte alpha);
};
25 changes: 1 addition & 24 deletions samples/dialogs/dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)

#if wxUSE_BUSYINFO
EVT_MENU(DIALOGS_BUSYINFO, MyFrame::ShowBusyInfo)
EVT_MENU(DIALOGS_BUSYINFO_RICH, MyFrame::ShowRichBusyInfo)
#endif // wxUSE_BUSYINFO

#if wxUSE_FINDREPLDLG
Expand Down Expand Up @@ -475,7 +474,6 @@ bool MyApp::OnInit()

#if wxUSE_BUSYINFO
info_menu->Append(DIALOGS_BUSYINFO, wxT("&Busy info dialog\tCtrl-B"));
info_menu->Append(DIALOGS_BUSYINFO_RICH, wxT("&Rich busy info dialog\tShift-Ctrl-B"));
#endif // wxUSE_BUSYINFO

#if wxUSE_LOG_DIALOG
Expand Down Expand Up @@ -2424,28 +2422,7 @@ void MyFrame::ShowBusyInfo(wxCommandEvent& WXUNUSED(event))
}

wxSleep(2);
}

void MyFrame::ShowRichBusyInfo(wxCommandEvent& WXUNUSED(event))
{
wxWindowDisabler disableAll;

// This is just an example and not an encouragement for printing
// synchronously from the main thread.
wxBusyInfo info
(
wxBusyInfoFlags()
.Parent(this)
.Icon(wxArtProvider::GetIcon(wxART_PRINT,
wxART_OTHER, wxSize(128, 128)))
.Title("<b>Printing your document</b>")
.Text("Please wait...")
.Foreground(*wxWHITE)
.Background(*wxBLACK)
.Transparency(4*wxALPHA_OPAQUE/5)
);

wxSleep(5);
//wxWakeUpIdle();
}

#endif // wxUSE_BUSYINFO
Expand Down
2 changes: 0 additions & 2 deletions samples/dialogs/dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ class MyFrame: public wxFrame

#if wxUSE_BUSYINFO
void ShowBusyInfo(wxCommandEvent& event);
void ShowRichBusyInfo(wxCommandEvent& event);
#endif // wxUSE_BUSYINFO

#if wxUSE_FINDREPLDLG
Expand Down Expand Up @@ -578,7 +577,6 @@ enum
DIALOGS_ABOUTDLG_FULL,
DIALOGS_ABOUTDLG_CUSTOM,
DIALOGS_BUSYINFO,
DIALOGS_BUSYINFO_RICH,
DIALOGS_FIND,
DIALOGS_REPLACE,
DIALOGS_REQUEST,
Expand Down
Loading

0 comments on commit 54e23e4

Please sign in to comment.