diff options
author | svntcreutz <svntcreutz@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f> | 2007-08-28 20:24:18 +0000 |
---|---|---|
committer | svntcreutz <svntcreutz@cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f> | 2007-08-28 20:24:18 +0000 |
commit | 97339954a86489d9f5fe451ed17a9c9915b29017 (patch) | |
tree | 4458d99d987da30787412ca36659abd1d7d04c57 /src/osdxmlitem.cpp | |
parent | 9d7b5af5135a30bc7d0be7773acb00a8b8b4684b (diff) | |
download | vdr-plugin-menuorg-97339954a86489d9f5fe451ed17a9c9915b29017.tar.gz vdr-plugin-menuorg-97339954a86489d9f5fe451ed17a9c9915b29017.tar.bz2 |
added new class with base cOsdItem and the needed modifications
git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/menuorg/trunk@6102 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f
Diffstat (limited to 'src/osdxmlitem.cpp')
-rw-r--r-- | src/osdxmlitem.cpp | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/src/osdxmlitem.cpp b/src/osdxmlitem.cpp new file mode 100644 index 0000000..653f932 --- /dev/null +++ b/src/osdxmlitem.cpp @@ -0,0 +1,121 @@ +/* + * vdr-menuorg - A plugin for the Linux Video Disk Recorder + * Copyright (C) 2007 Thomas Creutz, Tobias Grimm + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + * + */ + +#include <vdr/menu.h> +#include <libxml++/libxml++.h> + +cOsdXmlItem::cOsdXmlItem(const char* Text, const xmlpp::Element* xmlElement, eOSState State=osUnknown) +{ + text = NULL; + offset = -1; + state = State; + selectable = true; + fresh = true; + _xmlElement = xmlElement; + parseXmlElement(); + SetText(Text); +} + +void cOsdXmlItem::parseXmlElement(void) +{ + const Attribute* nameAttribute = _xmlElement->get_attribute("name"); + + string type = childElement->get_name(); + string name = nameAttribute->get_value(); + + setNameAttribute(name); + + if (type == "system") + { + setItemType(SYSTEM); + const Attribute* titleAttribute = childElement->get_attribute("title"); + string title = titleAttribute ? (string) titleAttribute->get_value() : ""; + setTitleAttribute(title); + } + else if (type == "plugin") + { + setItemType(PLUGIN); + const Attribute* titleAttribute = childElement->get_attribute("title"); + string title = titleAttribute ? (string) titleAttribute->get_value() : ""; + setTitleAttribute(title); + } + else if ( type == "menu") + { + setItemType(MENU); + } + else if (type == "command") + { + setItemType(COMMAND); + setCommandAttribute(); + setConfirmAttribute(); + } +} + +sItemType getItemType(void) +{ + return _ItemType; +} + +string getNameAttribute(void) +{ + return _nameAttribute; +} + +string getTitleAttribute(void) +{ + return _titleAttribute; +} + +string getCommandAttribute(void) +{ + return _commandAttribute; +} + +string getConfirmAttribute(void) +{ + return _confirmAttribute; +} + +void setItemType(sItemType type) +{ + _ItemType = type; +} + +void setNameAttribute(string name); +{ + _nameAttribute = name; +} + +void setTitleAttribute(string title) +{ + _titleAttribute = title; +} + +void setCommandAttribute(string command) +{ + _commandAttribute = command; +} + +void setConfirmAttribute(string confirm) +{ + _confirmAttribute = confirm; +} |