Ejemplo n.º 1
0
void CSlaveWindow::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    if(m_pHandlers) {
        //  Go through list of handlers, see if anyone wanted this
        //      message.
        //  Keep a seperate list, so callbacks can add and remove
        //      themselves via the registration and not cause a
        //      crash.
        //  This also has the side effect of calling the callbacks
        //      in the order of registration, instead of in the
        //      reverse order.
        XP_List *pTraverse = m_pHandlers;
        XP_List *pTemp = NULL;
        SlaveStruct *pSlave = NULL;
        while(pSlave = (SlaveStruct *)XP_ListNextObject(pTraverse)) {
            if(pSlave->m_msg == uMsg)   {
                if(NULL == pTemp) {
                    pTemp = XP_ListNew();
                }
                if(pTemp) {
                    XP_ListAddObject(pTemp, (void *)pSlave);
                }
            }
        }
        if(pTemp) {
            pTraverse = pTemp;
            while(pSlave = (SlaveStruct *)XP_ListNextObject(pTraverse)) {
                //  Fire.
                pSlave->m_swc(uMsg, wParam, lParam);
            }
            XP_ListDestroy(pTemp);
            pTemp = NULL;
        }
    }
}
XP_List *
XFE_FrameListMenu::getShownFrames()
{
	XP_List *	frame_list = XFE_MozillaApp::theApp()->getAllFrameList();
	Cardinal	frame_count = XP_ListCount(frame_list);

	XP_List *	shown_frame_list = NULL;
	Cardinal	i;

	// Find the shown frames and add them to a list
	for (i = 0; i < frame_count; i++)
	{
		// Get the next frame
		XFE_Frame * frame = (XFE_Frame*) XP_ListNextObject(frame_list);

		// Add it to list if valid and shown
		if (frame && XfeIsAlive(frame->getBaseWidget()) && frame->isShown())
		{
			// Create a new list as soon as we find the first shown item
			if (!shown_frame_list)
			{
				shown_frame_list = XP_ListNew();
			}

			XP_ListAddObject(shown_frame_list,frame);
		}
	}

	return shown_frame_list;
}
Ejemplo n.º 3
0
/* cx_AddChildContext
 * Adds child context to the parents children list
 * NULL-safe
 */
void cx_AddChildContext(MWContext *parent, MWContext * child)
{
	if ((parent == NULL) || (child == NULL))
		return;
	if (parent->grid_children == NULL)
		parent->grid_children = XP_ListNew();
	if (parent->grid_children == NULL)
		return;
	XP_ListAddObject(parent->grid_children, child);
}
Ejemplo n.º 4
0
void CContentView::AddChildSizeInfo(NAVCENTPOS *pPreference)
{
    if(m_pChildSizeInfo == NULL) {
        m_pChildSizeInfo = XP_ListNew();
    }
    
    NAVCENTPOS *pNew = (NAVCENTPOS *)XP_ALLOC(sizeof(NAVCENTPOS));
    memcpy(pNew, pPreference, sizeof(NAVCENTPOS));
    
    XP_ListAddObject(m_pChildSizeInfo, pNew);
}
Ejemplo n.º 5
0
/*
 * The passed context is added to the global context list
 */
void XP_AddContextToList(MWContext *context)
{
	if (context == NULL)
		return;

	if (xp_GlobalContextList == NULL)
		xp_GlobalContextList = XP_ListNew();

	if (xp_GlobalContextList == NULL)
		return;

	XP_ListRemoveObject(xp_GlobalContextList, context);	/* No dups */
	XP_ListAddObject(xp_GlobalContextList, context);
	cx_AddChildContext(context->grid_parent, context);
}
Ejemplo n.º 6
0
void *CSlaveWindow::Register(UINT msg, SlaveWindowCallback func)
{
    void *pRetval = NULL;

    //  Can't call into nothing.
    //  Must have list.
    if(func && m_pHandlers)    {
        SlaveStruct *pNew = new SlaveStruct;
        if(pNew)    {
            pNew->m_msg = msg;
            pNew->m_swc = func;

            XP_ListAddObject(m_pHandlers, (void *)pNew);

            pRetval = (void *)pNew;
        }
    }

    return(pRetval);
}
Ejemplo n.º 7
0
/* parse lines in an HTML help mapping file.
 * get window_size and name, etc...
 *
 * when the id is found function returns HTML_HELP_ID_FOUND
 * on error function returns negative error code.
 */
PRIVATE int
net_ParseHTMLHelpLine(HTMLHelpParseObj *obj, char *line_data)
{
	char *line = XP_StripLine(line_data);
	char *token;
	char *next_word;

	if(*line == '<')
	  {
		/* find and terminate the end '>' */
		XP_STRTOK(line, ">");

		token = XP_StripLine(line+1);

		if(!strncasecomp(token, 
						 ID_MAP_TOKEN, 
						 sizeof(ID_MAP_TOKEN)-1))
		  {
			obj->in_id_mapping = TRUE;
		  }
		else if(!strncasecomp(token, 
						 END_ID_MAP_TOKEN, 
						 sizeof(END_ID_MAP_TOKEN)-1))
		  {
			obj->in_id_mapping = FALSE;
		  }
		else if(!strncasecomp(token, 
						 FRAME_GROUP_TOKEN, 
						 sizeof(FRAME_GROUP_TOKEN)-1))
		  {
			char *cp = token + sizeof(FRAME_GROUP_TOKEN)-1;
			frame_set_struct * fgs = XP_NEW(frame_set_struct);

			while(isspace(*cp)) cp++;

			if(fgs)
			  {
				XP_MEMSET(fgs, 0, sizeof(frame_set_struct));

				next_word=NULL; /* init */

				do {
					if(!strncasecomp(cp, SRC_TOKEN, sizeof(SRC_TOKEN)-1))
				  	  {
						char *address = net_get_html_help_token(
														cp+sizeof(SRC_TOKEN)-1,
														&next_word);
						cp = next_word;
						fgs->address = XP_STRDUP(address);
				  	  }
					else if(!strncasecomp(cp, 
									  WINDOW_TOKEN, 
									  sizeof(WINDOW_TOKEN)-1))
				      {
					    char *window = net_get_html_help_token(
													cp+sizeof(WINDOW_TOKEN)-1, 
													&next_word);
					    cp = next_word;
					    fgs->target = XP_STRDUP(window);
				      }
					else
					  {
						/* unknown attribute.  Skip to next whitespace
						 */ 
						while(*cp && !isspace(*cp)) 
							cp++;


						if(*cp)
						  {
							while(isspace(*cp)) cp++;
							next_word = cp;
						  }
						else
						  {
							next_word = NULL;
						  }
					  }

				  } while(next_word);
			
				XP_ListAddObject(obj->frame_group_stack, fgs);
			  }
		  }
		else if(!strncasecomp(token, 
						 END_FRAME_GROUP_TOKEN, 
						 sizeof(END_FRAME_GROUP_TOKEN)-1))
		  {
			frame_set_struct *fgs;

			fgs = XP_ListRemoveTopObject(obj->frame_group_stack);

			if(fgs)
				net_help_free_frame_group_struct(fgs);
		  }
	  }
	else if(!obj->in_id_mapping)
	  {
		if(!strncasecomp(line, 
					 	WINDOW_SIZE_TOKEN, 
					 	sizeof(WINDOW_SIZE_TOKEN)-1))
		  {
			/* get window size */
			char *comma=0;
			char *window_size = net_get_html_help_token(line+
												sizeof(WINDOW_SIZE_TOKEN)-1, 
												NULL);

			if(window_size)
				comma = XP_STRCHR(window_size, ',');

			if(comma)
			  {
				*comma =  '\0';
				obj->window_width = XP_ATOI(window_size);
				obj->window_height = XP_ATOI(comma+1);
			  }
		  }
		else if(!strncasecomp(line, 
						 	WINDOW_NAME_TOKEN, 
						 	sizeof(WINDOW_NAME_TOKEN)-1))
		  {
			char *window_name = net_get_html_help_token(line+
												sizeof(WINDOW_NAME_TOKEN)-1,
												NULL);

			if(window_name)
			  {
				FREEIF(obj->window_name);
				obj->window_name = XP_STRDUP(window_name);
			  }
		  }
		else if(!strncasecomp(line, 
					 	HELP_VERSION_TOKEN, 
					 	sizeof(HELP_VERSION_TOKEN)-1))
		  {
			/* get window size */
			char *help_version = net_get_html_help_token(line+
												sizeof(HELP_VERSION_TOKEN)-1, 
												NULL);

			if(help_version)
			  {
				obj->helpVersion = XP_ATOI(help_version);
			  }
		  }
	  }
	else
	  {
		/* id mapping pair */
		if(!strncasecomp(line, obj->id, XP_STRLEN(obj->id)))
		  {
			char *id_value = net_get_html_help_token(line+XP_STRLEN(obj->id),
													 &next_word);

			if(id_value)
			  {
			  	obj->id_value = XP_STRDUP(id_value);

				while(next_word)
				  {
					char *cp = next_word;

                    if(!strncasecomp(cp,
                                     TARGET_TOKEN,
                                      sizeof(TARGET_TOKEN)-1))
                      {
                        char *target = net_get_html_help_token(
                                                    cp+sizeof(TARGET_TOKEN)-1,
                                                    &next_word);
                        cp = next_word;
                        obj->content_target = XP_STRDUP(target);
                      }
					else
					  {
                        /* unknown attribute.  Skip to next whitespace
                         */
                        while(*cp && !isspace(*cp))
                            cp++;

                        if(*cp)
                          {
                            while(isspace(*cp)) cp++;
                            next_word = cp;
                          }
                        else
                          {
                            next_word = NULL;
                          }
					  }
				  }
			  }
		
			return(HTML_HELP_ID_FOUND);
		  }
		if(!strncasecomp(line, DEFAULT_HELP_ID, sizeof(DEFAULT_HELP_ID)-1))
		  {
			char *default_id_value = net_get_html_help_token(
												line+sizeof(DEFAULT_HELP_ID)-1,
												NULL);

            if(default_id_value)
                obj->default_id_value = XP_STRDUP(default_id_value);
		  }
		
	  }

	return(0);
}