void TLSelectColourDialog::OnRemoveButtonClick(wxCommandEvent& event) { if (m_dirListBox->GetSelection()>=0) { wxColour *colour = (wxColour*)m_dirListBox->GetClientData(m_dirListBox->GetSelection()); delete colour; m_dirListBox->Delete(m_dirListBox->GetSelection()); } SetButtonStates(); }
void WidgetInfoPanel::OnRemove( wxCommandEvent& /*unused*/ ) { if ( m_widget.Remove() ) { customMessageBoxNoModal( SL_MAIN_ICON, _("Widget files have been removed."), _("Success") ); } else { customMessageBoxNoModal( SL_MAIN_ICON, _("Widget files have not been removed."), _("Error") ); } SetButtonStates(); }
void TLSelectColourDialog::OnAddButtonClick(wxCommandEvent& event) { for (int i=0; i<m_dirListBox->GetCount();i++) { if (m_dirTreeCtrl->GetPath()==m_dirListBox->GetString(i)) return; } wxColour *colour = new wxColour(*wxRED); m_dirListBox->Append(m_dirTreeCtrl->GetPath(),(void*)colour); m_dirListBox->SetSelection(m_dirListBox->GetCount()-1); SetButtonStates(); }
int SetHideOffline(WPARAM wParam, LPARAM lParam) { switch ((int) wParam) { case 0: DBWriteContactSettingByte(NULL, "CList", "HideOffline", 0); break; case 1: DBWriteContactSettingByte(NULL, "CList", "HideOffline", 1); break; case -1: DBWriteContactSettingByte(NULL, "CList", "HideOffline", (BYTE) ! DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)); break; } SetButtonStates(hwndContactList); LoadContactTree(); return 0; }
int SetHideOffline(WPARAM wParam, LPARAM lParam) { switch ((int) wParam) { case 0: cfg::writeByte("CList", "HideOffline", 0); break; case 1: cfg::writeByte("CList", "HideOffline", 1); break; case -1: cfg::writeByte("CList", "HideOffline", (BYTE) ! cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)); break; } SetButtonStates(pcli->hwndContactList); LoadContactTree(); return 0; }
int SetHideOffline(WPARAM wParam, LPARAM) { int newVal = (int)wParam; switch ((int)wParam) { case 0: cfg::writeByte("CList", "HideOffline", 0); break; case 1: cfg::writeByte("CList", "HideOffline", 1); break; case -1: newVal = !cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); cfg::writeByte("CList", "HideOffline", (BYTE)newVal); break; } SetButtonStates(); ClcSetButtonState(IDC_TBHIDEOFFLINE, newVal); LoadContactTree(); return 0; }
AnnotateDialog::AnnotateDialog(wxWindow *parent, StyleManager *manager, const StructureSet *set) : wxDialog(parent, -1, "User Annotations", wxPoint(400, 100), wxDefaultSize, wxDEFAULT_DIALOG_STYLE), styleManager(manager), structureSet(set) { // get the structure highlights present when this dialog is created GlobalMessenger()->GetHighlightedResiduesWithStructure(&highlightedResidues); // construct the panel wxSizer *topSizer = SetupAnnotationControlDialog(this, false); // fill in list boxes with available and displayed styles ResetListBoxes(); // set initial button states SetButtonStates(); // call sizer stuff topSizer->Fit(this); topSizer->SetSizeHints(this); }
TLSelectColourDialog::TLSelectColourDialog(wxWindow* parent, wxWindowID id,TLColourManager* cm, const wxString& title, const wxPoint& pos, const wxSize& size) :wxDialog(parent, -1, title, pos, size, wxDEFAULT_DIALOG_STYLE |wxRESIZE_BORDER |wxNO_FULL_REPAINT_ON_RESIZE |wxCLIP_CHILDREN ) { wxBoxSizer *MainSizer = new wxBoxSizer( wxVERTICAL ); wxStaticText *item1 = new wxStaticText( this, -1, wxT("Colours"), wxDefaultPosition, wxDefaultSize, 0,wxT("BigLabel") ); #ifdef __WXMSW__ item1->PushEventHandler(new NoBgEvtHandler());/*Windows only*/ #endif // item1->SetFont( wxFont( 20, wxDEFAULT, wxNORMAL, wxBOLD ) ); item1->SetFont( wxFont( 20, wxSWISS, wxNORMAL, wxBOLD ) ); MainSizer->Add( item1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxBoxSizer *Sizer1 = new wxBoxSizer( wxHORIZONTAL ); MainSizer->Add(Sizer1,1,wxEXPAND); wxStaticLine *sl = new wxStaticLine(this,-1); MainSizer->Add(sl,0,wxEXPAND|wxALL,5); wxBoxSizer *ButtonSizer = new wxBoxSizer( wxHORIZONTAL ); MainSizer->Add(ButtonSizer,0,wxEXPAND|wxALL,5); wxButton *button1 = new wxButton(this,wxID_CANCEL,wxT("Cancel")); wxButton *button2 = new wxButton(this,wxID_OK,wxT("Ok")); button2->SetDefault(); ButtonSizer->Add(0,0,1); #ifdef __WXMSW__ ButtonSizer->Add(button2,0,wxALIGN_RIGHT|wxRIGHT,5); ButtonSizer->Add(button1); #else ButtonSizer->Add(button1,0,wxALIGN_RIGHT|wxRIGHT,5); ButtonSizer->Add(button2); #endif m_dirTreeCtrl = new wxGenericDirCtrl(this,-1,wxDirDialogDefaultFolderStr,wxDefaultPosition,wxDefaultSize,wxDIRCTRL_DIR_ONLY|wxSUNKEN_BORDER |wxNO_FULL_REPAINT_ON_RESIZE); Sizer1->Add(m_dirTreeCtrl,1,wxEXPAND|wxALL,5); wxBoxSizer *Sizer2 = new wxBoxSizer( wxVERTICAL ); Sizer1->Add(Sizer2,1,wxEXPAND|wxRIGHT|wxTOP|wxBOTTOM,5); m_dirListBox = new wxListBox(this,ID_DirListBox,wxDefaultPosition, wxDefaultSize, 0, NULL, wxNO_FULL_REPAINT_ON_RESIZE); // lb->Append(wxT("/usr/local/")); for ( TLDirColourList::Node *node = cm->GetColours(); node; node = node->GetNext() ) { TLDirColour *current = node->GetData(); wxColour *colour = new wxColour(current->m_colour); m_dirListBox->Append(current->m_directory,(void*)colour); } Sizer2->Add(m_dirListBox,1,wxEXPAND|wxBOTTOM,5); wxBoxSizer *Sizer3 = new wxBoxSizer( wxHORIZONTAL ); Sizer2->Add(Sizer3,0,wxEXPAND|wxBOTTOM,5); m_addButton = new wxButton(this,ID_AddButton,wxT("+")); m_removeButton = new wxButton(this,ID_RemoveButton,wxT("-")); #ifdef __WXMSW__ m_addButton->PushEventHandler(new NoBgEvtHandler()); m_removeButton->PushEventHandler(new NoBgEvtHandler()); #endif Sizer3->Add(m_addButton,1,wxRIGHT,5); Sizer3->Add(m_removeButton,1); m_colourButton = new wxButton(this,ID_ColourButton,wxT("Colour")); #ifdef __WXMSW__ m_colourButton->PushEventHandler(new NoBgEvtHandler()); #endif // m_colourButton->SetBackgroundColour(*wxRED); Sizer2->Add(m_colourButton,0,wxEXPAND); SetSizer( MainSizer ); MainSizer->SetSizeHints(this); SetButtonStates(); m_dirTreeCtrl->SetFocus(); }
void TLSelectColourDialog::OnDirListClick(wxCommandEvent& event) { SetButtonStates(); }
void AnnotateDialog::OnButton(wxCommandEvent& event) { switch (event.GetId()) { case ID_B_NEW: NewAnnotation(); break; case ID_B_EDIT: EditAnnotation(); break; case ID_B_MOVE: MoveAnnotation(); break; case ID_B_DELETE: DeleteAnnotation(); break; case ID_B_SHOW: { DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(available, ID_L_AVAILABLE, wxListBox) if (available->GetSelection() >= 0) { StyleManager::UserAnnotation *annotation = ANNOT_FROM_CLIENT_DATA(available); if (annotation) { GlobalMessenger()->SetHighlights(annotation->residues); structureSet->showHideManager->ShowDomainsWithHighlights(structureSet); highlightedResidues = annotation->residues; } else ERRORMSG("AnnotateDialog::OnButton() - error highlighting annotation #" << available->GetSelection()); } break; } case ID_B_MOVE_UP: case ID_B_MOVE_DOWN: { DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(available, ID_L_AVAILABLE, wxListBox) if (available->GetSelection() >= 0) { StyleManager::UserAnnotation *annotation = ANNOT_FROM_CLIENT_DATA(available); if (annotation && styleManager-> MoveUserAnnotation(annotation, (event.GetId() == ID_B_MOVE_UP))) ResetListBoxes(); else ERRORMSG("AnnotateDialog::OnButton() - error reprioritizing annotation #" << available->GetSelection()); } break; } case ID_B_TURN_OFF: case ID_B_TURN_ON: { int listID = (event.GetId() == ID_B_TURN_OFF) ? ID_L_DISPLAYED : ID_L_AVAILABLE; DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(listBox, listID, wxListBox) if (listBox->GetSelection() >= 0) { StyleManager::UserAnnotation *annotation = ANNOT_FROM_CLIENT_DATA(listBox); if (annotation && styleManager-> DisplayUserAnnotation(annotation, (event.GetId() == ID_B_TURN_ON))) ResetListBoxes(); else ERRORMSG("AnnotateDialog::OnButton() - error toggling annotation #" << listBox->GetSelection()); } break; } case ID_B_DONE: EndModal(wxOK); break; default: event.Skip(); } SetButtonStates(); }
static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) { char *szProto = NULL; DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; if (hContact) { if ( !__strcmp(cws->szModule, "CList")) { if ( !__strcmp(cws->szSetting, "StatusMsg")) SendMessage(pcli->hwndContactTree, INTM_STATUSMSGCHANGED, hContact, lParam); } else if ( !__strcmp(cws->szModule, "UserInfo")) { if ( !__strcmp(cws->szSetting, "ANSIcodepage")) pcli->pfnClcBroadcast(INTM_CODEPAGECHANGED, hContact, lParam); else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) ReloadExtraInfo(hContact); } else if (hContact != 0 && (szProto = GetContactProto(hContact)) != NULL) { char *id = NULL; if ( !__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) { char *szProto_s; pcli->pfnClcBroadcast(INTM_PROTOCHANGED, hContact, lParam); if (cws->value.type == DBVT_DELETED) szProto_s = NULL; else szProto_s = cws->value.pszVal; pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : cfg::getWord(hContact, szProto_s, "Status", ID_STATUS_OFFLINE), hContact, NULL), 0); } // something is being written to a protocol module if ( !__strcmp(szProto, cws->szModule)) { // was a unique setting key written? pcli->pfnInvalidateDisplayNameCacheEntry(hContact); if ( !__strcmp(cws->szSetting, "Status")) { if (!cfg::getByte(hContact, "CList", "Hidden", 0)) { if (cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) { // User's state is changing, and we are hideOffline-ing if (cws->value.wVal == ID_STATUS_OFFLINE) { pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(cws->szModule, cws->value.wVal, hContact, NULL), 0); CallService(MS_CLUI_CONTACTDELETED, hContact, 0); return 0; } pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(cws->szModule, cws->value.wVal, hContact, NULL), 1); } pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(cws->szModule, cws->value.wVal, hContact, NULL), 0); } SendMessage(pcli->hwndContactTree, INTM_STATUSCHANGED, hContact, lParam); return 0; } else if (strstr("YMsg|StatusDescr|XStatusMsg", cws->szSetting)) SendMessage(pcli->hwndContactTree, INTM_STATUSMSGCHANGED, hContact, lParam); else if (strstr(cws->szSetting, "XStatus")) SendMessage(pcli->hwndContactTree, INTM_XSTATUSCHANGED, hContact, lParam); else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) ReloadExtraInfo(hContact); if (!(cfg::dat.dwFlags & CLUI_USEMETAICONS) && !__strcmp(szProto, META_PROTO)) if ((lstrlenA(cws->szSetting) > 6 && !strncmp(cws->szSetting, "Status", 6)) || strstr("Default,ForceSend,Nick", cws->szSetting)) pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, hContact, lParam); } if (cfg::dat.bMetaEnabled && !__strcmp(cws->szModule, META_PROTO) && !__strcmp(cws->szSetting, "IsSubcontact")) pcli->pfnClcBroadcast(INTM_HIDDENCHANGED, hContact, lParam); } } else if (!__strcmp(cws->szModule, META_PROTO)) { BYTE bMetaEnabled = cfg::getByte(META_PROTO, "Enabled", 1); if (bMetaEnabled != (BYTE)cfg::dat.bMetaEnabled) { cfg::dat.bMetaEnabled = bMetaEnabled; pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); } } else if (!__strcmp(cws->szModule, "Skin") && !__strcmp(cws->szSetting, "UseSound")) { cfg::dat.soundsOff = cfg::getByte(cws->szModule, cws->szSetting, 0) ? 0 : 1; ClcSetButtonState(IDC_TBSOUND, cfg::dat.soundsOff ? BST_CHECKED : BST_UNCHECKED); SetButtonStates(pcli->hwndContactList); } else if (!__strcmp(cws->szModule, "CList") && !__strcmp(cws->szSetting, "UseGroups")) { ClcSetButtonState(IDC_TBHIDEGROUPS, cfg::getByte(cws->szModule, cws->szSetting, SETTING_USEGROUPS_DEFAULT)); SetButtonStates(pcli->hwndContactList); } else if (!__strcmp(cws->szModule, "TopToolBar") && !__strcmp(cws->szSetting, "UseFlatButton")) { SetButtonToSkinned(); } else if (szProto == NULL) { if ( !__strcmp(cws->szSetting, "XStatusId")) CluiProtocolStatusChanged(0, cws->szModule); } return 0; }
void WidgetInfoPanel::Create() { wxWindowUpdateLocker locked( this ); if ( !m_widget.extendedinfo.parsed ) { m_widget.GetFileInfos(); m_widget.GetImageInfos(); m_widget.DownloadImages(); } m_widget.extendedinfo.parsed = true; m_busy_notice->DeleteWindows(); m_busy_notice->Show( false ); // m_busy_notice->Destroy(); m_main_sizer = new wxBoxSizer( wxVERTICAL ); m_left_sizer = new wxBoxSizer( wxVERTICAL ); m_left_button_sizer = new wxBoxSizer( wxHORIZONTAL ); m_grid_sizer = new wxGridSizer( 2, 5, 5 ); wxStaticText* name_lbl = new wxStaticText( this, -1, _("Name") ); m_grid_sizer->Add( name_lbl ); wxStaticText* name = new wxStaticText( this, -1, m_widget.name ); m_grid_sizer->Add( name ); wxStaticText* author_lbl = new wxStaticText( this, -1, _("Author") ); m_grid_sizer->Add( author_lbl ); wxStaticText* author = new wxStaticText( this, -1, m_widget.author ); m_grid_sizer->Add( author ); wxStaticText* mods_lbl = new wxStaticText( this, -1, _("Suitable games") ); m_grid_sizer->Add( mods_lbl ); wxStaticText* mods = new wxStaticText( this, -1, m_widget.mods ); m_grid_sizer->Add( mods ); wxStaticText* rev_lbl = new wxStaticText( this, -1, _("Current version") ); m_grid_sizer->Add( rev_lbl ); wxStaticText* rev = new wxStaticText( this, -1, m_widget.rev ); m_grid_sizer->Add( rev ); wxStaticText* dl_lbl = new wxStaticText( this, -1, _("# downloaded") ); m_grid_sizer->Add( dl_lbl ); wxStaticText* dl = new wxStaticText( this, -1, TowxString( m_widget.num_downloads ) ); m_grid_sizer->Add( dl ); wxStaticText* publ_lbl = new wxStaticText( this, -1, _("Published on") ); m_grid_sizer->Add( publ_lbl ); wxStaticText* publ = new wxStaticText( this, -1, m_widget.date ); m_grid_sizer->Add( publ ); m_left_sizer->Add( m_grid_sizer, 0, wxEXPAND | wxALL, 5 ); m_download = new wxButton( this, BUT_DOWNLOAD, _("Download") ); // m_update = new wxButton( this, BUT_UPDATE, _("Update") ); m_remove = new wxButton( this, BUT_REMOVE, _("Remove") ); const int flag = wxALL; const int spc = 5; m_left_button_sizer->Add( m_download, 0, flag, spc ); // m_button_sizer->Add( m_update, 0, flag, spc ); m_left_button_sizer->Add( m_remove, 0, flag, spc ); m_left_sizer->Add( m_left_button_sizer, 0, wxALL, 0 ); m_right_sizer = new wxBoxSizer ( wxVERTICAL ); m_desc = new slHtmlWindow( this, CTL_DESC, wxDefaultPosition, wxDefaultSize, wxHW_NO_SELECTION|wxHW_SCROLLBAR_AUTO ); wxString ct = _T("<html><body>") + m_widget.description + _T("</body></html>") ;//content m_desc->SetPage( ct ); m_changelog = new wxTextCtrl( this, -1, _T( "" ), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY ); wxStringTokenizer tk( m_widget.changelog, _T("\r\n") ); while ( tk.HasMoreTokens() ) m_changelog->AppendText( tk.GetNextToken() ); m_ext_info = new SLNotebook( this, _T("m_ext_info"), -1, wxDefaultPosition, wxDefaultSize, wxAUI_NB_LEFT ); m_ext_info->SetArtProvider(new SLArtProvider); m_ext_info->AddPage( m_desc, _("Description") , true ); m_ext_info->AddPage( m_changelog, _("Changelog") , false ); if ( m_widget.GetImageFilenames().GetCount() > 0 ) { m_imageviewer = new ImageViewerPanel( m_widget.GetImageFilenames(), false, this, -1, 0); m_ext_info->AddPage( m_imageviewer, _("Screenshots") , false ); } m_right_sizer->Add( m_ext_info, 1, wxEXPAND, 5 ); wxStaticBoxSizer* top_box = new wxStaticBoxSizer ( wxVERTICAL, this ); top_box->Add( m_left_sizer ); m_main_sizer->Add( top_box, 0, wxLEFT | wxEXPAND, 5 ); m_main_sizer->Add( new wxStaticLine( this ), 0, wxEXPAND ); m_main_sizer->Add( m_right_sizer, 1, wxLEFT|wxEXPAND, 5 ); SetButtonStates(); SetSizer( m_main_sizer ); Layout(); }
void SlaveDlg::WMCommand(int id, int notify, HWND hCtrl) { switch (id) { case IDC_LIST_NAME: { int sel = SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_GETCURSEL,0,0); if (sel!=LB_ERR) { if ((cont->blockID.Count() == 0) || (cont->subID.Count()==0)) { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),FALSE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),FALSE); } else { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),TRUE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),TRUE); } } break; } case IDC_LIST1: if (notify==LBN_SELCHANGE) { SetButtonStates(); } break; case IDC_LINK: { if (!cont->masterPresent) { MasterTrackViewFilter filter; TrackViewPick res; BOOL MasterOK = GetCOREInterface()->TrackViewPickDlg(hWnd,&res,&filter); if (MasterOK && (res.anim != NULL)) { cont->ReplaceReference(1,res.anim,FALSE); cont->propBlockID = -1; cont->propSubID = -1; int OK = DialogBoxParam (hInstance, MAKEINTRESOURCE(IDD_ADDNEWLINK), hWnd, NewLinkDlgProc, (LPARAM)cont); if ((OK) && (cont->propSubID != -1) && (cont->propSubID != -1)) { cont->AddControl(cont->propBlockID,cont->propSubID); SetupList(); } } int sel = SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_GETCURSEL,0,0); if ((cont->blockID.Count() == 0) || (cont->subID.Count()==0)) { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),FALSE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),FALSE); } else { if (sel!=LB_ERR) { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),TRUE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),TRUE); } } } else { int OK = DialogBoxParam (hInstance, MAKEINTRESOURCE(IDD_ADDNEWLINK), hWnd, NewLinkDlgProc, (LPARAM)cont); if ( (OK) && (cont->propSubID != -1) && (cont->propSubID != -1)) { cont->AddControl(cont->propBlockID,cont->propSubID); SetupList(); } } Change(TRUE); break; } case IDC_REMOVE: { int sel = SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_GETCURSEL,0,0); cont->RemoveControl(sel); SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_DELETESTRING,sel,0); SetupList(); sel = SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_GETCURSEL,0,0); if ((cont->blockID.Count() == 0) || (cont->subID.Count()==0)) { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),FALSE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),FALSE); } else { if (sel!=LB_ERR) { EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),TRUE); EnableWindow(GetDlgItem(hWnd,IDC_COLLAPSE),TRUE); } } Change(TRUE); break; } case IDC_COLLAPSE: { SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_GETCURSEL,0,0); cont->CollapseControl(); EndDialog(hWnd,1); break; } case IDOK: EndDialog(hWnd,1); break; case IDCANCEL: EndDialog(hWnd,0); break; } }