Files
wxWidgets/src/xrc/xh_htmllbox.cpp
Dimitri Schoolwerth 80fdcdb90e No changes, synchronised source names that appear commented at the top of files with the actual path to the files.
Fixed commented names (path, filename, and extension) of files in include/ and src/. Prepended the names in src/ with "src/" everywhere, while starting those in include/wx/ with "wx/".

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67254 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-03-20 00:14:35 +00:00

87 lines
2.4 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: src/xrc/xh_simplehtmllbox.cpp
// Purpose: XML resource handler for wxSimpleHtmlListBox
// Author: Francesco Montorsi
// Created: 2006/10/21
// RCS-ID: $Id$
// Copyright: (c) 2006 Francesco Montorsi
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_XRC && wxUSE_HTML
#include "wx/xrc/xh_htmllbox.h"
#include "wx/htmllbox.h"
#include "wx/filesys.h"
IMPLEMENT_DYNAMIC_CLASS(wxSimpleHtmlListBoxXmlHandler, wxXmlResourceHandler)
wxSimpleHtmlListBoxXmlHandler::wxSimpleHtmlListBoxXmlHandler()
: wxXmlResourceHandler(), m_insideBox(false)
{
XRC_ADD_STYLE(wxHLB_DEFAULT_STYLE);
XRC_ADD_STYLE(wxHLB_MULTIPLE);
AddWindowStyles();
}
wxObject *wxSimpleHtmlListBoxXmlHandler::DoCreateResource()
{
if ( m_class == wxT("wxSimpleHtmlListBox"))
{
// find the selection
long selection = GetLong(wxT("selection"), -1);
// need to build the list of strings from children
m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
m_insideBox = false;
XRC_MAKE_INSTANCE(control, wxSimpleHtmlListBox)
control->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList,
GetStyle(wxT("style"), wxHLB_DEFAULT_STYLE),
wxDefaultValidator,
GetName());
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
wxString str = GetNodeContent(m_node);
if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
str = wxGetTranslation(str, m_resource->GetDomain());
strList.Add(str);
return NULL;
}
}
bool wxSimpleHtmlListBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxSimpleHtmlListBox")) ||
(m_insideBox && node->GetName() == wxT("item")));
}
#endif // wxUSE_XRC && wxUSE_HTML