LRESULT CEnvelopeWizard::OnClickedPrev(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { if (m_nSelectedView > 1) { m_nSelectedView--; ShowSelectedView(m_nSelectedView); if (m_nSelectedView == ENVELOPE_SIZE) m_pEnvelopeSize->SelectBackground(); if (m_nSelectedView == 1) ::EnableWindow(GetDlgItem(ID_PREV_VIEW), false); else { ::EnableWindow(GetDlgItem(ID_PREV_VIEW), true); ::EnableWindow(GetDlgItem(ID_NEXT_VIEW), true); } } return S_OK; }
LRESULT CEnvelopeWizard::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { // Create all of the views and then show the selected view m_pEnvelopeSize = new CEnvelopeWizSize(this); m_pEnvelopePicture = new CEnvelopeWizPicture(this); m_pEnvelopeAddress = new CEnvelopeWizAddress(this); m_pEnvelopeFinal = new CEnvelopeWizFinal(this); if (m_pEnvelopeSize) m_pEnvelopeSize->Create(m_hWnd); if (m_pEnvelopePicture) m_pEnvelopePicture->Create(m_hWnd); if (m_pEnvelopeAddress) m_pEnvelopeAddress->Create(m_hWnd); if (m_pEnvelopeFinal) m_pEnvelopeFinal->Create(m_hWnd); ShowSelectedView(m_nSelectedView); ::EnableWindow(GetDlgItem(ID_PREV_VIEW), false); return true; // Let the system set the focus }
void TargetSettingsWin::MessageReceived(BMessage *Message) { //questi messaggi devono aggiornare l'oggetto 'TargetConfig' switch (Message->what) { case PANEL_LIST_ITEM_SELECTED: { DPRINT("TargetSettingsWin::MessageReceived: PANEL_LIST_ITEM_SELECTED"); int32 index; status_t err = Message->FindInt32("index", &index); if (err == B_OK) { ShowSelectedView(index); } break; } case OK_BUTTON_PRESSED: DPRINT("TargetSettingsWin::MessageReceived: OK_BUTTON_PRESSED"); if (AreCompulsorySet()) { SaveChangedSettings(); fConfig->PrintToStream(); Quit(); } else { //show a dialog for the user to inform that name and type must be specified BAlert* alert = new BAlert("specify name and type alert", "You must specify one name and one type for this target.", "Ok", NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_INFO_ALERT); alert->SetShortcut(0, B_ESCAPE); /* int32 button_index = */ alert->Go(); } break; case CANCEL_BUTTON_PRESSED: DPRINT("TargetSettingsWin::MessageReceived: CANCEL_BUTTON_PRESSED"); //close this window Quit(); break; case GENERAL_SETTINGS_CHANGED: DPRINT("TargetSettingsWin::MessageReceived: GENERAL_SETTINGS_CHANGED"); //fChangedConfig = true; fGeneralSettingsChanged = true; break; case COMPILER_SETTINGS_CHANGED: DPRINT("TargetSettingsWin::MessageReceived: COMPILER_SETTINGS_CHANGED"); fCompilerSettingsChanged = true; break; case INCLUDE_SETTINGS_CHANGED: DPRINT("TargetSettingsWin::MessageReceived: INCLUDE_SETTINGS_CHANGED"); fIncludeSettingsChanged = true; break; case LINKER_SETTINGS_CHANGED: DPRINT("TargetSettingsWin::MessageReceived: LINKER_SETTINGS_CHANGED"); fLinkerSettingsChanged = true; break; case LINKER_SETTINGS_ADD_BUTTON: case LINKER_SETTINGS_REMOVE_BUTTON: //XXX - to be removed only for testing //---> is it possible for the view to manage directly these messages? DPRINT("TargetSettingsWin::MessageReceived: LINKER_SETTINGS_{ADD,REMOVE}_BUTTON"); fLinkerSettingsView->MessageReceived(Message); break; default: DPRINT("TargetSettingsWin::MessageReceived: other message"); BWindow::MessageReceived(Message); break; } //switch }