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


C++ HTMLForm::GetFieldVector方法代码示例

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


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

示例1: 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

示例2: jhtml_collection_namedItem


//.........这里部分代码省略.........
			{
				HTMLElementByNameFinder finder(name);
				pElem = pColl->pTop->FindElement(&finder,1, INCLUDE_SELF_ELEMENT_DEFAULT);
				break;
			}

			case ALL_TAGS_BY_TAGNAME:
			{
				if(pColl && pColl->nameOfAll)
				{
					HTMLTagType hType = HTML_ParseTagType(pColl->nameOfAll, webc_strlen(pColl->nameOfAll));
					HTMLElementType eType = TagToHTMLElementType[hType];

					HTMLNameTypeFinder finder(name, eType);
					// TODO this should probably restrict to a specific tag name
					pElem = pColl->pTop->FindElement(&finder, 1, WEBC_FALSE);
				}
				break;
			}

			case ELEMENT_NODES:
			{
				HTMLNameOrIdFinder finder(name);
				pElem = pColl->pTop->FindElement(&finder,1, INCLUDE_SELF_NODES_DEFAULT);
				break;
			}

			case FORM_INPUTS:
			{
				//for this type of collection, the top will always be of type form
				HTMLForm *form = (HTMLForm *)pColl->pTop;
				if (form && name && *name)
				{
					pElem = jutils_CheckObjectList(form->GetFieldVector(), _matchInputByNameOrId, (WEBC_PFBYTE)name);
				}//end if
				break;
			}

			case DOCUMENT_STYLESHEETS:
			{
#if (WEBC_SUPPORT_STYLE_SHEETS)
				//GMP this needs to be revisited if CSS is changed to have more than 1 style sheet
#endif
				break;
			}

			case SSHEET_RULES:
			{
#if (WEBC_SUPPORT_STYLE_SHEETS)
				CSSDocumentContext *pCSSCx= pDoc->GetCSSContext();
	/*			if (pCSSCx)
				{
					int i = 0;
					vector_iterator pvi[1];
					CSSPropertyDescriptor * pCSSPD = pCSSCx->EnumFirstProperty(pvi);
					while (pCSSPD)
					{
						char *cName = pCSSPD->EnumFirstClass();
						while (cName)
						{
							if (tc_stricmp(cName, name) == 0)
							{
								*rval = OBJECT_TO_JSVAL(pCSSPD->GetJSObject());
								return JS_TRUE;
							}
							pCSSPD->EnumNextClass();
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:67,代码来源:jhcoll.cpp

示例3: jhtml_collection_item


//.........这里部分代码省略.........
				{
					*rval = JSVAL_NULL;
				}

				return JS_TRUE;
			}

			case ALL_TAGS_BY_TAGNAME:
			{
				//get the nth item with the specified tag name...
				HTMLTagType hType = HTML_ParseTagType(pColl->nameOfAll, webc_strlen(pColl->nameOfAll));
				HTMLElementType eType = TagToHTMLElementType[hType];
				HTMLNthOfTypeFinder finder(eType, index);
				pElem = pColl->pTop->FindElement(&finder, 1, WEBC_FALSE);

				if (pElem)
				{
					*rval = OBJECT_TO_JSVAL(pElem->CreateJSObject());
				}
				else
				{
					*rval = JSVAL_NULL;
				}

				return JS_TRUE;
			}

			case FORM_INPUTS:
			{
				//for this type of collection, the top will always be of type form
				HTMLForm *form = (HTMLForm *)pColl->pTop;
				if (form)
				{
					pElem = jutils_GetNthOfObjectList(form->GetFieldVector(),
					                                  index,
					                                  _matchInput,
					                                  0);

					if (pElem)
					{
						*rval = OBJECT_TO_JSVAL(pElem->CreateJSObject());
					}
					else
					{
						*rval = JSVAL_NULL;
					}

					return JS_TRUE;
				}
				break;
			}

			case DOCUMENT_STYLESHEETS:
			{
#if (WEBC_SUPPORT_STYLE_SHEETS)
				//GMP this needs to be revisited if CSS is changed to have more than 1 style sheet
				*rval = OBJECT_TO_JSVAL(pDoc->GetCSSContext()->GetJSObject());
#else
				*rval = JSVAL_NULL;
#endif
				return JS_TRUE;
			}

			case SSHEET_RULES:
			{
#if (WEBC_SUPPORT_STYLE_SHEETS)
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:67,代码来源:jhcoll.cpp

示例4: jhtml_collection_getProperty


//.........这里部分代码省略.........
						if (!pColl->nameOfAll)
						{
							*vp = INT_TO_JSVAL(0);
							return JS_TRUE;
						}
						//this finder counts the total number of elements with the
						//name given by nameOfAll
						HTMLCountByNameFinder finder(pColl->nameOfAll);
						pColl->pTop->FindElement(&finder, 1, INCLUDE_SELF_ELEMENT_DEFAULT);
						int count = finder.Length();
						*vp = INT_TO_JSVAL(count);
						return JS_TRUE;
					}
					case ALL_TAGS_BY_TAGNAME:
					{
						if (!pColl->nameOfAll)
						{
							*vp = INT_TO_JSVAL(0);
							return JS_TRUE;
						}
						// use this finder to count the total number of elements with the
						// type given by nameOfAll (misnomer)
						HTMLTagType hType = HTML_ParseTagType(pColl->nameOfAll, webc_strlen(pColl->nameOfAll));
						HTMLElementType eType = TagToHTMLElementType[hType];
						HTMLCountByTypeFinder finder(eType);
						pColl->pTop->FindElement(&finder, 1, WEBC_FALSE); // don't include myself in the search results
						int count = finder.Length();
						*vp = INT_TO_JSVAL(count);
						return JS_TRUE;
					}
					case FORM_INPUTS:
					{
						//for this type of collection, the top will always be of type form
						HTMLForm *form = (HTMLForm *)pColl->pTop;
						int len = vector_get_size(form->GetFieldVector());
						*vp = INT_TO_JSVAL(len);
						return JS_TRUE;
					}
					case DOCUMENT_STYLESHEETS:
					{
						//GMP this needs to be revisited if CSS is changed to have more than 1 style sheet
						*vp = INT_TO_JSVAL(1);
						return JS_TRUE;
					}
					case SSHEET_RULES:
					{
#if (WEBC_SUPPORT_STYLE_SHEETS)
						CSSDocumentContext *pCSSCx= pDoc->GetCSSContext();
	/*					int i = 0;
						if (pCSSCx)
						{
							vector_iterator pvi[1];
							CSSPropertyDescriptor * pCSSPD = pCSSCx->EnumFirstProperty(pvi);
							while (pCSSPD)
							{
								i++;
								pCSSPD = pCSSCx->EnumNextProperty(pvi);
							}
						}
						*vp = INT_TO_JSVAL(i);*/
#endif //(WEBC_SUPPORT_STYLE_SHEETS)
						return JS_TRUE;
					}

					case RADIO_BUTTONS:
					{
						int numRadioElems = 0;
						HTMLRadioButton *pRadio = (HTMLRadioButton*)pColl->pTop;
						while (pRadio)
						{
							numRadioElems++;
							pRadio = (pRadio->mpGroupNext != pColl->pTop)
								? pRadio->mpGroupNext : 0;
						}
						*vp = INT_TO_JSVAL(numRadioElems);
						return JS_TRUE;
					}

				}//end inner switch
				if (ele_type != HTML_ELEMENT_NONE)
				{
					HTMLCountByTypeFinder finder(ele_type);
					pColl->pTop->FindElement(&finder, 1, INCLUDE_SELF_ELEMENT_DEFAULT);
					*vp = INT_TO_JSVAL(finder.Length());
				}
			}//end if
			return JS_TRUE;
		}//end case length
		default:
		{
			//MSIE allows collections to be index like 'document.all.nameofelement' where
			//nameofelement is an element name in the document tree.  It also allows
			//'document.all[4]' To account for that we call item on the element passed in.
			//which will call namedItem if the jsval passed is not an int.
			jhtml_collection_item(cx, obj, 1, &id, vp);
			break;
		}
	}//end switch
	return JS_TRUE;
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:101,代码来源:jhcoll.cpp


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