cleanup: define events correctly, define type-safe event macros, reformatted
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -23,23 +23,27 @@
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/gizmos/dynamicsash.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/cmdline.h>
|
||||
#include "wx/app.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/gizmos/dynamicsash.h"
|
||||
#include "wx/html/htmlwin.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/cmdline.h"
|
||||
|
||||
class Demo : public wxApp {
|
||||
class Demo : public wxApp
|
||||
{
|
||||
public:
|
||||
bool OnInit();
|
||||
};
|
||||
|
||||
class SashHtmlWindow : public wxHtmlWindow {
|
||||
class SashHtmlWindow : public wxHtmlWindow
|
||||
{
|
||||
public:
|
||||
SashHtmlWindow(wxWindow *parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxHW_SCROLLBAR_NEVER, const wxString& name = wxT("sashHtmlWindow"));
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxHW_SCROLLBAR_NEVER,
|
||||
const wxString& name = wxT("sashHtmlWindow"));
|
||||
|
||||
wxSize DoGetBestSize() const;
|
||||
|
||||
@@ -51,7 +55,7 @@ private:
|
||||
|
||||
IMPLEMENT_APP(Demo)
|
||||
|
||||
wxChar *HTML_content =
|
||||
const wxChar *HTML_content =
|
||||
wxT("<P><H1>wxDynamicSashWindow demo</H1>")
|
||||
wxT("<P>Here is an example of how you can use <TT>wxDynamicSashWindow</TT> to allow your users to ")
|
||||
wxT("dynamically split and unify the views of your windows. Try dragging out a few splits ")
|
||||
@@ -59,7 +63,8 @@ wxT("and then reunifying the window.")
|
||||
wxT("<P>Also, see the <TT>dynsash_switch</TT> sample for an example of an application which ")
|
||||
wxT("manages the scrollbars provided by <TT>wxDynamicSashWindow</TT> itself.");
|
||||
|
||||
bool Demo::OnInit() {
|
||||
bool Demo::OnInit()
|
||||
{
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
wxFrame *frame = new wxFrame(NULL, wxID_ANY, wxT("Dynamic Sash Demo"));
|
||||
@@ -76,27 +81,34 @@ bool Demo::OnInit() {
|
||||
|
||||
|
||||
SashHtmlWindow::SashHtmlWindow(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name) :
|
||||
wxHtmlWindow(parent, id, pos, size, style, name) {
|
||||
Connect(wxID_ANY, wxEVT_DYNAMIC_SASH_SPLIT, (wxObjectEventFunction)
|
||||
(wxEventFunction)
|
||||
(wxDynamicSashSplitEventFunction)&SashHtmlWindow::OnSplit);
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
: wxHtmlWindow(parent, id, pos, size, style, name)
|
||||
{
|
||||
Connect(wxEVT_DYNAMIC_SASH_SPLIT,
|
||||
wxDynamicSashSplitEventHandler(SashHtmlWindow::OnSplit));
|
||||
|
||||
m_dyn_sash = parent;
|
||||
}
|
||||
|
||||
wxSize SashHtmlWindow::DoGetBestSize() const {
|
||||
wxSize SashHtmlWindow::DoGetBestSize() const
|
||||
{
|
||||
wxHtmlContainerCell *cell = GetInternalRepresentation();
|
||||
wxSize size = GetSize();
|
||||
|
||||
if (cell) {
|
||||
if (cell)
|
||||
{
|
||||
cell->Layout(size.GetWidth());
|
||||
return wxSize(cell->GetWidth(), cell->GetHeight());
|
||||
} else
|
||||
return wxHtmlWindow::GetBestSize();
|
||||
}
|
||||
|
||||
return wxHtmlWindow::GetBestSize();
|
||||
}
|
||||
|
||||
void SashHtmlWindow::OnSplit(wxDynamicSashSplitEvent& WXUNUSED(event)) {
|
||||
void SashHtmlWindow::OnSplit(wxDynamicSashSplitEvent& WXUNUSED(event))
|
||||
{
|
||||
wxHtmlWindow *html = new SashHtmlWindow(m_dyn_sash, wxID_ANY);
|
||||
html->SetPage(HTML_content);
|
||||
}
|
||||
|
Reference in New Issue
Block a user