Kaydet (Commit) 1956ad6d authored tarafından Michael Meeks's avatar Michael Meeks

vcldemo: create --popup mode demonstrating Windows GL issue.

Change-Id: I562dc891173fbbc151adab39a0dfae42918f88af
üst 2e46594e
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <vcl/salbtype.hxx> #include <vcl/salbtype.hxx>
#include <vcl/bmpacc.hxx> #include <vcl/bmpacc.hxx>
#include <vcl/help.hxx> #include <vcl/help.hxx>
#include <basegfx/numeric/ftools.hxx> #include <basegfx/numeric/ftools.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b2dhommatrix.hxx>
#include <vcldemo-debug.hxx> #include <vcldemo-debug.hxx>
...@@ -1448,9 +1449,6 @@ class DemoWidgets : public WorkWindow ...@@ -1448,9 +1449,6 @@ class DemoWidgets : public WorkWindow
ToolBox *mpToolbox; ToolBox *mpToolbox;
PushButton *mpButton; PushButton *mpButton;
Timer maHelpTimer;
DECL_LINK (HelpTimerCb, void *);
public: public:
DemoWidgets() : DemoWidgets() :
WorkWindow(NULL, WB_STDWORK), WorkWindow(NULL, WB_STDWORK),
...@@ -1478,17 +1476,15 @@ public: ...@@ -1478,17 +1476,15 @@ public:
mpButton->Show(); mpButton->Show();
Show(); Show();
maHelpTimer.SetTimeoutHdl(LINK(this,DemoWidgets,HelpTimerCb));
maHelpTimer.SetTimeout(1000);
maHelpTimer.Start();
} }
virtual ~DemoWidgets() virtual ~DemoWidgets()
{ {
delete mpButton; delete mpButton;
delete mpToolbox; delete mpToolbox;
delete mpBox; delete mpBox;
} }
virtual void Paint(const Rectangle&) SAL_OVERRIDE virtual void Paint(const Rectangle&) SAL_OVERRIDE
{ {
Rectangle aWholeSize(Point(0, 0),GetOutputSizePixel()); Rectangle aWholeSize(Point(0, 0),GetOutputSizePixel());
...@@ -1516,17 +1512,44 @@ public: ...@@ -1516,17 +1512,44 @@ public:
} }
}; };
// Horrible code to manually provoke a help event class DemoPopup : public FloatingWindow
IMPL_LINK_NOARG(DemoWidgets,HelpTimerCb)
{ {
Point aPos = mpToolbox->GetPosPixel(); public:
aPos.Move(10,10); DemoPopup() : FloatingWindow( NULL, WB_SYSTEMWINDOW|WB_TOOLTIPWIN)
HelpEvent aHelpEvent( aPos, HelpEventMode::BALLOON ); {
// pSVData->maHelpData.mbRequestingHelp = true; SetType( WINDOW_HELPTEXTWINDOW );
mpToolbox->RequestHelp( aHelpEvent );
// pSVData->maHelpData.mbRequestingHelp = false; SetOutputSizePixel( Size( 300, 30 ) );
return 0; SetBackground(Wallpaper(COL_YELLOW));
}
Show( true, SHOW_NOACTIVATE );
Update();
}
virtual void Paint( const Rectangle& ) SAL_OVERRIDE
{
// Interestingly in GL mode on Windows, this doesn't render.
Size aSize = GetOutputSizePixel();
Rectangle aTextRect(Point(6, 6), aSize);
SetTextColor(COL_BLACK);
SetTextAlign(ALIGN_TOP);
DrawText(aTextRect, "This is a standalone help text test",
TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK|
TEXT_DRAW_LEFT|TEXT_DRAW_TOP);
SetLineColor(COL_BLACK);
SetFillColor();
DrawRect( Rectangle( Point(), aSize ) );
aSize.Width() -= 2;
aSize.Height() -= 2;
Color aColor( GetLineColor() );
SetLineColor( ( COL_GRAY ) );
DrawRect( Rectangle( Point( 1, 1 ), aSize ) );
SetLineColor( aColor );
}
};
class DemoApp : public Application class DemoApp : public Application
{ {
...@@ -1552,7 +1575,7 @@ public: ...@@ -1552,7 +1575,7 @@ public:
{ {
try try
{ {
bool bWidgets = false, bThreads = false; bool bWidgets = false, bThreads = false, bPopup = false;
DemoRenderer aRenderer; DemoRenderer aRenderer;
for (sal_Int32 i = 0; i < GetCommandLineParamCount(); i++) for (sal_Int32 i = 0; i < GetCommandLineParamCount(); i++)
...@@ -1577,6 +1600,8 @@ public: ...@@ -1577,6 +1600,8 @@ public:
} }
else if (aArg == "--widgets") else if (aArg == "--widgets")
bWidgets = true; bWidgets = true;
else if (aArg == "--popup")
bPopup = true;
else if (aArg == "--threads") else if (aArg == "--threads")
bThreads = true; bThreads = true;
else if (aArg.startsWith("--")) else if (aArg.startsWith("--"))
...@@ -1589,11 +1614,14 @@ public: ...@@ -1589,11 +1614,14 @@ public:
DemoWin aMainWin(aRenderer, bThreads); DemoWin aMainWin(aRenderer, bThreads);
std::unique_ptr<DemoWidgets> xWidgets; std::unique_ptr<DemoWidgets> xWidgets;
std::unique_ptr<DemoPopup> xPopup;
aMainWin.SetText("Interactive VCL demo #1"); aMainWin.SetText("Interactive VCL demo #1");
if (bWidgets) if (bWidgets)
xWidgets.reset(new DemoWidgets()); xWidgets.reset(new DemoWidgets());
else if (bPopup)
xPopup.reset(new DemoPopup());
else else
aMainWin.Show(); aMainWin.Show();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment