Esempio n. 1
0
Fl_String MainMenu::get_item_name(Fl_XmlNode *node)
{
    Fl_String name;
    for(uint n=0; n<node->children(); n++) {
        Fl_XmlNode *np = node->child(n);
        if(np->is_element() && np->name()=="Name") {
            Fl_String &lang = np->get_attribute("Lang");
            if(lang=="" && name.length()==0) {
                name.clear();
                np->text(name);
            } else if(lang==locale()) {
                name.clear();
                np->text(name);
                break;
            }
        }
    }
    return name;
}
Esempio n. 2
0
// update a string member:
int storestring(const char *n, Fl_String& p, int nostrip) 
{
	if(!n) { p.clear(); return 0; }
	if(p==n) return 0;
	
	Fl_String N = n;
	if(!nostrip)	p = N.trim();
	else			p = N;

	modflag = 1;
	return 1;
}
Esempio n. 3
0
Fl_String get_localized_string()
{
    Fl_String locale = setlocale(LC_MESSAGES, NULL);
//    int pos = locale.rpos('_');
//    if(pos>0) locale.sub_delete(pos, locale.length()-pos);
    if(locale=="C" || locale=="POSIX") locale.clear();

    Fl_String localName;
    if(locale.empty()) localName = "Name";
    else localName.printf("Name[%s]", locale.c_str());

    return localName;
}
Esempio n. 4
0
void go_callback(Fl_Widget *,void *) 
{    
	header.clear();
	content_len = 0;

	p_bar->range(0,1);
	p_bar->value(0);
	p_text->label("...");

	textbuf->text("");    
	textdisp->redraw();
	
    Fl_String	host_name = input->value();
    Fl_String	page_name = "/index.html";	

	if(!strncmp(host_name, "http://", 7) || !strncmp(host_name, "HTTP://", 7)) {
		host_name.sub_delete(0, 7);
	}

    int pos = host_name.pos("/");
    if (pos > 0) {
        page_name = host_name.sub_str(pos,255);
        host_name.set_length(pos);
    }

    try {
        sock->open(host_name,80);

        char host_header[256];
        int len = sprintf(host_header,"GET %s HTTP/1.0\nHost: %s:80\n\n",page_name.c_str(),host_name.c_str());
        sock->write(host_header, len);

		// Add socket to eFLTK socket lookup list
		Fl::add_fd(sock->handle(), FL_READ, socket_cb, sock);
    }
    catch(Fl_Exception &exception) 
	{
		Fl::warning(exception.text());
		return;
	}
}