00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef __OFFSCREENGECKO_EMBEDDING_H__
00038 #define __OFFSCREENGECKO_EMBEDDING_H__
00039
00044 #include "baseobj.h"
00045 #include "componentmgr.h"
00046 #include "geckomem.h"
00047 #include "string.h"
00048
00053 OSGK_DERIVEDTYPE(OSGK_EmbeddingOptions);
00054
00059 OSGK_EXTERN_C OSGK_API OSGK_EmbeddingOptions* osgk_embedding_options_create (void);
00060
00066 OSGK_EXTERN_C OSGK_API void osgk_embedding_options_add_search_path (
00067 OSGK_EmbeddingOptions* options, const char* path);
00068
00074 OSGK_EXTERN_C OSGK_API void osgk_embedding_options_add_components_path (
00075 OSGK_EmbeddingOptions* options, const char* path);
00076
00094 OSGK_EXTERN_C OSGK_API void osgk_embedding_options_set_profile_dir (
00095 OSGK_EmbeddingOptions* options, const char* profileDir,
00096 const char* localProfileDir OSGK_DEFAULT_ARG(0) );
00097
00098 #ifdef __cplusplus
00099
00100 namespace OSGK
00101 {
00106 struct EmbeddingOptions : public CXXAPI::Wrap<OSGK_EmbeddingOptions>
00107 {
00111 EmbeddingOptions() : WrapperType (osgk_embedding_options_create()) { }
00112
00113 explicit EmbeddingOptions (WrappedType* obj) : WrapperType (obj) {}
00114 EmbeddingOptions& operator=(const EmbeddingOptions& other)
00115 {
00116 WrapperType::operator=(other);
00117 return *this;
00118 }
00119
00124 void AddSearchPath (const char* path)
00125 {
00126 osgk_embedding_options_add_search_path (GetObject(), path);
00127 }
00128
00133 void AddComponentsPath (const char* path)
00134 {
00135 osgk_embedding_options_add_components_path (GetObject(), path);
00136 }
00137
00154 void SetProfileDir (const char* profileDir,
00155 const char* localProfileDir = 0)
00156 {
00157 osgk_embedding_options_set_profile_dir (GetObject(), profileDir,
00158 localProfileDir);
00159 }
00160 };
00161
00162 }
00163 #endif
00164
00169 OSGK_DERIVEDTYPE(OSGK_Embedding);
00170
00172 #define OSGK_API_VERSION 1
00173
00174 #ifndef OSGK___DOXYRUN__
00175
00178 OSGK_EXTERN_C OSGK_API OSGK_Embedding* osgk_embedding_create2 (
00179 unsigned int apiVer, OSGK_EmbeddingOptions* options,
00180 OSGK_GeckoResult* geckoResult);
00181 #endif
00182
00188 static OSGK_INLINE OSGK_Embedding* osgk_embedding_create (
00189 OSGK_GeckoResult* geckoResult OSGK_DEFAULT_ARG(0))
00190 {
00191 return osgk_embedding_create2 (OSGK_API_VERSION, 0, geckoResult);
00192 }
00193
00200 static OSGK_INLINE OSGK_Embedding* osgk_embedding_create_with_options (
00201 OSGK_EmbeddingOptions* options, OSGK_GeckoResult* geckoResult OSGK_DEFAULT_ARG(0))
00202 {
00203 return osgk_embedding_create2 (OSGK_API_VERSION, options, geckoResult);
00204 }
00205
00212 OSGK_EXTERN_C OSGK_API OSGK_GeckoMem* osgk_embedding_get_gecko_mem (
00213 OSGK_Embedding* embedding);
00214
00221 OSGK_EXTERN_C OSGK_API OSGK_ComponentMgr* osgk_embedding_get_component_mgr (
00222 OSGK_Embedding* embedding);
00223
00224 OSGK_CLASSTYPE_DEF nsIComponentManager;
00225 OSGK_CLASSTYPE_DEF nsIComponentRegistrar;
00226 OSGK_CLASSTYPE_DEF nsIServiceManager;
00227
00234 OSGK_EXTERN_C OSGK_API OSGK_CLASSTYPE_REF nsIComponentManager*
00235 osgk_embedding_get_gecko_component_manager (OSGK_Embedding* embedding);
00242 OSGK_EXTERN_C OSGK_API OSGK_CLASSTYPE_REF nsIComponentRegistrar*
00243 osgk_embedding_get_gecko_component_registrar (OSGK_Embedding* embedding);
00250 OSGK_EXTERN_C OSGK_API OSGK_CLASSTYPE_REF nsIServiceManager*
00251 osgk_embedding_get_gecko_service_manager (OSGK_Embedding* embedding);
00252
00253
00255 enum
00256 {
00258 jsgPrivileged = 1
00259 };
00273 OSGK_EXTERN_C OSGK_API int osgk_embedding_register_js_global (
00274 OSGK_Embedding* embedding, const char* name, const char* contractID,
00275 unsigned int flags, OSGK_String** previousContract OSGK_DEFAULT_ARG(0),
00276 OSGK_GeckoResult* geckoResult OSGK_DEFAULT_ARG(0));
00277
00285 OSGK_EXTERN_C OSGK_API void osgk_embedding_clear_focus (
00286 OSGK_Embedding* embedding);
00287
00299 OSGK_EXTERN_C OSGK_API void osgk_embedding_set_auto_focus (
00300 OSGK_Embedding* embedding, int autoFocus);
00301
00308 OSGK_EXTERN_C OSGK_API int osgk_embedding_get_auto_focus (
00309 OSGK_Embedding* embedding);
00312 #ifdef __cplusplus
00313
00314 namespace OSGK
00315 {
00321 struct Embedding : public CXXAPI::Wrap<OSGK_Embedding>
00322 {
00326 Embedding() : WrapperType (osgk_embedding_create()) { }
00331 Embedding (OSGK_GeckoResult& result) :
00332 WrapperType (osgk_embedding_create (&result)) { }
00337 Embedding(EmbeddingOptions& opt) : WrapperType (
00338 osgk_embedding_create_with_options (opt.GetObject())) { }
00344 Embedding (EmbeddingOptions& opt, OSGK_GeckoResult& result) :
00345 WrapperType (osgk_embedding_create_with_options (
00346 opt.GetObject(), &result)) { }
00347
00348 explicit Embedding (WrappedType* obj) : WrapperType (obj) {}
00349 Embedding& operator=(const Embedding& other)
00350 {
00351 WrapperType::operator=(other);
00352 return *this;
00353 }
00354
00358 GeckoMem GetGeckoMem ()
00359 {
00360 OSGK_GeckoMem* geckoMem =
00361 osgk_embedding_get_gecko_mem (GetObject ());
00362
00363
00364 osgk_addref (geckoMem);
00365 return GeckoMem (geckoMem);
00366 }
00367
00371 ComponentMgr GetComponentMgr()
00372 {
00373 OSGK_ComponentMgr* compMgr =
00374 osgk_embedding_get_component_mgr (GetObject ());
00375
00376
00377 osgk_addref (compMgr);
00378 return ComponentMgr (compMgr);
00379 }
00380
00386 nsIComponentManager* GetGeckoComponentManager ()
00387 {
00388 return osgk_embedding_get_gecko_component_manager (GetObject());
00389 }
00395 nsIComponentRegistrar* GetGeckoComponentRegistrar ()
00396 {
00397 return osgk_embedding_get_gecko_component_registrar (GetObject ());
00398 }
00404 nsIServiceManager* GetGeckoServiceManager ()
00405 {
00406 return osgk_embedding_get_gecko_service_manager (GetObject ());
00407 }
00408
00417 bool RegisterJSGlobal (const char* name, const char* contractID,
00418 unsigned int flags)
00419 {
00420 return osgk_embedding_register_js_global (GetObject(), name,
00421 contractID, flags) != 0;
00422 }
00433 bool RegisterJSGlobal (const char* name, const char* contractID,
00434 unsigned int flags, String& previous)
00435 {
00436 OSGK_String* str;
00437 bool ret = osgk_embedding_register_js_global (GetObject(), name,
00438 contractID, flags, &str) != 0;
00439 previous = String (str);
00440 return ret;
00441 }
00451 bool RegisterJSGlobal (const char* name, const char* contractID,
00452 unsigned int flags, OSGK_GeckoResult& geckoResult)
00453 {
00454 return osgk_embedding_register_js_global (GetObject(), name,
00455 contractID, flags, 0, &geckoResult) != 0;
00456 }
00468 bool RegisterJSGlobal (const char* name, const char* contractID,
00469 unsigned int flags, String& previous, OSGK_GeckoResult& geckoResult)
00470 {
00471 OSGK_String* str;
00472 bool ret = osgk_embedding_register_js_global (GetObject(), name,
00473 contractID, flags, &str, &geckoResult) != 0;
00474 previous = String (str);
00475 return ret;
00476 }
00477
00484 void ClearFocus ()
00485 {
00486 osgk_embedding_clear_focus (GetObject ());
00487 }
00488
00498 void SetAutoFocus (bool autoFocus)
00499 {
00500 osgk_embedding_set_auto_focus (GetObject(), autoFocus);
00501 }
00502
00508 bool GetAutoFocus ()
00509 {
00510 return osgk_embedding_get_auto_focus (GetObject()) != 0;
00511 }
00513 };
00514
00515 }
00516 #endif
00517
00518 #endif // __OFFSCREENGECKO_EMBEDDING_H__