1 | /* buttontaghandler.cc |
---|
2 | * Handle avenbutton tags |
---|
3 | * |
---|
4 | * Copyright (C) 2010 Olly Betts |
---|
5 | * |
---|
6 | * This program is free software; you can redistribute it and/or modify |
---|
7 | * it under the terms of the GNU General Public License as published by |
---|
8 | * the Free Software Foundation; either version 2 of the License, or |
---|
9 | * (at your option) any later version. |
---|
10 | * |
---|
11 | * This program is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | * GNU General Public License for more details. |
---|
15 | * |
---|
16 | * You should have received a copy of the GNU General Public License |
---|
17 | * along with this program; if not, write to the Free Software |
---|
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
19 | */ |
---|
20 | |
---|
21 | #include <config.h> |
---|
22 | |
---|
23 | #include "aven.h" |
---|
24 | #include <wx/html/htmlwin.h> |
---|
25 | #include <wx/html/m_templ.h> |
---|
26 | #include <wx/html/forcelnk.h> |
---|
27 | |
---|
28 | FORCE_LINK_ME(buttontaghandler) |
---|
29 | |
---|
30 | TAG_HANDLER_BEGIN(AVENBUTTON, "AVENBUTTON") |
---|
31 | TAG_HANDLER_PROC(tag) { |
---|
32 | int id; |
---|
33 | if (!tag.GetParamAsInt(wxT("id"), &id)) |
---|
34 | id = -1; |
---|
35 | wxHtmlContainerCell * cells = m_WParser->GetContainer(); |
---|
36 | cells->SetAlignHor(wxHTML_ALIGN_RIGHT); |
---|
37 | wxWindow * win = m_WParser->GetWindowInterface()->GetHTMLWindow(); |
---|
38 | wxButton * but = new wxButton(win, id, tag.GetParam(wxT("name"))); |
---|
39 | if (tag.HasParam(wxT("default"))) |
---|
40 | but->SetDefault(); |
---|
41 | cells->InsertCell(new wxHtmlWidgetCell(but)); |
---|
42 | return false; |
---|
43 | } |
---|
44 | TAG_HANDLER_END(TITLE) |
---|
45 | |
---|
46 | TAGS_MODULE_BEGIN(CavernLog) |
---|
47 | TAGS_MODULE_ADD(AVENBUTTON) |
---|
48 | TAGS_MODULE_END(CavernLog) |
---|