Пример #1
0
void CUIChatWnd::Init(CUIXml& uiXml)
{
    UIPrefix					= UIHelper::CreateTextWnd(uiXml, "chat_prefix", this);
    inprogress_prefix_rect		= UIPrefix->GetWndRect();

    UIEditBox					= UIHelper::CreateEditBox(uiXml, "chat_edit_box", this);
    inprogress_edit_rect		= UIEditBox->GetWndRect();
    UIEditBox->SetWindowName		("chat_edit_box");

    pendingGameMode				= false;

    R_ASSERT( uiXml.NavigateToNode(CHAT_PREFIX_PENDING));
    R_ASSERT( uiXml.NavigateToNode(CHAT_EDITBOX_PENDING));


    pending_prefix_rect.x1 		= uiXml.ReadAttribFlt(CHAT_PREFIX_PENDING, 0, "x");
    pending_prefix_rect.y1 		= uiXml.ReadAttribFlt(CHAT_PREFIX_PENDING, 0, "y");
    pending_prefix_rect.x2 		= uiXml.ReadAttribFlt(CHAT_PREFIX_PENDING, 0, "width");
    pending_prefix_rect.y2 		= uiXml.ReadAttribFlt(CHAT_PREFIX_PENDING, 0, "height");
    pending_prefix_rect.rb.add	(pending_prefix_rect.lt);

    pending_edit_rect.x1 		= uiXml.ReadAttribFlt(CHAT_EDITBOX_PENDING, 0, "x");
    pending_edit_rect.y1 		= uiXml.ReadAttribFlt(CHAT_EDITBOX_PENDING, 0, "y");
    pending_edit_rect.x2 		= uiXml.ReadAttribFlt(CHAT_EDITBOX_PENDING, 0, "width");
    pending_edit_rect.y2 		= uiXml.ReadAttribFlt(CHAT_EDITBOX_PENDING, 0, "height");
    pending_edit_rect.rb.add	(pending_edit_rect.lt);

    Register	(UIEditBox);
    AddCallback	(UIEditBox,    EDIT_TEXT_COMMIT,   CUIWndCallback::void_function( this, &CUIChatWnd::OnChatCommit ) );
    AddCallback	(UIEditBox,    EDIT_TEXT_CANCEL,   CUIWndCallback::void_function( this, &CUIChatWnd::OnChatCancel ) );
}
Пример #2
0
int main(void)
{

	MyClass m(100);
	m.SetI(99, -100);
	m.SetI(1, 100);

	std::string str("ABC");

	std::cout << "Size int: " << sizeof(int) << std::endl;
	std::cout << "Size float *: " << sizeof(float *) << std::endl;
	std::cout << "Size std::string : " << sizeof(std::string ) << std::endl;
	std::cout << "Size std::string &: " << sizeof(std::string &) << std::endl;
	std::cout << "Size std::string &&: " << sizeof(std::string &&) << std::endl;
	std::cout << "Size const std::string *: " << sizeof(const std::string *) << std::endl;


	AddCallback("CALLBACK_5", (void *)func_5, 5, sizeof(char), sizeof(double), sizeof(std::string *), sizeof(MyClass *), sizeof(long long));
	DoSomething("CALLBACK_5", 'C', 10.01, &str, &m, 0xffffffffffffffffull );

	AddCallback("CALLBACK_0", (void *)func_0, 0);
	DoSomething("CALLBACK_0");

	AddCallback("CALLBACK_1", (void *)func_2, 2, sizeof(short), sizeof(double));
	DoSomething("CALLBACK_1", 32768, 10.01);

	std::cout << "=========\nstr: " << str << std::endl;
	std::cout << "m[1]: " << m.GetI(1) << std::endl;

	return 0;
}
Пример #3
0
void CUILogsWnd::Init()
{
	m_uiXml.Load( CONFIG_PATH, UI_PATH, PDA_LOGS_XML );

	CUIXmlInit::InitWindow( m_uiXml, "main_wnd", 0, this );

//	m_background		= UIHelper::CreateFrameLine( m_uiXml, "background", this );
	m_background				= UIHelper::CreateFrameWindow(m_uiXml, "background", this);
	m_center_background			= UIHelper::CreateFrameWindow(m_uiXml, "center_background", this);
	
	//m_actor_ch_info = xr_new<CUICharacterInfo>();
	//m_actor_ch_info->SetAutoDelete( true );
	//AttachChild( m_actor_ch_info );
	//m_actor_ch_info->InitCharacterInfo( &m_uiXml, "actor_ch_info" );

//	m_center_background	= UIHelper::CreateStatic( m_uiXml, "center_background", this );
	m_center_caption	= UIHelper::CreateTextWnd( m_uiXml, "center_caption", this );

	string256 buf;
	xr_strcpy( buf, sizeof(buf), m_center_caption->GetText() );
	xr_strcat( buf, sizeof(buf), CStringTable().translate("ui_logs_center_caption").c_str() );
	m_center_caption->SetText( buf );

	CUIFixedScrollBar* tmp_scroll = xr_new<CUIFixedScrollBar>();
	m_list = xr_new<CUIScrollView>(tmp_scroll);
	m_list->SetAutoDelete( true );
	AttachChild( m_list );
	CUIXmlInit::InitScrollView( m_uiXml, "logs_list", 0, m_list);
//	m_list->SetWindowName("---logs_list");
//	m_logs_list->m_sort_function = fastdelegate::MakeDelegate( this, &CUIRankingWnd::SortingLessFunction );

	m_filter_news = UIHelper::CreateCheck( m_uiXml, "filter_news", this );
	m_filter_talk = UIHelper::CreateCheck( m_uiXml, "filter_talk", this );
	m_filter_news->SetCheck( true );
	m_filter_talk->SetCheck( true );

//	m_date_caption = UIHelper::CreateTextWnd( m_uiXml, "date_caption", this );
//	m_date         = UIHelper::CreateTextWnd( m_uiXml, "date", this );

	m_period_caption = UIHelper::CreateTextWnd( m_uiXml, "period_caption", this );
	m_period         = UIHelper::CreateTextWnd( m_uiXml, "period", this );

	m_prev_period = UIHelper::Create3tButton( m_uiXml, "btn_prev_period", this );
	m_next_period = UIHelper::Create3tButton( m_uiXml, "btn_next_period", this );

	Register( m_filter_news );
	Register( m_filter_talk );
	Register( m_prev_period );
	Register( m_next_period );

	AddCallback( m_filter_news, BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::UpdateChecks ) );
	AddCallback( m_filter_talk, BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::UpdateChecks ) );
	AddCallback( m_prev_period, BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::PrevPeriod ) );
	AddCallback( m_next_period, BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::NextPeriod ) );

	m_start_game_time = Level().GetStartGameTime();
	m_start_game_time = GetShiftPeriod( m_start_game_time, 0 );
}
Пример #4
0
trpgSceneParser::trpgSceneParser()
{
    // Register for Push and Pop
    AddCallback(TRPG_PUSH,new trpgSceneHelperPush(this));
    AddCallback(TRPG_POP,new trpgSceneHelperPop(this));

    // Register for default
    SetDefaultCallback(new trpgSceneHelperDefault(this));
}
void CUIActorMenu::InitCallbacks()
{
	Register( m_trade_button );
	Register( m_takeall_button );
	Register( m_exit_button );
	Register( m_UIPropertiesBox );
	VERIFY( m_pUpgradeWnd );
	Register( m_pUpgradeWnd->m_btn_repair );

	AddCallback( m_trade_button->WindowName(),    BUTTON_CLICKED,   CUIWndCallback::void_function( this, &CUIActorMenu::OnBtnPerformTrade ) );
	AddCallback( m_takeall_button->WindowName(),  BUTTON_CLICKED,   CUIWndCallback::void_function( this, &CUIActorMenu::TakeAllFromPartner ) );
	AddCallback( m_exit_button->WindowName(),     BUTTON_CLICKED,   CUIWndCallback::void_function( this, &CUIActorMenu::OnBtnExitClicked ) );
	AddCallback( m_UIPropertiesBox->WindowName(), PROPERTY_CLICKED, CUIWndCallback::void_function( this, &CUIActorMenu::ProcessPropertiesBoxClicked ) );
	AddCallback( m_pUpgradeWnd->m_btn_repair->WindowName(), BUTTON_CLICKED,   CUIWndCallback::void_function( this, &CUIActorMenu::TryRepairItem ) );
}
Пример #6
0
int
CamerasChild::StartCapture(CaptureEngine aCapEngine,
                           const int capture_id,
                           webrtc::CaptureCapability& webrtcCaps,
                           webrtc::ExternalRenderer* cb)
{
  LOG((__PRETTY_FUNCTION__));
  AddCallback(aCapEngine, capture_id, cb);
  CaptureCapability capCap(webrtcCaps.width,
                           webrtcCaps.height,
                           webrtcCaps.maxFPS,
                           webrtcCaps.expectedCaptureDelay,
                           webrtcCaps.rawType,
                           webrtcCaps.codecType,
                           webrtcCaps.interlaced);
  nsCOMPtr<nsIRunnable> runnable =
    media::NewRunnableFrom([this, aCapEngine, capture_id, capCap]() -> nsresult {
      if (this->SendStartCapture(aCapEngine, capture_id, capCap)) {
        return NS_OK;
      }
      return NS_ERROR_FAILURE;
    });
  LockAndDispatch<> dispatcher(this, __func__, runnable);
  return dispatcher.ReturnValue();
}
Пример #7
0
/* Init extension, register at server.
 * Since other extensions may rely on XGE (XInput does already), it is a good
 * idea to init XGE first, before any other extension.
 */
void
GEExtensionInit(void)
{
    ExtensionEntry *extEntry;

    if (!dixRegisterPrivateKey(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
        FatalError("GEExtensionInit: GE private request failed.\n");

    if(!AddCallback(&ClientStateCallback, GEClientCallback, 0))
    {
        FatalError("GEExtensionInit: register client callback failed.\n");
    }

    if((extEntry = AddExtension(GE_NAME,
                        0, GENumberErrors,
                        ProcGEDispatch, SProcGEDispatch,
                        GEResetProc, StandardMinorOpcode)) != 0)
    {
        memset(GEExtensions, 0, sizeof(GEExtensions));

        EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
    } else {
        FatalError("GEInit: AddExtensions failed.\n");
    }

}
Пример #8
0
void
XFixesExtensionInit(void)
{
    ExtensionEntry *extEntry;

    XFixesClientPrivateIndex = AllocateClientPrivateIndex ();
    if (!AllocateClientPrivate (XFixesClientPrivateIndex, 
				sizeof (XFixesClientRec)))
	return;
    if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0))
	return;

    if (XFixesSelectionInit() && XFixesCursorInit () && XFixesRegionInit () &&
	(extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents, 
				 XFixesNumberErrors,
				 ProcXFixesDispatch, SProcXFixesDispatch,
				 XFixesResetProc, StandardMinorOpcode)) != 0)
    {
	XFixesReqCode = (unsigned char)extEntry->base;
	XFixesEventBase = extEntry->eventBase;
	XFixesErrorBase = extEntry->errorBase;
	EventSwapVector[XFixesEventBase + XFixesSelectionNotify] =
	    (EventSwapPtr) SXFixesSelectionNotifyEvent;
	EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
	    (EventSwapPtr) SXFixesCursorNotifyEvent;
    }
}
Пример #9
0
void
DamageExtensionInit(void)
{
    ExtensionEntry *extEntry;
    int		    s;

    for (s = 0; s < screenInfo.numScreens; s++)
	DamageSetup (screenInfo.screens[s]);

    DamageExtType = CreateNewResourceType (FreeDamageExt, "DamageExt");
    if (!DamageExtType)
	return;

    DamageExtWinType = CreateNewResourceType (FreeDamageExtWin, "DamageExtWin");
    if (!DamageExtWinType)
	return;

    if (!dixRegisterPrivateKey(&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (DamageClientRec)))
	return;

    if (!AddCallback (&ClientStateCallback, DamageClientCallback, 0))
	return;

    if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents, 
				 XDamageNumberErrors,
				 ProcDamageDispatch, SProcDamageDispatch,
				 DamageResetProc, StandardMinorOpcode)) != 0)
    {
	DamageReqCode = (unsigned char)extEntry->base;
	DamageEventBase = extEntry->eventBase;
	EventSwapVector[DamageEventBase + XDamageNotify] =
			(EventSwapPtr) SDamageNotifyEvent;
	SetResourceTypeErrorValue(DamageExtType, extEntry->errorBase + BadDamage);
    }
}
Пример #10
0
void lfModifier::AddSubpixelCallback (
    lfSubpixelCoordFunc callback, int priority, void *data, size_t data_size)
{
    lfSubpixelCallbackData *d = new lfSubpixelCallbackData ();
    d->callback = callback;
    AddCallback (SubpixelCallbacks, d, priority, data, data_size);
}
Пример #11
0
void
RRExtensionInit (void)
{
    ExtensionEntry *extEntry;

    if (RRNScreens == 0) return;

    if (!dixRequestPrivate(RRClientPrivateKey,
                           sizeof (RRClientRec) +
                           screenInfo.numScreens * sizeof (RRTimesRec)))
        return;
    if (!AddCallback (&ClientStateCallback, RRClientCallback, 0))
        return;

    RRClientType = CreateNewResourceType(RRFreeClient);
    if (!RRClientType)
        return;
    RREventType = CreateNewResourceType(RRFreeEvents);
    if (!RREventType)
        return;
    extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors,
                             ProcRRDispatch, SProcRRDispatch,
                             NULL, StandardMinorOpcode);
    if (!extEntry)
        return;
    RRErrorBase = extEntry->errorBase;
    RREventBase = extEntry->eventBase;
    EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr)
            SRRScreenChangeNotifyEvent;
    EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr)
            SRRNotifyEvent;
#ifdef PANORAMIX
    RRXineramaExtensionInit();
#endif
}
Пример #12
0
void UITaskListWnd::init_from_xml( CUIXml& xml, LPCSTR path )
{
	VERIFY( hint_wnd );
	CUIXmlInit::InitWindow( xml, path, 0, this );

	XML_NODE*  stored_root = xml.GetLocalRoot();
	XML_NODE*  tmpl_root   = xml.NavigateToNode( path, 0 );
	xml.SetLocalRoot( tmpl_root );
	
	m_background = UIHelper::CreateFrameWindow( xml, "background_frame", this );
	m_caption    = UIHelper::CreateStatic( xml, "t_caption", this );
//	m_counter    = UIHelper::CreateStatic( xml, "t_counter", this );
	m_bt_close   = UIHelper::Create3tButton( xml, "btn_close", this );

	Register( m_bt_close );
	AddCallback( m_bt_close, BUTTON_DOWN, CUIWndCallback::void_function( this, &UITaskListWnd::OnBtnClose ) );

	m_list = xr_new<CUIScrollView>();
	m_list->SetAutoDelete( true );
	AttachChild( m_list );
	CUIXmlInit::InitScrollView( xml, "task_list", 0, m_list );
	m_orig_h = GetHeight();

	m_list->SetWindowName("---second_task_list");
	m_list->m_sort_function = fastdelegate::MakeDelegate( this, &UITaskListWnd::SortingLessFunction );

	xml.SetLocalRoot( stored_root );
}
Пример #13
0
/* static */
int ProcXagCreate (
    register ClientPtr client)
{
    REQUEST (xXagCreateReq);
    AppGroupPtr pAppGrp;
    int ret;

    REQUEST_AT_LEAST_SIZE (xXagCreateReq);

    LEGAL_NEW_RESOURCE (stuff->app_group, client);
    pAppGrp = CreateAppGroup (client, stuff->app_group, 
		stuff->attrib_mask, (CARD32*) &stuff[1]);
    if (!pAppGrp)
	return BadAlloc;
    ret = AttrValidate (client, stuff->attrib_mask, pAppGrp);
    if (ret != Success) {
	XagAppGroupFree ((pointer)pAppGrp, (XID)0);
	return ret;
    }
    if (pAppGrp->single_screen) {
	CreateConnectionInfo (pAppGrp);
	if (!pAppGrp->ConnectionInfo)
	    return BadAlloc;
    }
    if (!AddResource (stuff->app_group, RT_APPGROUP, (pointer)pAppGrp))
	return BadAlloc;
    if (XagCallbackRefCount++ == 0)
	(void) AddCallback (&ClientStateCallback, XagClientStateChange, NULL);
    return client->noClientException;
}
Пример #14
0
void
XevieExtensionInit ()
{
    ExtensionEntry* extEntry;

    if (serverGeneration != xevieServerGeneration) {
        if ((xevieDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1)
            return;
        xevieServerGeneration = serverGeneration;
    }

    if (!AddCallback(&ServerGrabCallback,XevieServerGrabStateCallback,NULL))
       return;

    if ((extEntry = AddExtension (XEVIENAME,
				0,
				XevieNumberErrors,
				ProcDispatch,
				SProcDispatch,
				ResetProc,
				StandardMinorOpcode))) {
	ReqCode = (unsigned char)extEntry->base;
	ErrorBase = extEntry->errorBase;
    }

    /* PC servers initialize the desktop colors (citems) here! */
}
Пример #15
0
CUIQuestionItem::CUIQuestionItem(CUIXml* xml_doc, LPCSTR path)
{
	m_text							= xr_new<CUI3tButton>();
	m_text->SetAutoDelete			(true);
	AttachChild						(m_text);

	string512						str;
	CUIXmlInit						xml_init;

	xr_strcpy						(str,path);
	xml_init.InitWindow				(*xml_doc, str, 0, this);

	m_min_height					= xml_doc->ReadAttribFlt(path,0,"min_height",15.0f);

	strconcat						(sizeof(str),str,path,":content_text");
	xml_init.Init3tButton			(*xml_doc, str, 0, m_text);

	Register						(m_text);
	AddCallback						(m_text,BUTTON_CLICKED,CUIWndCallback::void_function(this, &CUIQuestionItem::OnTextClicked));

	m_num_text						= xr_new<CUITextWnd>();
	m_num_text->SetAutoDelete		(true);
	AttachChild						(m_num_text);
	strconcat						(sizeof(str),str,path,":num_text");
	xml_init.InitTextWnd			(*xml_doc, str, 0, m_num_text);
}
Пример #16
0
void CUIEventsWnd::Init				()
{
	CUIXml uiXml;
	bool xml_result					= uiXml.Init(CONFIG_PATH, UI_PATH, "pda_events.xml");
	R_ASSERT3						(xml_result, "xml file not found", "pda_events.xml");

	CUIXmlInit xml_init;
	xml_init.InitWindow				(uiXml, "main_wnd", 0, this);


	m_UILeftFrame					= xr_new<CUIFrameWindow>(); m_UILeftFrame->SetAutoDelete(true);
	AttachChild						(m_UILeftFrame);
	xml_init.InitFrameWindow		(uiXml, "main_wnd:left_frame", 0, m_UILeftFrame);


	m_UILeftHeader					= xr_new<CUIFrameLineWnd>(); m_UILeftHeader->SetAutoDelete(true);
	m_UILeftFrame->AttachChild		(m_UILeftHeader);
	xml_init.InitFrameLine			(uiXml, "main_wnd:left_frame:left_frame_header", 0, m_UILeftHeader);

//.	xml_init.InitAutoStaticGroup	(uiXml, "main_wnd:left_frame",m_UILeftFrame);

	m_UIAnimation					= xr_new<CUIAnimatedStatic>(); m_UIAnimation->SetAutoDelete(true);
	xml_init.InitAnimatedStatic		(uiXml, "main_wnd:left_frame:left_frame_header:anim_static", 0, m_UIAnimation);
	m_UILeftHeader->AttachChild		(m_UIAnimation);

	m_UIRightWnd					= xr_new<CUIWindow>(); m_UIRightWnd->SetAutoDelete(true);
	AttachChild						(m_UIRightWnd);
	xml_init.InitWindow				(uiXml, "main_wnd:right_frame", 0, m_UIRightWnd);

	m_UIMapWnd						= xr_new<CUIMapWnd>(); m_UIMapWnd->SetAutoDelete(false);
	m_UIMapWnd->Init				("pda_events.xml","main_wnd:right_frame:map_wnd");

	m_UITaskInfoWnd					= xr_new<CUITaskDescrWnd>(); m_UITaskInfoWnd->SetAutoDelete(false);
	m_UITaskInfoWnd->Init			(&uiXml,"main_wnd:right_frame:task_descr_view");
	

	m_ListWnd						= xr_new<CUIScrollView>(); m_ListWnd->SetAutoDelete(true);
	m_UILeftFrame->AttachChild		(m_ListWnd);
	xml_init.InitScrollView			(uiXml, "main_wnd:left_frame:list", 0, m_ListWnd);

	m_TaskFilter					= xr_new<CUITabControl>(); m_TaskFilter->SetAutoDelete(true);
	m_UILeftFrame->AttachChild		(m_TaskFilter);
	xml_init.InitTabControl			(uiXml, "main_wnd:left_frame:filter_tab", 0, m_TaskFilter);
	m_TaskFilter->SetWindowName		("filter_tab");
	Register						(m_TaskFilter);
    AddCallback						("filter_tab",TAB_CHANGED,CUIWndCallback::void_function(this,&CUIEventsWnd::OnFilterChanged));
/*
    m_primary_or_all_filter_btn		= xr_new<CUI3tButton>(); m_primary_or_all_filter_btn->SetAutoDelete(true);
	m_UILeftFrame->AttachChild		(m_primary_or_all_filter_btn);
	xml_init.Init3tButton			(uiXml, "main_wnd:left_frame:primary_or_all", 0, m_primary_or_all_filter_btn);

	Register						(m_primary_or_all_filter_btn);
	m_primary_or_all_filter_btn->	SetWindowName("btn_primary_or_all");
    AddCallback						("btn_primary_or_all",BUTTON_CLICKED,boost::bind(&CUIEventsWnd::OnFilterChanged,this,_1,_2));
*/
   m_currFilter						= eActiveTask;
   SetDescriptionMode				(true);

   m_ui_task_item_xml.Init			(CONFIG_PATH, UI_PATH, "job_item.xml");
}
Пример #17
0
void
XFixesExtensionInit(void)
{
    ExtensionEntry *extEntry;

    if (!dixRegisterPrivateKey(&XFixesClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (XFixesClientRec)))
	return;
    if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0))
	return;

    if (XFixesSelectionInit() && XFixesCursorInit () && XFixesRegionInit () &&
	(extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents, 
				 XFixesNumberErrors,
				 ProcXFixesDispatch, SProcXFixesDispatch,
				 XFixesResetProc, StandardMinorOpcode)) != 0)
    {
	XFixesReqCode = (unsigned char)extEntry->base;
	XFixesEventBase = extEntry->eventBase;
	XFixesErrorBase = extEntry->errorBase;
	EventSwapVector[XFixesEventBase + XFixesSelectionNotify] =
	    (EventSwapPtr) SXFixesSelectionNotifyEvent;
	EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
	    (EventSwapPtr) SXFixesCursorNotifyEvent;
	SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion);
	SetResourceTypeErrorValue(PointerBarrierType,
				  XFixesErrorBase + BadBarrier);
    }
}
Bool
XvideoInit(void)
{
    if (!AddCallback(&ResourceStateCallback, ResourceFreed, NULL))
        return FALSE;

    return TRUE;
}
Пример #19
0
/**
 * Register a callback for a list variable
 *
 * The callback is triggered when an element is added/removed from the
 * list or when the list is cleared.
 *
 * See var_AddCallback().
 */
void var_AddListCallback( vlc_object_t *p_this, const char *psz_name,
                          vlc_list_callback_t pf_callback, void *p_data )
{
    callback_entry_t entry;
    entry.pf_list_callback = pf_callback;
    entry.p_data = p_data;

    AddCallback(p_this, psz_name, entry, vlc_list_callback);
}
Пример #20
0
void cWidgetListBox::OnInit()
{
    mpSlider = mpSet->CreateWidgetSlider(eWidgetSliderOrientation_Vertical,0,0,0,this);
    mpSlider->AddCallback(eGuiMessage_SliderMove,this,kGuiCallback(MoveSlider));

    AddCallback(eGuiMessage_OnDraw,this,kGuiCallback(DrawText));

    OnChangeSize();
}
void
SecurityExtensionInit(INITARGS)
{
    ExtensionEntry	*extEntry;
    int ret = TRUE;

    SecurityAuthorizationResType =
	CreateNewResourceType(SecurityDeleteAuthorization,
			      "SecurityAuthorization");

    RTEventClient =
	CreateNewResourceType(SecurityDeleteAuthorizationEventClient,
			      "SecurityEventClient");

    if (!SecurityAuthorizationResType || !RTEventClient)
	return;

    RTEventClient |= RC_NEVERRETAIN;

    /* Allocate the private storage */
    if (!dixRegisterPrivateKey(stateKey, PRIVATE_CLIENT, sizeof(SecurityStateRec)))
	FatalError("SecurityExtensionSetup: Can't allocate client private.\n");

    /* Register callbacks */
    ret &= AddCallback(&ClientStateCallback, SecurityClientState, NULL);

    ret &= XaceRegisterCallback(XACE_EXT_DISPATCH, SecurityExtension, NULL);
    ret &= XaceRegisterCallback(XACE_RESOURCE_ACCESS, SecurityResource, NULL);
    ret &= XaceRegisterCallback(XACE_DEVICE_ACCESS, SecurityDevice, NULL);
    ret &= XaceRegisterCallback(XACE_PROPERTY_ACCESS, SecurityProperty, NULL);
    ret &= XaceRegisterCallback(XACE_SEND_ACCESS, SecuritySend, NULL);
    ret &= XaceRegisterCallback(XACE_RECEIVE_ACCESS, SecurityReceive, NULL);
    ret &= XaceRegisterCallback(XACE_CLIENT_ACCESS, SecurityClient, NULL);
    ret &= XaceRegisterCallback(XACE_EXT_ACCESS, SecurityExtension, NULL);
    ret &= XaceRegisterCallback(XACE_SERVER_ACCESS, SecurityServer, NULL);

    if (!ret)
	FatalError("SecurityExtensionSetup: Failed to register callbacks\n");

    /* Add extension to server */
    extEntry = AddExtension(SECURITY_EXTENSION_NAME,
			    XSecurityNumberEvents, XSecurityNumberErrors,
			    ProcSecurityDispatch, SProcSecurityDispatch,
                            SecurityResetProc, StandardMinorOpcode);

    SecurityErrorBase = extEntry->errorBase;
    SecurityEventBase = extEntry->eventBase;

    EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
	(EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;

    SetResourceTypeErrorValue(SecurityAuthorizationResType, SecurityErrorBase + XSecurityBadAuthorization);

    /* Label objects that were created before we could register ourself */
    SecurityLabelInitial();
}
_X_EXPORT int
dixRegisterPrivateDeleteFunc(const DevPrivateKey key,
			     CallbackProcPtr callback, pointer data)
{
    PrivateDescRec *item = findItem(key);
    if (!item) {
	if (!dixRequestPrivate(key, 0))
	    return FALSE;
	item = findItem(key);
    }
    return AddCallback(&item->deletefuncs, callback, data);
}
Пример #23
0
void CUIMessageBoxEx::InitMessageBox(LPCSTR xml_template)
{
	//CUIDialogWnd::SetWndRect(Frect().set(0.0f,0.0f,1024.0f,768.0f));
	m_pMessageBox->InitMessageBox(xml_template);
	
	SetWndPos( m_pMessageBox->GetWndPos() );
	SetWndSize( m_pMessageBox->GetWndSize() );
	m_pMessageBox->SetWndPos( Fvector2().set(0,0) );

	AddCallback( m_pMessageBox->WindowName(), MESSAGE_BOX_YES_CLICKED, CUIWndCallback::void_function( this, &CUIMessageBoxEx::OnOKClicked ) );
	
}
Bool
ClientInit(void)
{
    unsigned rec_size = sizeof(ClientPolicyRec);

    if (dixRegisterPrivateKey(ClientPrivateKey, PRIVATE_CLIENT, rec_size) &&
        AddCallback(&ClientStateCallback, ClientCallback, NULL))
    {
        return TRUE;
    }

    return FALSE;
}
Пример #25
0
/* The Scene Graph Parser constructor does two things.  First, it sets
    up any internal variables like a normal constructor.  Then it registers
    an interest in all the node types it knows how to parse.  It does this
    by calling AddCallback, which is a method of its parent.  It passes in
    a token representing the node type (see trpg_io.h) and an object that
    is capable of parsing the given type.

    The objects we pass in here are called helpers.  They parse specific
    objects and add them to the user defined scene graph.  Examples include
    trpgReadGeometryHelper, trpgReadGroupHelper, trpgReadAttachHelper,
    trpgReadBillboardHelper, trpgReadLodHelper, trpgReadModelRefHelper,
    trpgReadTileHeaderHelper.  These are all derived from trpgr_Callback.
    You should not use any of these yourself. Instead look at these classes
    as examples of how to implement your own subclass of trpgSceneParser.
    */
trpgSceneGraphParser::trpgSceneGraphParser()
{
    top = currTop = NULL;

    // Register the readers
    AddCallback(TRPG_GEOMETRY,new trpgReadGeometryHelper(this));
    AddCallback(TRPG_GROUP,new trpgReadGroupHelper(this));
    AddCallback(TRPG_ATTACH,new trpgReadAttachHelper(this));
   AddCallback(TRPG_CHILDREF,new trpgReadChildRefHelper(this));
    AddCallback(TRPG_BILLBOARD,new trpgReadBillboardHelper(this));
    AddCallback(TRPG_LOD,new trpgReadLodHelper(this));
//    AddCallback(TRPG_TRANSFORM,new trpgReadTransformHelper(this));
    AddCallback(TRPG_MODELREF,new trpgReadModelRefHelper(this));
//    AddCallback(TRPG_LAYER,new trpgReadLayerHelper(this));
    AddCallback(TRPGTILEHEADER,new trpgReadTileHeaderHelper(this));
}
Пример #26
0
static Bool
CheckSelectionCallback(void)
{
    if (selectionEvents) {
        if (!SelectionCallbackRegistered) {
            if (!AddCallback(&SelectionCallback, XFixesSelectionCallback, NULL))
                return FALSE;
            SelectionCallbackRegistered = TRUE;
        }
    }
    else {
        if (SelectionCallbackRegistered) {
            DeleteCallback(&SelectionCallback, XFixesSelectionCallback, NULL);
            SelectionCallbackRegistered = FALSE;
        }
    }
    return TRUE;
}
Пример #27
0
	void cWidgetComboBox::OnInit()
	{
		m_pText = m_pSet->CreateWidgetTextBox(0,m_vSize,_W(""),this);
		m_pText->SetText(m_sText);
		m_pText->SetCanEdit(false);

		m_pButton = m_pSet->CreateWidgetButton(0,0,_W(""),this);
		m_pButton->SetImage(m_pSkin->GetGfx(eGuiSkinGfx_ComboBoxButtonIcon), false);
		m_pButton->AddCallback(eGuiMessage_MouseDown, this, kGuiCallback(ButtonPress));

		m_pSlider = m_pSet->CreateWidgetSlider(eWidgetSliderOrientation_Vertical,0,0,0,this);
		m_pSlider->AddCallback(eGuiMessage_SliderMove,this,kGuiCallback(SliderMove));
		m_pSlider->AddCallback(eGuiMessage_LostFocus,this,kGuiCallback(SliderLostFocus));
		m_pSlider->SetEnabled(false);
		m_pSlider->SetVisible(false);

		AddCallback(eGuiMessage_OnDraw,this,kGuiCallback(DrawText));

		OnChangeSize();
	}
Пример #28
0
void
XCalibrateExtensionInit(void)
{
  ExtensionEntry *extEntry;

  if (!AddCallback (&ClientStateCallback, XCalibrateClientCallback, 0))
    return;  

  extEntry = AddExtension(XCALIBRATE_NAME, XCalibrateNumberEvents, XCalibrateNumberErrors,
			  ProcXCalibrateDispatch, SProcXCalibrateDispatch,
			  XCalibrateResetProc, StandardMinorOpcode);

  if (!extEntry)
    return;

  XCalibrateReqCode = (unsigned char)extEntry->base;
  XCalibrateEventBase = extEntry->eventBase;
  XCalibrateErrorBase = extEntry->errorBase;

  xcalibrate_client = 0;
}
Пример #29
0
void
XevieExtensionInit ()
{
    ExtensionEntry* extEntry;

    if (!AddCallback(&ServerGrabCallback,XevieServerGrabStateCallback,NULL))
       return;

    if (extEntry = AddExtension (XEVIENAME,
				0,
				XevieNumberErrors,
				ProcDispatch,
				SProcDispatch,
				ResetProc,
				StandardMinorOpcode)) {
	ReqCode = (unsigned char)extEntry->base;
	ErrorBase = extEntry->errorBase;
    }

    /* PC servers initialize the desktop colors (citems) here! */
}
Пример #30
0
void vncSelectionInit(void)
{
  xaPRIMARY = MakeAtom("PRIMARY", 7, TRUE);
  xaCLIPBOARD = MakeAtom("CLIPBOARD", 9, TRUE);

  xaTARGETS = MakeAtom("TARGETS", 7, TRUE);
  xaTIMESTAMP = MakeAtom("TIMESTAMP", 9, TRUE);
  xaSTRING = MakeAtom("STRING", 6, TRUE);
  xaTEXT = MakeAtom("TEXT", 4, TRUE);
  xaUTF8_STRING = MakeAtom("UTF8_STRING", 11, TRUE);

  /* There are no hooks for when these are internal windows, so
   * override the relevant handlers. */
  origProcConvertSelection = ProcVector[X_ConvertSelection];
  ProcVector[X_ConvertSelection] = vncProcConvertSelection;
  origProcSendEvent = ProcVector[X_SendEvent];
  ProcVector[X_SendEvent] = vncProcSendEvent;

  if (!AddCallback(&SelectionCallback, vncSelectionCallback, 0))
    FatalError("Add VNC SelectionCallback failed\n");
}