⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ui.cxx

📁 PIXIL is a small footprint operating environment, complete with PDA PIM applications, a browser and
💻 CXX
📖 第 1 页 / 共 2 页
字号:
    // Make a NxPimWindow    editorWindow = new NxPimWindow(APP, editorMenuItems,				   0, "", "",				   (void (*)(const char *)) MainSetCategory);    add_window((Fl_Window *) editorWindow->GetWindowPtr());    int y = 30;    // To Line    i_To = new NxInput(53, y, W_W - 55, 20, "To:");#ifdef PDA    i_To->box(FL_BOTTOM_BOX);#endif    NxApp::Instance()->def_font(i_To);    i_To->align(FL_ALIGN_LEFT);    i_To->callback(NxApp::Instance()->pasteTarget_callback);    editorWindow->add((Fl_Widget *) i_To);    // Carbon Copy    i_CC = new NxInput(53, y += 22, W_W - 55, 20, "CC:");    NxApp::Instance()->def_font(i_CC);    i_CC->align(FL_ALIGN_LEFT);    i_CC->callback(NxApp::Instance()->pasteTarget_callback);    editorWindow->add((Fl_Widget *) i_CC);    // Subject Line    i_Subject = new NxInput(53, y += 22, W_W - 55, 20, "Subject:");    NxApp::Instance()->def_font(i_Subject);    i_Subject->align(FL_ALIGN_LEFT);    i_Subject->callback(NxApp::Instance()->pasteTarget_callback);    editorWindow->add((Fl_Widget *) i_Subject);    // The Email message    i_Message = new NxMultilineInput(2, y += 30, W_W - 4, (W_W - y - 30));    editorWindow->add((Fl_Widget *) i_Message);    // Buttons    {	NxButton *o =	    new NxButton(BUTTON_X, BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT,			 "Send");	o->callback((Fl_Callback *) EditorSendCB);	NxApp::Instance()->def_font((Fl_Widget *) o);	editorWindow->add((Fl_Widget *) o);    }    {	NxButton *o =	    new NxButton(BUTTON_X + 63, BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT,			 "Cancel");	o->callback((Fl_Callback *) EditorCancelCB);	editorWindow->add((Fl_Widget *) o);    }}voidNxMail::MakeSettingsWindow(){    // Make a NxPimWindow    settingsWindow = new NxPimWindow(APP, settingsMenuItems,				     0, "", "", (void (*)(const char *))				     MainSetCategory);    add_window((Fl_Window *) settingsWindow->GetWindowPtr());    ////////////////////////////////////////    // Init local variables    int x = BUTTON_X + 100;    int y = 0;    accountArray = 0;    accountCount = 0;    m_Accounts = new NxMenuButton(CL_X, CL_Y, CL_W, CL_H, "");    m_Accounts->callback(SettingsAccountCB);    settingsWindow->add((Fl_Widget *) m_Accounts);    // Server name    i_Server = new NxInput(x, y += 25, 100, 20, "Server:              ");    settingsWindow->add((Fl_Widget *) i_Server);    // Port#ifdef NOTUSED    i_Port = new NxInput(x, y += 25, 50, 20, "Port:                     ");    settingsWindow->add((Fl_Widget *) i_Port);#endif    // Make a new radio button group    g_Radio = new Fl_Group(x, y += 25, 100, 20, "");    g_Radio->box(FL_FLAT_BOX);    g_Radio->color(NxApp::Instance()->getGlobalColor(APP_BG));    NxButton *b_IMAP = new NxButton(140, y, 10, 10, "IMAP");    b_IMAP->type(102);    b_IMAP->align(FL_ALIGN_RIGHT);    b_IMAP->deactivate();    NxButton *b_POP3 = new NxButton(x, y, 10, 10, "POP3");    b_POP3->type(102);    b_POP3->align(FL_ALIGN_RIGHT);    b_POP3->setonly();    g_Radio->end();    g_Radio->hide();    settingsWindow->add((Fl_Widget *) g_Radio);    // User information    i_Name = new NxInput(x, y += 25, 100, 20, "Username:         ");    settingsWindow->add((Fl_Widget *) i_Name);    i_Pass = new NxSecretInput(x, y += 25, 100, 20, "Password:          ");    settingsWindow->add((Fl_Widget *) i_Pass);    i_SMTPServer = new NxInput(x, y += 25, 100, 20, "SMTP Server:     ");    settingsWindow->add((Fl_Widget *) i_SMTPServer);    i_SMTPName = new NxInput(x, y += 25, 100, 20, "SMTP Username:");    settingsWindow->add((Fl_Widget *) i_SMTPName);    {	NxButton *o =	    new NxButton(BUTTON_X, BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT,			 "Save");	o->callback((Fl_Callback *) SettingsSaveCB);	NxApp::Instance()->def_font((Fl_Widget *) o);	settingsWindow->add((Fl_Widget *) o);    }    {	NxButton *o =	    new NxButton(BUTTON_X + 63, BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT,			 "Cancel");	o->callback((Fl_Callback *) SettingsCancelCB);	NxApp::Instance()->def_font((Fl_Widget *) o);	settingsWindow->add((Fl_Widget *) o);    }}voidNxMail::MakeViewWindow(){    // Make a NxPimWindow    viewWindow = new NxPimWindow(APP, viewMenuItems,				 0, "", "",				 (void (*)(const char *)) MainSetCategory);    add_window((Fl_Window *) viewWindow->GetWindowPtr());    NxScroll *scroll = new NxScroll(1, 30, W_W - 1, (W_H - 100));    m_View = new NxMultilineOutput(1, 30, W_W - 13, W_H + 2048);    //m_View->set_wrap(1);    scroll->end();    scroll->scrollbar.size(12, W_H - 22 - 79);    scroll->hscrollbar.size(W_W - 1, 12);    viewWindow->add((Fl_Widget *) scroll);    m_Mime = new NxBrowser(1, W_H - 65, W_W - 2, 32);    m_Mime->type(FL_HOLD_BROWSER);    viewWindow->add((Fl_Widget *) m_Mime);    {	NxButton *o =	    new NxButton(BUTTON_X, BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT,			 "Save");	o->callback((Fl_Callback *) ViewerSaveMsgCB);	viewWindow->add((Fl_Widget *) o);    }    {	NxButton *o =	    new NxButton(BUTTON_X + 63, BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT,			 "Delete");	o->box(FL_SHADOW_BOX);	o->callback((Fl_Callback *) ViewerCloseCB);	viewWindow->add((Fl_Widget *) o);    }}////////////////////////////////////////////////////////////////////////////////// mainWindow messagesvoidNxMail::MainCloseCB(Fl_Widget * fl, void *o){    //  CloseNanoMail(0);}voidNxMail::MainSetCategory(char *szCat){}voidNxMail::MainSetStatus(const char *status){    l_Status->value(status);    l_Status->redraw();}////////////////////////////////////////////////////////////////////////////////// viewerWindow messagesvoidNxMail::ViewerAccountCB(Fl_Widget * fl, void *o){    NxMail *inst = NxMail::Inst();    inst->current_account = ((Fl_Menu_Button *) fl)->value();    printf("Now using the [%s] account!\n",	   inst->settings->get_account_name(inst->current_account));    inst->engine->reset_engine(inst->settings->			       get_value(inst->settings->					 get_account_name(inst->							  current_account),					 "server"),			       atoi(inst->settings->				    get_value(inst->settings->					      get_account_name(inst->							       current_account),					      "port")), MAIL_POP3);    ((Fl_Menu_Button *) fl)->label(inst->settings->				   get_account_name(inst->current_account));    ((Fl_Menu_Button *) fl)->redraw();}// We're doing it this way why?// 1. Keep the email engine callbacks seperate// 2. Further expansion of the email client (don't edit the email engine callbacks)voidNxMail::ViewerReplyMsgCB(Fl_Widget * fl, void *o){    reply_message_callback(REPLY_SINGLE);}voidNxMail::ViewerReplyAllMsgCB(Fl_Widget * fl, void *o){    reply_message_callback(REPLY_ALL);}voidNxMail::ViewerReplyFwdMsgCB(Fl_Widget * fl, void *o){    reply_message_callback(REPLY_FORWARD);}voidNxMail::ViewerDeleteMsgCB(Fl_Widget * fl, void *o){    delete_message_callback();}voidNxMail::ViewerSaveMsgCB(Fl_Widget * fl, void *o){    save_message_callback();}voidNxMail::ViewerViewMsgCB(Fl_Widget * fl, void *o){    view_message_callback();}voidNxMail::ViewerCloseCB(Fl_Widget * fl, void *o){    delete_message_callback();}//////////////////////////////////////////////////////////////////////////////// // editorWindow messagesvoidNxMail::EditorSendCB(Fl_Widget * fl, void *o){    NxMail *inst = NxMail::Inst();    send_message_callback();    inst->EditorClearFields();    inst->editorWindow->GetWindowPtr()->hide();}voidNxMail::EditorCancelCB(Fl_Widget * fl, void *o){    NxMail *inst = NxMail::Inst();    inst->EditorClearFields();    inst->MainShowWindow();}voidNxMail::EditorClearFields(void){    i_To->value("");    i_CC->value("");    i_Subject->value("");    i_Message->value("");}voidNxMail::EditorSetFields(char *to, char *cc, char *subject){    i_To->value(to);    i_CC->value(cc);    i_Subject->value(subject);    i_Message->value("");}voidNxMail::EditorIndentText(char *ptr){    i_Message->insert("> ");    i_Message->insert(ptr);    i_Message->insert("\n");}////////////////////////////////////////////////////////////////////////////////// settingsWindow messagesvoidNxMail::SettingsSaveCB(Fl_Widget * fl, void *o){    NxMail *inst = NxMail::Inst();    int changed = 0;    // Make sure that we have the most recent values for the current one    inst->SettingsUpdateValues(inst->current_account);    changed = inst->settings->confirm_all_changes();    if (changed) {	printf("The mail settings have changed!\n");	inst->settings->save_settings();	inst->engine->reset_engine(inst->settings->				   get_value(inst->settings->					     get_account_name(inst->							      current_account),					     "server"),				   atoi(inst->settings->					get_value(inst->settings->						  get_account_name(inst->								   current_account),						  "port")), MAIL_POP3);    }    inst->MainShowWindow();}voidNxMail::SettingsCancelCB(Fl_Widget * fl, void *o){    NxMail *inst = NxMail::Inst();    inst->settings->reject_all_changes();    inst->MainShowWindow();}voidNxMail::SettingsAccountCB(Fl_Widget * fl, void *o){    NxMail *inst = NxMail::Inst();    // Update the current values for the given account    inst->SettingsUpdateValues(inst->current_account);    inst->current_account = ((Fl_Menu_Button *) fl)->value();    // Now update the fields for the new accont    inst->SettingsUpdateFields();}voidNxMail::SettingsUpdateFields(){    int a;    int acount = settings->get_account_count();    /* Set the accounts */    if (acount != accountCount) {	/* Reallocate the array of menu items */	if (accountArray)	    free(accountArray);	accountArray =	    (Fl_Menu_Item *) calloc((acount + 1) * sizeof(Fl_Menu_Item), 1);	accountCount = acount;    }    for (a = 0; a < acount; a++) {	accountArray[a].label(settings->get_account_name(a));	accountArray[a].shortcut(0);    }    accountArray[acount].label(0);    m_Accounts->menu(accountArray);    m_Accounts->label(settings->get_account_name(current_account));    m_Accounts->redraw();    // Set the accounts    i_Server->value(settings->		    get_value(settings->get_account_name(current_account),			      "server"));#ifdef NOTUSED    i_Port->value(settings->		  get_value(settings->get_account_name(current_account),			    "port"));#endif    // b_POP3->set();    i_Name->value(settings->		  get_value(settings->get_account_name(current_account),			    "username"));    i_Pass->value(settings->		  get_value(settings->get_account_name(current_account),			    "password"));    i_SMTPServer->value(settings->			get_value(settings->get_account_name(current_account),				  "smtpserver"));    i_SMTPName->value(settings->		      get_value(settings->get_account_name(current_account),				"smtpname"));}voidNxMail::SettingsUpdateValues(int account){    // Save the settings    printf("Recording temp values for %s\n",	   settings->get_account_name(account));    settings->set_temp_value(settings->get_account_name(account),			     "server", i_Server->value());    settings->set_temp_value(settings->get_account_name(account),			     "username", i_Name->value());    settings->set_temp_value(settings->get_account_name(account),			     "password", i_Pass->value());    settings->set_temp_value(settings->get_account_name(account),			     "smtpserver", i_SMTPServer->value());    settings->set_temp_value(settings->get_account_name(account),			     "smtpname", i_SMTPName->value());}////////////////////////////////////////////////////////////////////////////////// Category list callbacksvoidNxMail::ChangeCatCB(Fl_Widget * fl, void *o){    char *p_String = (char *) o;    char RealCat[TEXT];    memset(RealCat, 0, sizeof(RealCat));    if (!p_String[0])	strcpy(RealCat, "All");    else	strcpy(RealCat, p_String);#ifdef NOTUSED    main_category->label(RealCat);    main_category->hide();    main_category->show();    editor_category->label(RealCat);    editor_category->hide();    editor_category->show();    view_category->label(RealCat);    view_category->hide();    view_category->show();#endif}voidNxMail::ChangeAcctCB(Fl_Widget * fl, void *o){}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -