|
From: CVS C. to T. <the...@li...> - 2012-03-27 21:10:24
|
Revision: 691
http://themis.svn.sourceforge.net/themis/?rev=691&view=rev
Author: mark_hellegers
Date: 2012-03-27 21:10:15 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
- Moved some code around to make it more manageable.
- Attached BHandlers of the CSSViews to the BLooper. Some small issues remain, but still need to look into that.
- Fixed small problem with constructing an url. Needs to be rewritten, but works for now.
- Added support for forms. You can click on buttons and enter text. Try www.google.com. :)
Modified Paths:
--------------
trunk/themis/makefile
trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp
trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp
trunk/themis/modules/CSSRenderer/CSSRendererView.cpp
trunk/themis/modules/CSSRenderer/CSSView.cpp
trunk/themis/modules/CSSRenderer/CSSView.hpp
trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp
trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp
trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp
trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableRowDisplayView.hpp
trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.cpp
trunk/themis/modules/CSSRenderer/TableRowGroupDisplayView.hpp
Added Paths:
-----------
trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.cpp
trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.hpp
trunk/themis/modules/CSSRenderer/FormDisplayView.cpp
trunk/themis/modules/CSSRenderer/FormDisplayView.hpp
trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.cpp
trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.hpp
trunk/themis/modules/CSSRenderer/InputDisplayView.cpp
trunk/themis/modules/CSSRenderer/InputDisplayView.hpp
trunk/themis/modules/CSSRenderer/TextInputDisplayView.cpp
trunk/themis/modules/CSSRenderer/TextInputDisplayView.hpp
Modified: trunk/themis/makefile
===================================================================
--- trunk/themis/makefile 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/makefile 2012-03-27 21:10:15 UTC (rev 691)
@@ -243,7 +243,12 @@
CSSRenderer/TableFooterGroupDisplayView.cpp \
CSSRenderer/TableHeaderGroupDisplayView.cpp \
CSSRenderer/TableRowGroupDisplayView.cpp \
- CSSRenderer/NoneDisplayView.cpp
+ CSSRenderer/NoneDisplayView.cpp \
+ CSSRenderer/FormDisplayView.cpp \
+ CSSRenderer/InputDisplayView.cpp \
+ CSSRenderer/ButtonInputDisplayView.cpp \
+ CSSRenderer/TextInputDisplayView.cpp \
+ CSSRenderer/HiddenInputDisplayView.cpp
#make install directories as necessary
ifeq "$(shell if [ -d $(BASE_ADDON_INSTALL_DIR) ] ; then echo 1 ; else mkdir -p $(BASE_ADDON_INSTALL_DIR) ; echo 0 ; fi)" "0"
Modified: trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/BlockDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -48,7 +48,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -58,11 +59,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = true;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
BlockDisplayView :: ~BlockDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/BlockDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -80,7 +80,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~BlockDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Added: trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,144 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 24, 2012
+*/
+
+/* ButtonInputDisplayView implementation
+ See ButtonInputDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// BeOS headers
+#include <Button.h>
+#include <Window.h>
+
+// DOM headers
+#include "TNode.h"
+#include "TElement.h"
+
+// CSS Renderer headers
+#include "ButtonInputDisplayView.hpp"
+#include "CSSRendererView.hpp"
+#include "FormDisplayView.hpp"
+
+ButtonInputDisplayView :: ButtonInputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
+ : CSSView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm) {
+
+ mDisplay = true;
+ mBlock = false;
+ mButton = NULL;
+
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
+}
+
+ButtonInputDisplayView :: ~ButtonInputDisplayView() {
+
+ delete mButton;
+
+}
+
+void ButtonInputDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ if (mButton) {
+ mButton->MoveTo(aStartingPoint);
+ }
+ else {
+ TElementPtr element = shared_static_cast<TElement>(mNode);
+ string buttonLabel = "";
+ if (element->hasAttribute("VALUE")) {
+ buttonLabel = element->getAttribute("VALUE");
+ }
+ string buttonName = "";
+ if (element->hasAttribute("NAME")) {
+ buttonName = element->getAttribute("NAME");
+ }
+
+ BPoint rightBottom(aStartingPoint.x, aStartingPoint.y);
+ BRect buttonRect(aStartingPoint, rightBottom);
+ BMessage * message = new BMessage(INPUT_BUTTON_CLICKED);
+ message->AddString("name", buttonName.c_str());
+ message->AddString("value", buttonLabel.c_str());
+ mButton =
+ new BButton(
+ buttonRect,
+ "ThemisButton",
+ buttonLabel.c_str(),
+ message);
+ mButton->ResizeToPreferred();
+ mRect = mButton->Frame();
+ mEndPoint = mRect.RightTop();
+ mBaseView->AddChild(mButton);
+ }
+
+}
+
+void ButtonInputDisplayView :: AttachedToWindow() {
+
+ CSSView::AttachedToWindow();
+ mButton->SetTarget(mForm);
+
+}
Added: trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/ButtonInputDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,97 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 24, 2012
+*/
+
+/* ButtonInputDisplayView
+ Renders button input elements
+
+ Mark Hellegers (ma...@fi...)
+ 24-03-2012
+
+*/
+
+#ifndef BUTTONINPUTDISPLAYVIEW_HPP
+#define BUTTONINPUTDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+class BButton;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class ButtonInputDisplayView : public CSSView {
+
+ private:
+ BButton * mButton;
+
+ public:
+ ButtonInputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
+ ~ButtonInputDisplayView();
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ virtual void AttachedToWindow();
+};
+
+#endif
Modified: trunk/themis/modules/CSSRenderer/CSSRendererView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSRendererView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/CSSRendererView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -188,6 +188,7 @@
Window()->SetTitle(title.c_str());
SetViewColor(B_TRANSPARENT_COLOR);
if (mView) {
+ mView->AttachedToWindow();
mView->RetrieveResources();
}
Modified: trunk/themis/modules/CSSRenderer/CSSView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/CSSView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -71,6 +71,10 @@
#include "TableRowDisplayView.hpp"
#include "TableCellDisplayView.hpp"
#include "NoneDisplayView.hpp"
+#include "ButtonInputDisplayView.hpp"
+#include "TextInputDisplayView.hpp"
+#include "FormDisplayView.hpp"
+#include "HiddenInputDisplayView.hpp"
// Constants used
const char cSpace = ' ';
@@ -84,7 +88,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: BHandler("CSSView") {
mBaseView = aBaseView;
@@ -107,219 +112,24 @@
mRequestedWidth = -1;
mRequestedHeight = -1;
mWhiteSpace = aWhiteSpace;
-
- if (mNode->hasChildNodes()) {
- TNodeListPtr children = mNode->getChildNodes();
- unsigned int length = children->getLength();
- if ((mNode->getNodeType() == ELEMENT_NODE) &&
- (mNode->getNodeName() == "TITLE") &&
- (length > 0)) {
- printf("Found TITLE node\n");
- TNodePtr textChild = children->item(0);
- TDOMString titleText = textChild->getNodeValue();
- TDOMString strippedTitle = "";
- unsigned int titleLength = titleText.size();
- for (unsigned int i = 0; i < titleLength; i++) {
- if (!iscntrl(titleText[i])) {
- strippedTitle += titleText[i];
- }
+ mForm = aForm;
+
+ if (mNode->getNodeType() == ELEMENT_NODE) {
+ TElementPtr element = shared_static_cast<TElement>(mNode);
+ if (mName == "A") {
+ // Only A can have a href for a hyperlink, so it is hardcoded here.
+ if (element->hasAttribute("HREF")) {
+ mHref = element->getAttribute("HREF");
+ mClickable = true;
}
- if (strippedTitle != "") {
- printf("Setting title of window to: %s\n", strippedTitle.c_str());
- aBaseView->SetTitle(strippedTitle);
- }
}
- else if (mNode->getNodeType() == ELEMENT_NODE) {
- TElementPtr element = shared_static_cast<TElement>(mNode);
- if (mName == "A") {
- // Only A can have a href for a hyperlink, so it is hardcoded here.
- if (element->hasAttribute("HREF")) {
- mHref = element->getAttribute("HREF");
- mClickable = true;
- }
+ else if (mName == "IMG") {
+ // Images have the image source in the src attribute.
+ if (element->hasAttribute("SRC")) {
+ mHref = element->getAttribute("SRC");
}
- ApplyStyle(element, aStyle);
}
-
- for (unsigned int i = 0; i < length; i++) {
- TNodePtr child = children->item(i);
- if (child->getNodeType() == ELEMENT_NODE) {
- CSSView * childView = NULL;
- TElementPtr element = shared_static_cast<TElement>(child);
- CSSStyleDeclarationPtr style = mStyleSheets->getComputedStyle(element);
- if (style.get()) {
- CSSValuePtr value = style->getPropertyCSSValue("display");
- // Default to inline in case it doesn't exist.
- TDOMString valueString = "inline";
- if (value.get()) {
- CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
- valueString = primitiveValue->getStringValue();
- }
- // printf("Display property value: %s\n", valueString.c_str());
- if (valueString == "inline") {
- childView = new InlineDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "block") {
- childView = new BlockDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table") {
- childView = new TableDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table-row-group") {
- childView = new TableRowGroupDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table-header-group") {
- childView = new TableHeaderGroupDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table-footer-group") {
- childView = new TableFooterGroupDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table-row") {
- childView = new TableRowDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "table-cell") {
- childView = new TableCellDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else if (valueString == "none") {
- childView = new NoneDisplayView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- else {
- // The default is an inline element
- printf("Currently unsupported display type: %s. Defaulting to inline...\n", valueString.c_str());
- childView = new InlineDisplayView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- }
- else {
- printf("No style specified for %s. Defaulting to inline...\n", element->getTagName().c_str());
- childView = new InlineDisplayView(aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- }
- mChildren.push_back(childView);
- }
- else if (child->getNodeType() == TEXT_NODE) {
- // Quick fix. Take a look at what would be elegant.
- CSSStyleDeclarationPtr style;
- CSSView * childView = new CSSView(
- aBaseView,
- child,
- mStyleSheets,
- style,
- mRect,
- mSiteId,
- mUrlId,
- mColor,
- mFont,
- mWhiteSpace);
- mChildren.push_back(childView);
- }
- }
+ ApplyStyle(element, aStyle);
}
else if (mNode->getNodeType() == TEXT_NODE) {
if (mFont == NULL) {
@@ -335,16 +145,7 @@
mDisplay = true;
SplitText();
}
- else if (mNode->getNodeType() == ELEMENT_NODE) {
- TElementPtr element = shared_static_cast<TElement>(mNode);
- if (mName == "IMG") {
- // Images have the image source in the src attribute.
- if (element->hasAttribute("SRC")) {
- mHref = element->getAttribute("SRC");
- }
- }
- }
-
+
}
CSSView :: ~CSSView() {
@@ -364,12 +165,14 @@
void CSSView :: RetrieveLink(bool aVisible) {
+ // FIXME. Look at http://en.wikipedia.org/wiki/URI_scheme for the general syntax.
+ // This is not taken into account with the code below.
if (mHref.size() > 0) {
// Send a message to the window.
// The window will do all the actual work of requesting a new page.
string urlString = "";
unsigned int position = mHref.find("://");
- if (position == string::npos) {
+ if (position == string::npos || mHref[0] == '/') {
urlString = mBaseView->GetDocumentURI();
if (mHref[0] == '/') {
// Get past the :// in the base uri, so we can find the right /
@@ -403,6 +206,316 @@
}
+void CSSView :: CreateChildren(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL) {
+
+ if (mNode->hasChildNodes()) {
+ TNodeListPtr children = mNode->getChildNodes();
+ unsigned int length = children->getLength();
+
+ if ((mNode->getNodeType() == ELEMENT_NODE) &&
+ (mNode->getNodeName() == "TITLE") &&
+ (length > 0)) {
+ printf("Found TITLE node\n");
+ TNodePtr textChild = children->item(0);
+ TDOMString titleText = textChild->getNodeValue();
+ TDOMString strippedTitle = "";
+ unsigned int titleLength = titleText.size();
+ for (unsigned int i = 0; i < titleLength; i++) {
+ if (!iscntrl(titleText[i])) {
+ strippedTitle += titleText[i];
+ }
+ }
+ if (strippedTitle != "") {
+ printf("Setting title of window to: %s\n", strippedTitle.c_str());
+ aBaseView->SetTitle(strippedTitle);
+ }
+ }
+
+ for (unsigned int i = 0; i < length; i++) {
+ TNodePtr child = children->item(i);
+ if (child->getNodeType() == ELEMENT_NODE) {
+ CSSView * childView = NULL;
+ TElementPtr element = shared_static_cast<TElement>(child);
+ CSSStyleDeclarationPtr style = mStyleSheets->getComputedStyle(element);
+ if (child->getNodeName() == "INPUT") {
+ if (element->hasAttribute("TYPE")) {
+ string inputType = element->getAttribute("TYPE");
+ if (inputType == "text" || inputType == "") {
+ childView = new TextInputDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (inputType == "submit") {
+ childView = new ButtonInputDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (inputType == "hidden") {
+ childView = new HiddenInputDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ }
+ else {
+ // Default is text
+ childView = new TextInputDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ }
+ else if (child->getNodeName() == "FORM") {
+ childView = new FormDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ NULL);
+ }
+ if (childView == NULL) {
+ // No input element found.
+ if (style.get()) {
+ CSSValuePtr value = style->getPropertyCSSValue("display");
+ // Default to inline in case it doesn't exist.
+ TDOMString valueString = "inline";
+ if (value.get()) {
+ CSSPrimitiveValuePtr primitiveValue = shared_static_cast<CSSPrimitiveValue>(value);
+ valueString = primitiveValue->getStringValue();
+ }
+ // printf("Display property value: %s\n", valueString.c_str());
+ if (valueString == "inline") {
+ childView = new InlineDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "block") {
+ childView = new BlockDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table") {
+ childView = new TableDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table-row-group") {
+ childView = new TableRowGroupDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table-header-group") {
+ childView = new TableHeaderGroupDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table-footer-group") {
+ childView = new TableFooterGroupDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table-row") {
+ childView = new TableRowDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "table-cell") {
+ childView = new TableCellDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else if (valueString == "none") {
+ childView = new NoneDisplayView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ else {
+ // The default is an inline element
+ printf("Currently unsupported display type: %s. Defaulting to inline...\n", valueString.c_str());
+ childView = new InlineDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ }
+ else {
+ printf("No style specified for %s. Defaulting to inline...\n", element->getTagName().c_str());
+ childView = new InlineDisplayView(aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ }
+ }
+ mChildren.push_back(childView);
+ }
+ else if (child->getNodeType() == TEXT_NODE) {
+ // Quick fix. Take a look at what would be elegant.
+ CSSStyleDeclarationPtr style;
+ CSSView * childView = new CSSView(
+ aBaseView,
+ child,
+ mStyleSheets,
+ style,
+ mRect,
+ mSiteId,
+ mUrlId,
+ mColor,
+ mFont,
+ mWhiteSpace,
+ mForm);
+ mChildren.push_back(childView);
+ }
+ }
+ }
+
+}
+
void CSSView :: ApplyStyle(const TElementPtr aElement,
const CSSStyleDeclarationPtr aStyle) {
@@ -655,8 +768,9 @@
}
-void CSSView :: Layout(BRect aRect,
- BPoint aStartingPoint) {
+void CSSView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
// printf("Doing layout for %s\n", mName.c_str());
mRects.clear();
@@ -870,6 +984,21 @@
}
+void CSSView :: AttachedToWindow() {
+
+ if (!Looper()) {
+ mBaseView->Window()->LockLooper();
+ mBaseView->Window()->AddHandler(this);
+ mBaseView->Window()->UnlockLooper();
+ }
+
+ unsigned int length = mChildren.size();
+ for (unsigned int i = 0; i < length; i++) {
+ mChildren[i]->AttachedToWindow();
+ }
+
+}
+
void CSSView :: SplitText() {
TDOMString text = mNode->getNodeValue();
@@ -942,7 +1071,7 @@
}
void CSSView :: RetrieveResources() {
-
+
// printf("Retrieving resources in %s with href %s\n", mName.c_str(), mHref.c_str());
if (mHref != "" && !mClickable) {
// Some resource that must be loaded.
Modified: trunk/themis/modules/CSSRenderer/CSSView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/CSSView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -78,17 +78,12 @@
class CSSView : public BHandler {
private:
- TNodePtr mNode;
CSSStyleContainer * mStyleSheets;
- CSSRendererView * mBaseView;
vector<TextBox> mTextBoxes;
float mLineHeight;
float mBottomMargin;
float mSpaceWidth;
- BFont * mFont;
- bool mInheritedFont;
bool mClickable;
- string mHref;
string mName;
rgb_color mColor;
string mBorderStyle;
@@ -96,9 +91,11 @@
int32 mUrlId;
WhiteSpaceType mWhiteSpace;
- void RetrieveLink(bool aVisible = true);
-
protected:
+ TNodePtr mNode;
+ CSSRendererView * mBaseView;
+ BFont * mFont;
+ bool mInheritedFont;
vector<CSSView *> mChildren;
vector<BRect> mRects;
BRect mRect;
@@ -113,7 +110,22 @@
bool mBlock;
float mRequestedWidth;
float mRequestedHeight;
+ string mHref;
+ BHandler * mForm;
+ void RetrieveLink(bool aVisible = true);
+ void CreateChildren(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
void ApplyStyle(const TElementPtr aElement,
const CSSStyleDeclarationPtr aStyle);
@@ -127,7 +139,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~CSSView();
virtual void MouseDown(BPoint aPoint);
void Draw();
@@ -137,8 +150,10 @@
bool IsClickable();
BRect Bounds();
BPoint GetEndPoint();
- virtual void Layout(BRect aRect,
- BPoint aStartingPoint);
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ virtual void AttachedToWindow();
void SplitText();
void RetrieveResources();
void SetWidth(float aWidth);
Added: trunk/themis/modules/CSSRenderer/FormDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/FormDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/FormDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,151 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 25, 2012
+*/
+
+/* FormDisplayView implementation
+ See FormDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// BeOS headers
+#include <Message.h>
+#include <String.h>
+
+// DOM headers
+#include "TNode.h"
+#include "TElement.h"
+
+// CSS Renderer headers
+#include "FormDisplayView.hpp"
+#include "CSSRendererView.hpp"
+#include "InputDisplayView.hpp"
+
+FormDisplayView :: FormDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
+ : CSSView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ this) {
+
+ mDisplay = true;
+ mBlock = false;
+
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
+}
+
+FormDisplayView :: ~FormDisplayView() {
+
+}
+
+void FormDisplayView :: MessageReceived(BMessage * aMessage) {
+
+ switch(aMessage->what) {
+ case INPUT_BUTTON_CLICKED: {
+ aMessage->PrintToStream();
+ BString formAction = "";
+ TElementPtr element = shared_static_cast<TElement>(mNode);
+ if (element->hasAttribute("ACTION")) {
+ formAction = element->getAttribute("ACTION").c_str();
+ BString name = "";
+ BString value = "";
+ aMessage->FindString("name", &name);
+ aMessage->FindString("value", &value);
+ name.ReplaceAll(" ", "+");
+ value.ReplaceAll(" ", "+");
+ formAction += "?";
+ formAction += name;
+ formAction += "=";
+ formAction += value;
+ unsigned int length = mInputChildren.size();
+ for (unsigned int i = 0; i < length; i++) {
+ formAction += "&";
+ formAction += mInputChildren[i]->GetName().c_str();
+ formAction += "=";
+ formAction += mInputChildren[i]->GetValue().c_str();
+ }
+ printf("URL: %s\n", formAction.String());
+ mHref = formAction.String();
+ RetrieveLink();
+
+ }
+ break;
+ }
+ default: {
+ CSSView::MessageReceived(aMessage);
+ }
+ }
+
+}
+
+void FormDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
+
+void FormDisplayView :: AddInputChild(InputDisplayView * aView) {
+
+ mInputChildren.push_back(aView);
+
+}
Added: trunk/themis/modules/CSSRenderer/FormDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/FormDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/FormDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,102 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 25, 2012
+*/
+
+/* ButtonDisplayView
+ Renders button elements
+
+ Mark Hellegers (ma...@fi...)
+ 25-03-2012
+
+*/
+
+#ifndef FORMDISPLAYVIEW_HPP
+#define FORMDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+class InputDisplayView;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+// Constants used
+#define INPUT_BUTTON_CLICKED 'ibcl'
+
+class FormDisplayView : public CSSView {
+
+ private:
+ vector<InputDisplayView *> mInputChildren;
+
+ public:
+ FormDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
+ ~FormDisplayView();
+ virtual void MessageReceived(BMessage * aMessage);
+
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ void AddInputChild(InputDisplayView * aView);
+};
+
+#endif
Added: trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,124 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 27, 2012
+*/
+
+/* InputDisplayView implementation
+ See InputDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// DOM headers
+#include "TNode.h"
+#include "TElement.h"
+
+// CSS Renderer headers
+#include "HiddenInputDisplayView.hpp"
+#include "CSSRendererView.hpp"
+#include "FormDisplayView.hpp"
+
+HiddenInputDisplayView :: HiddenInputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
+ : InputDisplayView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm) {
+
+ mDisplay = false;
+ mBlock = false;
+
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
+ if (aForm) {
+ FormDisplayView * formView = dynamic_cast<FormDisplayView *> (aForm);
+ formView->AddInputChild(this);
+ }
+
+ TElementPtr element = shared_static_cast<TElement>(mNode);
+ if (element->hasAttribute("NAME")) {
+ mInputName = element->getAttribute("NAME");
+ }
+
+}
+
+HiddenInputDisplayView :: ~HiddenInputDisplayView() {
+
+}
+
+void HiddenInputDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
+
+string HiddenInputDisplayView :: GetValue() const {
+
+ string result = "";
+
+ TElementPtr element = shared_static_cast<TElement>(mNode);
+ if (element->hasAttribute("VALUE")) {
+ result = element->getAttribute("VALUE");
+ }
+
+ return result;
+
+}
Added: trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/HiddenInputDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 27, 2012
+*/
+
+/* HiddenInputDisplayView
+ Renders hidden input elements
+
+ Mark Hellegers (ma...@fi...)
+ 27-03-2012
+
+*/
+
+#ifndef HIDDENINPUTDISPLAYVIEW_HPP
+#define HIDDENINPUTDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "InputDisplayView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+class BTextControl;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class HiddenInputDisplayView : public InputDisplayView {
+
+ public:
+ HiddenInputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
+ ~HiddenInputDisplayView();
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ virtual string GetValue() const;
+};
+
+#endif
Modified: trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/InlineDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -48,7 +48,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace = NORMAL)
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -58,11 +59,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = false;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
InlineDisplayView :: ~InlineDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/InlineDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -80,7 +80,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~InlineDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Added: trunk/themis/modules/CSSRenderer/InputDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InputDisplayView.cpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/InputDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,97 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 27, 2012
+*/
+
+/* InputDisplayView implementation
+ See InputDisplayView.hpp for more information
+
+*/
+
+// Standard C headers
+#include <stdio.h>
+
+// DOM headers
+#include "TNode.h"
+#include "TElement.h"
+
+// CSS Renderer headers
+#include "InputDisplayView.hpp"
+#include "CSSRendererView.hpp"
+#include "FormDisplayView.hpp"
+
+InputDisplayView :: InputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont,
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
+ : CSSView(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm) {
+
+}
+
+InputDisplayView :: ~InputDisplayView() {
+
+}
+
+void InputDisplayView :: Layout(
+ BRect aRect,
+ BPoint aStartingPoint) {
+
+ CSSView::Layout(aRect, aStartingPoint);
+
+}
+
+string InputDisplayView :: GetName() const {
+
+ return mInputName;
+
+}
+
+string InputDisplayView :: GetValue() const {
+
+ return "";
+
+}
Added: trunk/themis/modules/CSSRenderer/InputDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/InputDisplayView.hpp (rev 0)
+++ trunk/themis/modules/CSSRenderer/InputDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -0,0 +1,98 @@
+/*
+ Copyright (c) 2012 Mark Hellegers. All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Software, and to permit persons to whom
+ the Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice
+ shall be included in all copies or substantial portions
+ of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ Original Author: Mark Hellegers (ma...@fi...)
+ Project Start Date: October 18, 2000
+ Class Start Date: March 27, 2012
+*/
+
+/* InputDisplayView
+ Base class for input elements
+
+ Mark Hellegers (ma...@fi...)
+ 27-03-2012
+
+*/
+
+#ifndef INPUTDISPLAYVIEW_HPP
+#define INPUTDISPLAYVIEW_HPP
+
+// Standard C++ headers
+#include <vector>
+#include <string>
+
+// BeOS headers
+#include <Handler.h>
+#include <Rect.h>
+#include <Point.h>
+
+// DOM headers
+#include "DOMSupport.h"
+
+// DOM Style headers
+#include "CSSStyleSheet.hpp"
+#include "CSSStyleDeclaration.hpp"
+
+// CSSRenderer headers
+#include "CSSView.hpp"
+#include "TextBox.hpp"
+
+// Declarations used
+class BFont;
+class CSSRendererView;
+class CSSStyleContainer;
+class BTextControl;
+
+// Namespaces used
+using std::vector;
+using std::string;
+
+class InputDisplayView : public CSSView {
+
+ protected:
+ string mInputName;
+
+ public:
+ InputDisplayView(
+ CSSRendererView * aBaseView,
+ TNodePtr aNode,
+ CSSStyleContainer * aStyleSheets,
+ CSSStyleDeclarationPtr aStyle,
+ BRect aRect,
+ int32 aSiteId,
+ int32 aUrlId,
+ rgb_color aColor,
+ BFont * aFont = NULL,
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
+ ~InputDisplayView();
+ virtual void Layout(
+ BRect aRect,
+ BPoint aStartingPoint);
+ string GetName() const;
+ virtual string GetValue() const;
+};
+
+#endif
Modified: trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/NoneDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -48,7 +48,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -58,11 +59,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = false;
mBlock = false;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
NoneDisplayView :: ~NoneDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/NoneDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -80,7 +80,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~NoneDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Modified: trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableCellDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -48,7 +48,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -58,12 +59,26 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = false;
mRequestedWidth = -1;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
TableCellDisplayView :: ~TableCellDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableCellDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -80,7 +80,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~TableCellDisplayView();
virtual void Layout(BRect aRect,
BPoint aStartingPoint);
Modified: trunk/themis/modules/CSSRenderer/TableDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -49,7 +49,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: CSSView(aBaseView,
aNode,
aStyleSheets,
@@ -59,11 +60,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = true;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
TableDisplayView :: ~TableDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/TableDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -85,7 +85,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~TableDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -49,7 +49,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: TableGroupDisplayView(
aBaseView,
aNode,
@@ -60,11 +61,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = false;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
TableFooterGroupDisplayView :: ~TableFooterGroupDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableFooterGroupDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -81,7 +81,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~TableFooterGroupDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableGroupDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -49,7 +49,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: CSSView(
aBaseView,
aNode,
@@ -60,7 +61,8 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = false;
Modified: trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableGroupDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -84,7 +84,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~TableGroupDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.cpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -49,7 +49,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont,
- WhiteSpaceType aWhiteSpace)
+ WhiteSpaceType aWhiteSpace,
+ BHandler * aForm)
: TableGroupDisplayView(
aBaseView,
aNode,
@@ -60,11 +61,25 @@
aUrlId,
aColor,
aFont,
- aWhiteSpace) {
+ aWhiteSpace,
+ aForm) {
mDisplay = true;
mBlock = false;
+ CreateChildren(
+ aBaseView,
+ aNode,
+ aStyleSheets,
+ aStyle,
+ aRect,
+ aSiteId,
+ aUrlId,
+ aColor,
+ aFont,
+ aWhiteSpace,
+ aForm);
+
}
TableHeaderGroupDisplayView :: ~TableHeaderGroupDisplayView() {
Modified: trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp
===================================================================
--- trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp 2012-03-24 17:44:10 UTC (rev 690)
+++ trunk/themis/modules/CSSRenderer/TableHeaderGroupDisplayView.hpp 2012-03-27 21:10:15 UTC (rev 691)
@@ -81,7 +81,8 @@
int32 aUrlId,
rgb_color aColor,
BFont * aFont = NULL,
- WhiteSpaceType aWhiteSpace = NORMAL);
+ WhiteSpaceType aWhiteSpace = NORMAL,
+ BHandler * aForm = NULL);
~TableHeaderGroupDisplayView();
virtual void Layout(
BRect aRect,
Modified: trunk/themis/modules/CSSRenderer/Ta...
[truncated message content] |