Show wxDialog without taskbar/task switch icon from hidden wxFrame?
Volker Bartheld
dr_versaeg at freenet.de
Tue Oct 16 08:16:46 PDT 2007
Hi!
Subject says it all. As a kind of "progress notification" my app operates
a hidden wxFrame. Depending on its state, this frame shows a stacked pile
of "bare" dialogs growing from the right bottom of the screen. See below [1]
for some source code.
Problem is, that I can't keep the default icons from being shown in the task
switch popup (wxMSW, ALT-TAB) - 10 in case of the sample.
Is there a way to have a hidden app and show a window that is neither listed
in the taskbar nor with the task switch menu?
Any help appreciated.
Thanks in advance,
Volker
P.S.: No, I don't think this is a nice way to behave for an app either.
But as the design department wants it, I try to deliver...
[1]
<stackeddialogs.cpp>
#include <wx/wx.h>
#include <map>
class ProgressWidget : public wxDialog
{
public:
ProgressWidget(wxWindow* parent) : wxDialog(parent, wxID_ANY, wxT("ProgressWidget"), wxDefaultPosition, wxDefaultSize, wxSTAY_ON_TOP), m_iPos(0)
{
for(int i=1; i<=10; ++i) if(m_stack.end()==m_stack.find(i)) { m_stack[m_iPos=i]=GetId(); break; }
if(!m_iPos) { Destroy(); return; }
wxBoxSizer* pSizer=new wxBoxSizer(wxHORIZONTAL);
SetSizer(pSizer);
wxStaticText* pText=new wxStaticText(this, wxID_ANY, wxString::Format(wxT("label %i"), m_iPos));
pText->SetClientSize(200, 16);
pSizer->Add(pText, 0, wxALL|wxFIXED_MINSIZE|wxALIGN_CENTER, 1);
Fit();
}
ProgressWidget::~ProgressWidget() { m_stack.erase(GetId()); }
bool ProgressWidget::Show(bool show=true)
{
int w, h, x, y;
wxClientDisplayRect(&x, &y, &w, &h);
wxSize s(GetSize().GetWidth(), GetSize().GetHeight());
Move(wxPoint(w+x-s.GetWidth(), h+x-m_iPos*s.GetHeight()));
return wxDialog::Show(show);
}
private:
int m_iPos;
static std::map<wxWindowID, int> m_stack;
}; // class ProgressWidget : public wxDialog
std::map<wxWindowID, int> ProgressWidget::m_stack=std::map<wxWindowID, int>();
class MyFrame : public wxFrame
{
public:
MyFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title)
{
timer.SetOwner(this);
timer.Start(1000);
}
void OnTimer(wxTimerEvent&)
{
ProgressWidget* pProgressWidget=new ProgressWidget(this);
pProgressWidget->Show();
}
private:
MyFrame() {}
wxTimer timer;
DECLARE_EVENT_TABLE()
}; // class MyFrame : public wxFrame
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_TIMER(wxID_ANY, MyFrame::OnTimer)
END_EVENT_TABLE()
class MyApp : public wxApp
{
public:
virtual bool OnInit()
{
if(!wxApp::OnInit()) return false;
MyFrame *frame=new MyFrame(_T("Minimal wxWidgets App"));
return true;
}
}; // class MyApp : public wxApp
IMPLEMENT_APP(MyApp)
</stackeddialogs.cpp>
--
mailto: V B A R T H E L D at G M X dot D E
More information about the wx-users
mailing list