CharsetDlg1(NCDialogParent *parent, int curCharset) : NCDialog(createDialogAsChild, 0, parent, utf8_to_unicode( _LT("Charset") ).ptr(), bListOkCancel), layout(10,10), list(this, 7), otherButton(0, this, utf8_to_unicode( _LT("Other...") ).ptr(), CMD_OTHER), addButton(0, this, utf8_to_unicode( carray_cat<char>(_LT("Add..."), "(Ins)").ptr() ).ptr(), CMD_ADD), delButton(0, this, utf8_to_unicode( carray_cat<char>(_LT("Del..."), "(Del)").ptr() ).ptr(), CMD_DEL) { int i; InitOperCharsets(); list.SetList(::csList.ptr(), ::csList.count()); list.MoveFirst(0); for (int i = 0; i < ::csList.count(); i++) if (::csList[i]->id == curCharset) { list.MoveCurrent(i); break; } /* LO L LA LD */ layout.AddWin(&list,0,0,3,0); list.Enable(); list.Show(); list.SetFocus(); layout.AddWin(&otherButton,0,1); otherButton.Enable(); otherButton.Show(); layout.AddWin(&addButton,2,1); addButton.Enable(); addButton.Show(); layout.AddWin(&delButton,3,1); delButton.Enable(); delButton.Show(); int mx = 0, my = 0; LSize ls; otherButton.GetLSize(&ls); if (mx < ls.x.maximal) mx = ls.x.maximal; if (my < ls.y.maximal) my = ls.y.maximal; addButton.GetLSize(&ls); if (mx < ls.x.maximal) mx = ls.x.maximal; if (my < ls.y.maximal) my = ls.y.maximal; delButton.GetLSize(&ls); if (mx < ls.x.maximal) mx = ls.x.maximal; if (my < ls.y.maximal) my = ls.y.maximal; ls.x.minimal = ls.x.maximal = mx; ls.y.minimal = ls.y.maximal = my; otherButton.SetLSize(ls); addButton.SetLSize(ls); delButton.SetLSize(ls); layout.SetLineGrowth(1); AddLayout(&layout); SetEnterCmd(CMD_OK); SetPosition(); };
clFileAssociationsWin( NCDialogParent* parent, std::vector<clNCFileAssociation>* Associations ) : NCDialog( ::createDialogAsChild, 0, parent, utf8_to_unicode( _LT( "File associations" ) ).data(), bListOkCancel ) , m_ListWin( this, Associations ) , m_Layout( 10, 10 ) , m_AddCurrentButton( 0, this, utf8_to_unicode( "+ (&Ins)" ).data(), CMD_PLUS ) , m_DelButton( 0, this, utf8_to_unicode( "- (&Del)" ).data(), CMD_MINUS ) , m_EditButton( 0, this, utf8_to_unicode( _LT( "&Edit" ) ).data(), CMD_EDIT ) , m_Saved( true ) { m_AddCurrentButton.Enable(); m_AddCurrentButton.Show(); m_DelButton.Enable(); m_DelButton.Show(); m_EditButton.Enable(); m_EditButton.Show(); LSize lsize = m_AddCurrentButton.GetLSize(); LSize lsize2 = m_DelButton.GetLSize(); LSize lsize3 = m_EditButton.GetLSize(); if ( lsize.x.minimal < lsize2.x.minimal ) { lsize.x.minimal = lsize2.x.minimal; } if ( lsize.x.minimal < lsize3.x.minimal ) { lsize.x.minimal = lsize3.x.minimal; } if ( lsize.x.maximal < lsize.x.minimal ) { lsize.x.maximal = lsize.x.minimal; } m_AddCurrentButton.SetLSize( lsize ); m_DelButton.SetLSize( lsize ); m_EditButton.SetLSize( lsize ); m_Layout.AddWinAndEnable( &m_ListWin, 0, 0, 9, 0 ); m_Layout.AddWin( &m_AddCurrentButton, 0, 1 ); m_Layout.AddWin( &m_DelButton, 1, 1 ); m_Layout.AddWin( &m_EditButton, 2, 1 ); m_Layout.SetLineGrowth( 9 ); this->AddLayout( &m_Layout ); SetPosition(); m_ListWin.SetFocus(); this->SetEnterCmd( CMD_OK ); }
void MyDialog::HandleEvent(Widget &obj, int msg, intptr_t arg1, intptr_t arg2) { Dialog::HandleEvent(obj, msg, arg1, arg2); switch (msg) { case MSG_ACTIVATE: if (obj == buttonPlay) { buttonPlay.Disable(); MoveFocusTo(&map); map.Play((int)eLevel.GetPosition()); eLevel.Disable(); Settings::showMouse = false; } else if (obj == bScores) { ShowScores(); } break; case MSG_GAMEOVER: { Settings::showMouse = true; if (hsc->CanAdd(eScore.GetInt())) { GetHiscoreName(); ShowScores(); } else { //TODO #if 0 MessageBox dlg("Message", "Game over! You lose!", NULL, NULL, "OK", NULL, NULL); dlg.Popup(this); #endif } buttonPlay.Enable(); eLevel.Enable(); nextPiece.piece = NULL; } break; case MSG_UPDATESCORE: { eLines.SetNumber((int)arg1); eScore.SetNumber((int)arg2); } break; case MSG_INCREASELEVEL: { eLevel.Increment(); } break; case MSG_NEWPIECE: { nextPiece.piece = map.GetNextPiece(); } break; }; }