本文整理汇总了C++中HTMLDocument::GetBrowser方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLDocument::GetBrowser方法的具体用法?C++ HTMLDocument::GetBrowser怎么用?C++ HTMLDocument::GetBrowser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLDocument
的用法示例。
在下文中一共展示了HTMLDocument::GetBrowser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Event
virtual HTMLEventStatus Event(HTMLElement *pElement, HTMLEvent *pEvent, WEBC_CHAR *pParam = 0)
{
HTMLEventStatus result = HTML_EVENT_STATUS_CONTINUE;
if (mFunction)
{
HTMLDocument *pDoc;
HTMLBrowser *pBrowser;
wcCtx _Ctx;
char nphoney[4];
pDoc = (pElement)? pElement->GetDocument() : 0;
pBrowser = (pDoc)? pDoc->GetBrowser() : 0;
wcCtxtInit(&_Ctx, (wcBROW) pBrowser, (wcDOC) pDoc);
char *param = webc_arg_to_char(pParam);
if (!param)
param = &nphoney[0];
result = mFunction(&_Ctx, (wcEL)pElement, pEvent, param);
wcCtxtRelease(&_Ctx);
if (param != &nphoney[0])
webc_arg_done(param);
}
return (result);
}
示例2: Event
virtual HTMLEventStatus Event(HTMLElement *pElement, HTMLEvent *pEvent, WEBC_CHAR *pParam = 0)
{
HTMLEventStatus result = HTML_EVENT_STATUS_CONTINUE;
if (mFunction)
{
HTMLDocument *pDoc;
HTMLBrowser *pBrowser;
pDoc = (pElement)? pElement->GetDocument() : 0;
pBrowser = (pDoc)? pDoc->GetBrowser() : 0;
char *param = webc_arg_to_char(pParam);
if (!param)
{
param = nphoney;
}
result = mFunction((HBROWSER_HANDLE)pBrowser, (HDOC_HANDLE)pDoc, (HELEMENT_HANDLE)pElement, pEvent, param);
if (param != nphoney)
{
webc_arg_done(param);
}
}
return (result);
}
示例3: jwindow_dialog
static JSBool jwindow_dialog(JSContext *cx, JSObject *obj,uintN argc, jsval *argv, jsval *rval, int which_dialogue)
{
WebcJSDocumentContext *jsmgr = (WebcJSDocumentContext *) jhutil_GetPrivate(cx, obj);
HTMLDocument *pDoc = (jsmgr)? jsmgr->GetDocument() : 0;
if (argc < 1)
return(JS_FALSE);
char *prompt_str = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
// << EDIT 20080120 - Needs work
// Clone the graphics abstraction layer function pointers so we know who to call
HTMLBrowserConfig config, docConfig;
rtp_memset(&config, 0, sizeof(config));
rtp_memset(&docConfig, 0, sizeof(docConfig));
pDoc->GetBrowser()->GetConfig(&docConfig);
config.graphics = docConfig.graphics;
switch (which_dialogue) {
case WHICH_DIALOGUE_ALERT:
config.WindowConfig.left = WEBC_SKIN_ALERT_LEFT;
config.WindowConfig.top = WEBC_SKIN_ALERT_TOP;
config.WindowConfig.width = WEBC_SKIN_ALERT_WIDTH;
config.WindowConfig.height = WEBC_SKIN_ALERT_HEIGHT;
break;
case WHICH_DIALOGUE_PROMPT:
config.WindowConfig.left = WEBC_SKIN_PROMPT_LEFT;
config.WindowConfig.top = WEBC_SKIN_PROMPT_TOP;
config.WindowConfig.width = WEBC_SKIN_PROMPT_WIDTH;
config.WindowConfig.height = WEBC_SKIN_PROMPT_HEIGHT;
break;
case WHICH_DIALOGUE_CONFIRM:
default:
config.WindowConfig.left = WEBC_SKIN_CONFIRM_LEFT;
config.WindowConfig.top = WEBC_SKIN_CONFIRM_TOP;
config.WindowConfig.width = WEBC_SKIN_CONFIRM_WIDTH;
config.WindowConfig.height = WEBC_SKIN_CONFIRM_HEIGHT;
break;
}
config.WindowConfig.WindowFlags |= WF_MODAL;
HBROWSER_HANDLE Browser = webc_CreateBrowser(&config, WEBC_TRUE,"dialog", "");
if (Browser)
{
HDOC_HANDLE hDoc = webc_BrowserGetDocument(Browser);
wcCtx Ctx;
char buff[128];
wcCtxtInit(&Ctx, (wcBROW) Browser, (wcDOC) hDoc);
/* Experimental */
wcDocClear(&Ctx, wcFALSE);
wcDocOpen(&Ctx);
// Create a link between 'C' and Javascript the Native 'C' function PromptDismiss will
// be called with the value of the input field.
webc_JScriptDefineFunction(hDoc, "PromptDismiss", (JSNative) PromptDismiss, 0);
if (which_dialogue == WHICH_DIALOGUE_ALERT)
{
WriteDlgLine(&Ctx, WEBC_SKIN_ALERT_SOURCE_1);
WriteDlgLine(&Ctx, prompt_str);
WriteDlgLine(&Ctx, WEBC_SKIN_ALERT_SOURCE_2);
WriteDlgLine(&Ctx, WEBC_SKIN_ALERT_SOURCE_3);
}
else if (which_dialogue == WHICH_DIALOGUE_CONFIRM)
{
WriteDlgLine(&Ctx, WEBC_SKIN_CONFIRM_SOURCE_1);
WriteDlgLine(&Ctx, prompt_str);
WriteDlgLine(&Ctx, WEBC_SKIN_CONFIRM_SOURCE_2);
WriteDlgLine(&Ctx, WEBC_SKIN_CONFIRM_SOURCE_3);
}
else if (which_dialogue == WHICH_DIALOGUE_PROMPT)
{
char *default_str = "";
if (argc > 1)
default_str = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
WriteDlgLine(&Ctx, prompt_str);
rtp_sprintf(&buff[0],WEBC_SKIN_PROMPT_SOURCE_1,default_str);
WriteDlgLine(&Ctx, &buff[0]);
WriteDlgLine(&Ctx, WEBC_SKIN_PROMPT_SOURCE_2);
WriteDlgLine(&Ctx, WEBC_SKIN_PROMPT_SOURCE_3);
}
wcDocClose(&Ctx);
wcDocRefresh(&Ctx);
/* Go modal here */
// HBROWSER_HANDLE Browser = webc_CreateBrowser(&config, WEBC_TRUE, "");
HTMLBrowser *pBrowser = (HTMLBrowser *) Browser;
while (pBrowser->ProcessInputQueue(WEBC_TRUE) >= 0)
{
WebString *user_WebString;
void* privateData = webc_BrowserGetPrivateData(Browser);
if (privateData)
{
user_WebString = (WebString *) privateData;
if (which_dialogue == WHICH_DIALOGUE_PROMPT)
{
if (user_WebString && user_WebString->getLength())
*rval = STRING_TO_JSVAL(WEBC_JS_NEW_STRING_COPY_Z(cx, user_WebString->getChars()));
else
*rval = JSVAL_VOID;
//.........这里部分代码省略.........
示例4: 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
}