当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLElement::Type方法代码示例

本文整理汇总了C++中HTMLElement::Type方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLElement::Type方法的具体用法?C++ HTMLElement::Type怎么用?C++ HTMLElement::Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLElement的用法示例。


在下文中一共展示了HTMLElement::Type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FindNesting

void HTMLList::FindNesting(void)
{
HTMLElement *pParent;
	
	miNesting = 0;
	
	pParent = mpParent;
	while (pParent)
	{
		if (pParent->Type() == HTML_LIST_ELEMENT)
		{
			miNesting++;
		}
		else if (pParent->Type() == HTML_TABLE_ELEMENT)
		{
			break;
		}
		pParent = pParent->mpParent;
	}
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:20,代码来源:hlist.cpp

示例2: Items

short HTMLList::Items(void)
{
HTMLElement *pChild = mpFirstChild;
int items = 0;

	while (pChild)
	{
		if (pChild->Type() == HTML_LIST_ITEM_ELEMENT)
		{
			items++;
		}
		pChild = pChild->mpNext;
	}
	
	return (items);
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:16,代码来源:hlist.cpp

示例3: DefaultEvent

HTMLEventStatus HTMLInputPassword::DefaultEvent(HTMLEvent *pEvent) // tbd
{
	WEBC_UINT8 onlyBox = 1;
	WEBC_UINT8 hasSubmit = 0;
	HTMLElement *pElem = 0;
	HTMLInput *pSubmit = 0;
	vector_iterator it;
    WEBC_DEBUG_ReceiveEvent(this, pEvent);
	switch (pEvent->type)
	{
		case HTML_EVENT_CHANGE:
			break;

		case HTML_EVENT_EDIT:
		{
			HTMLForm *pForm = Form();
			if (pForm)
			{
				pElem = (HTMLElement*)ObjectListGetFirst(pForm->GetFieldVector(), &it);
				while (pElem)
				{
					if ( (pElem->Type() == HTML_EDIT_STR_ELEMENT ||
						pElem->Type() == HTML_EDITBOX_ELEMENT)
						&& pElem != this)
					{
						onlyBox = 0;
						break;
					}
					if (pElem->Type() == HTML_BUTTON_ELEMENT
						&& !hasSubmit)
					{
						hasSubmit = 1;
						pSubmit = (HTMLInput *)pElem;
					}
					pElem = (HTMLElement*)ObjectListGetNext(&it);
				}
				if (pSubmit && onlyBox)
				{
					HTMLEvent e;
					e.type = HTML_EVENT_SUBMIT;
					e.data.position.x = pEvent->data.position.x;
					e.data.position.y = pEvent->data.position.y;
					e.elem = (HELEMENT_HANDLE)pSubmit;

					return (pForm->Event(&e));
				}
			}
			break;
		}

		case HTML_EVENT_FOCUS:
		{
			HTMLSetFlagFinder f(HELEM_FLAG_HAS_FOCUS, 1);
			FindElement(&f);
			SetFlag(HINPUT_FLAG_ACTIVE);
			Update(0,0);
			break;
		}

		case HTML_EVENT_UNFOCUS:
		{
			HTMLSetFlagFinder f(HELEM_FLAG_HAS_FOCUS, 0);
			FindElement(&f);
			ClearFlag(HINPUT_FLAG_ACTIVE);
			Update(0,0);
			break;
		}

		case HTML_EVENT_KEYDOWN:
		{
			HTMLEventStatus retval = DefaultInputKeyHandler(pEvent);
			if (retval != HTML_EVENT_STATUS_CONTINUE)
			{
				return (retval);
			}

			switch (pEvent->data.key)
			{
				case WGK_LNDN:
				case WGK_LNUP:
				case WGK_LEFT:
				case WGK_RIGHT:
					pEvent->flags |= HTML_EVENT_FLAG_CANCEL_BUBBLE;
					break;
			}
			break;
		}

		default:
			break;
	}

	return (HTMLInput::DefaultEvent(pEvent));
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:94,代码来源:hpasswd.cpp

示例4: jhtml_anchor_getProperty

/**
 * Call this method when getting a Property from HTMLElement
 */
static JSBool jhtml_anchor_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
	int index = JSVAL_TO_INT(id);

#ifdef WEBC_DEBUG
	if(index < 0)
		LOG_HTMLDOM("jhtml_anchor_getProperty %s\n", jhtml_anchor_props[-(index+1)].name);
	else
		LOG_HTMLDOM("jhtml_anchor_getProperty %d\n", index);
#endif

	if (index)
	{
		HTMLElement *pElem = (HTMLElement *) jhutil_GetPrivate(cx, obj);
		if (pElem->Type() != HTML_ANCHOR_ELEMENT)
		{
			return JS_TRUE;
		}
		HTMLAnchor *anchor = (HTMLAnchor *) pElem;

		if (!pElem)
		{
			return JS_TRUE;
		}

		switch (index)
		{
			case(HTMLANCHORELEMENT_ACCESSKEY):
			{
				char ak[2];
				ak[0] = (char)anchor->AccessKey();
				ak[1] = '\0';
				JSString *str = JS_NewStringCopyZ(cx,ak);
				*vp = STRING_TO_JSVAL(str);
				return JS_TRUE;
			}
			case(HTMLANCHORELEMENT_CHARSET):
				*vp = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, anchor->CharSet()));
				return JS_TRUE;
			case(HTMLANCHORELEMENT_COORDS):
			{
				WEBC_CHAR *pCoordString = (WEBC_CHAR *)HTML_PrintLengthList(anchor->Coordinates(), anchor->CoordinateCount());
				if(pCoordString)
				{
					*vp = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, pCoordString));
					WEBC_FREE(pCoordString);
					return JS_TRUE;
				}
			}
				break;
			case(HTMLANCHORELEMENT_HREF):
				*vp = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, anchor->HRef()));
				return JS_TRUE;
			case(HTMLANCHORELEMENT_HREFLANG):
				*vp = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, anchor->HRefLang()));
				return JS_TRUE;
			case(HTMLANCHORELEMENT_NAME):
				*vp = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, anchor->Name()));
				return JS_TRUE;
			case(HTMLANCHORELEMENT_REL):
				*vp = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, anchor->Rel()));
				return JS_TRUE;
			case(HTMLANCHORELEMENT_REV):
				*vp = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, anchor->Rev()));
				return JS_TRUE;
			case(HTMLANCHORELEMENT_SHAPE):
				*vp = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, anchor->ShapeStr()));
				return JS_TRUE;
			case(HTMLANCHORELEMENT_TABINDEX):
				*vp = INT_TO_JSVAL(anchor->TabIndex());
				return JS_TRUE;
			case(HTMLANCHORELEMENT_TARGET):
				*vp = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, anchor->Target()));
				return JS_TRUE;
			case(HTMLANCHORELEMENT_TYPE):
				*vp = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, anchor->MimeType()));
				return JS_TRUE;
		}//end switch
	}

	return JS_TRUE;
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:85,代码来源:jhanchor.cpp

示例5: Update

void HTMLScript::Update(WEBC_PFBYTE o, WEBC_PFBYTE data)
{
#if (WEBC_SUPPORT_JSCRIPT)
HTMLDocument *pDoc = GetDocument();
WebcJSDocumentContext *jsMgr = (pDoc)? pDoc->GetJSMgr() : 0;

	if (mpScript || !jsMgr)
	{
		return;
	}

	WEBC_NEW_VERBOSE(mpScript, WebcJSScript(jsMgr, jsMgr->GetGlobalObject()),"WebcJSDocumentContext");

	if (mpScript)
	{
		if (Src())
		{
			LoadScript *pJob;
			if (pDoc)
			{
				HTMLBrowser *pBrowser = pDoc->GetBrowser();
				if (pBrowser)
				{
					WebcCharset charset = (mCharset == WEBC_CHARSET_UNKNOWN)? pDoc->GetCharset() : mCharset;
					WEBC_NEW_VERBOSE(pJob, LoadScript(this, pDoc, charset),"LoadScript");
					if (pJob)
					{
						pBrowser->ProcessLoadJob(pJob, pJob->GetURL(), pDoc->BaseURL(), pDoc, WEBC_TRUE /* urgent */);
					}
					webc_free_string_copy(mpSrc, __FILE__, __LINE__);
					mpSrc = 0;
				}
			}
		}
		else // compile the contents of this tag as the script to execute
		{
			HTMLElement *pChild = mpFirstChild;
			WEBC_CHAR* pStr;
			long iLen;
			for (; pChild != WEBC_NULL; pChild = pChild->mpNext)
			{
				if (pChild->Type() == HTML_STRING_ELEMENT)
				{
					pStr = ((HTMLString*)(pChild))->GetString();
					iLen = webc_strlen(pStr);
					if (mpScript->Write(pStr, iLen) < iLen)
					{
						mpScript->Destroy();
						mpScript = 0;
						break;
					}
				}
			}

			if (mpScript)
			{
				mpScript->Compile();
			}

			DeleteChildren();
		}
	}

#endif
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:65,代码来源:hscript.cpp


注:本文中的HTMLElement::Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。