mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-17 18:12:01 +01:00
first cut at game setup dialog
This commit is contained in:
parent
290ff76587
commit
f53ccf7580
4 changed files with 295 additions and 14 deletions
|
@ -274,29 +274,145 @@ RESOURCE DIALOG r_xwords_info_only
|
|||
|
||||
*/
|
||||
|
||||
RESOURCE ARRAY r_xwords_newgame_page1
|
||||
RESOURCE ARRAY r_conn_roles
|
||||
{
|
||||
items = {
|
||||
LBUF { txt = "Standalone"; }
|
||||
,LBUF { txt = "Host"; }
|
||||
,LBUF { txt = "Guest"; }
|
||||
};
|
||||
}
|
||||
|
||||
RESOURCE ARRAY r_conn_types
|
||||
{
|
||||
items = {
|
||||
LBUF { txt = "Bluetooth"; }
|
||||
,LBUF { txt = "IR"; }
|
||||
,LBUF { txt = "Cellular internet"; }
|
||||
};
|
||||
}
|
||||
|
||||
RESOURCE ARRAY r_xwords_newgame_page_conn
|
||||
{
|
||||
items =
|
||||
{
|
||||
DLG_LINE
|
||||
{
|
||||
control = EDWIN { width = 100; maxlength = 1000; };
|
||||
type = EEikCtEdwin;
|
||||
id = EAskContents;
|
||||
prompt = "Role";
|
||||
type = EEikCtChoiceList;
|
||||
control = CHOICELIST { array_id = r_conn_roles; };
|
||||
id = EConnectionRole;
|
||||
// itemflags =
|
||||
},
|
||||
DLG_LINE
|
||||
{
|
||||
prompt = "Connect via";
|
||||
type = EEikCtChoiceList;
|
||||
control = CHOICELIST { array_id = r_conn_types; };
|
||||
id = EConnectionType;
|
||||
// itemflags =
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
RESOURCE ARRAY r_xwords_newgame_page2
|
||||
RESOURCE ARRAY r_player_species
|
||||
{
|
||||
items =
|
||||
{
|
||||
DLG_LINE
|
||||
{
|
||||
control = EDWIN { width = 100; maxlength = 1000; };
|
||||
type = EEikCtEdwin;
|
||||
id = EAskContents;
|
||||
items = {
|
||||
LBUF { txt = "Human"; }
|
||||
,LBUF { txt = "Robot"; }
|
||||
};
|
||||
}
|
||||
|
||||
RESOURCE ARRAY r_location_choices
|
||||
{
|
||||
items = {
|
||||
LBUF { txt = "Local"; }
|
||||
,LBUF { txt = "Remote"; }
|
||||
,LBUF { txt = "Dead"; }
|
||||
};
|
||||
}
|
||||
|
||||
#define PLAYER(p_id,p_loc,p_nam,p_spec,p_pswd) \
|
||||
RESOURCE ARRAY p_id \
|
||||
{ \
|
||||
items = \
|
||||
{ \
|
||||
DLG_LINE \
|
||||
{ \
|
||||
prompt = "Location"; \
|
||||
type = EEikCtChoiceList; \
|
||||
control = CHOICELIST { array_id = r_location_choices; }; \
|
||||
id = p_loc; \
|
||||
} \
|
||||
,DLG_LINE \
|
||||
{ \
|
||||
prompt = "Name"; \
|
||||
control = EDWIN { width = 20; maxlength = 32; }; \
|
||||
type = EEikCtEdwin; \
|
||||
id = p_nam; \
|
||||
} ,DLG_LINE { \
|
||||
prompt = "Species"; \
|
||||
type = EEikCtChoiceList; \
|
||||
control = CHOICELIST { array_id = r_player_species; }; \
|
||||
id = p_spec; \
|
||||
} ,DLG_LINE { \
|
||||
type = EEikCtSecretEd; \
|
||||
prompt = "Password"; \
|
||||
id = p_pswd; \
|
||||
control = SECRETED { num_letters = 5; }; \
|
||||
} \
|
||||
}; \
|
||||
}
|
||||
|
||||
PLAYER( r_xwords_newgame_page_player1,
|
||||
EPlayerLocationChoice1,
|
||||
EPlayerName1,
|
||||
EPlayerSpeciesChoice1,
|
||||
EDecryptPassword1 )
|
||||
PLAYER( r_xwords_newgame_page_player2,
|
||||
EPlayerLocationChoice2,
|
||||
EPlayerName2,
|
||||
EPlayerSpeciesChoice2,
|
||||
EDecryptPassword2 )
|
||||
PLAYER( r_xwords_newgame_page_player3,
|
||||
EPlayerLocationChoice3,
|
||||
EPlayerName3,
|
||||
EPlayerSpeciesChoice3,
|
||||
EDecryptPassword3 )
|
||||
PLAYER( r_xwords_newgame_page_player4,
|
||||
EPlayerLocationChoice4,
|
||||
EPlayerName4,
|
||||
EPlayerSpeciesChoice4,
|
||||
EDecryptPassword4 )
|
||||
|
||||
#ifdef SERIES_60
|
||||
RESOURCE DLG_BUTTONS r_dict_browse_button
|
||||
{
|
||||
buttons = {
|
||||
DLG_BUTTON
|
||||
{
|
||||
id = EDictBrowseButton;
|
||||
button = CMBUT { txt = "Browse"; };
|
||||
hotkey = "B";
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
RESOURCE ARRAY r_xwords_newgame_page_dict
|
||||
{
|
||||
items = {
|
||||
DLG_LINE {
|
||||
prompt = "Selected dictionary";
|
||||
control = EDWIN { width = 32; maxlength = 32; };
|
||||
type = EEikCtEdwin;
|
||||
id = ESelDictName;
|
||||
}
|
||||
#ifdef SERIES_60
|
||||
,DLG_LINE {
|
||||
buttons = r_dict_browse_button;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -304,14 +420,18 @@ RESOURCE ARRAY r_xwords_newgame_pages
|
|||
{
|
||||
items =
|
||||
{
|
||||
PAGE{ text="page1"; id=EPage1; lines=r_xwords_newgame_page1;},
|
||||
PAGE{ text="page2"; id=EPage2; lines=r_xwords_newgame_page2;}
|
||||
PAGE{ text="Connection"; id=EPage1; lines=r_xwords_newgame_page_conn;}
|
||||
,PAGE{ text="Player 1"; id=EPage2; lines=r_xwords_newgame_page_player1;}
|
||||
,PAGE{ text="Player 2"; id=EPage2; lines=r_xwords_newgame_page_player2;}
|
||||
,PAGE{ text="Player 3"; id=EPage2; lines=r_xwords_newgame_page_player3;}
|
||||
,PAGE{ text="Player 4"; id=EPage2; lines=r_xwords_newgame_page_player4;}
|
||||
,PAGE{ text="Dictionary"; id=EPage2; lines=r_xwords_newgame_page_dict;}
|
||||
};
|
||||
}
|
||||
|
||||
RESOURCE DIALOG r_xwords_newgame_dlg
|
||||
{
|
||||
title = "Game info";
|
||||
title = "Game setup";
|
||||
#if defined SERIES_80
|
||||
buttons = R_EIK_BUTTONS_CANCEL_OK;
|
||||
#endif
|
||||
|
|
46
xwords4/symbian/inc/symgamdl.h
Normal file
46
xwords4/symbian/inc/symgamdl.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */
|
||||
/*
|
||||
* Copyright 2005 by Eric House (fixin@peak.org). All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _SYMGAMDL_H_
|
||||
#define _SYMGAMDL_H_
|
||||
|
||||
extern "C" {
|
||||
#include "comtypes.h"
|
||||
#include "xwstream.h"
|
||||
#include "mempool.h"
|
||||
}
|
||||
|
||||
#include <e32base.h>
|
||||
#include <eikdialg.h>
|
||||
|
||||
class CXWGameInfoDlg : public CEikDialog
|
||||
{
|
||||
public:
|
||||
CXWGameInfoDlg( MPFORMAL_NOCOMMA );
|
||||
~CXWGameInfoDlg();
|
||||
|
||||
private:
|
||||
void PreLayoutDynInitL();
|
||||
void HandleControlStateChangeL( TInt aControlId );
|
||||
TBool OkToExitL( TInt aKeyCode );
|
||||
|
||||
MPSLOT
|
||||
};
|
||||
|
||||
#endif
|
|
@ -52,8 +52,35 @@ enum TXWordsIds {
|
|||
|
||||
,EAskContents /* edit control in generic ask dlg */
|
||||
|
||||
,EPlayerLocationChoice1
|
||||
,EPlayerLocationChoice2
|
||||
,EPlayerLocationChoice3
|
||||
,EPlayerLocationChoice4
|
||||
|
||||
,EPlayerName1
|
||||
,EPlayerName2
|
||||
,EPlayerName3
|
||||
,EPlayerName4
|
||||
|
||||
,EPlayerSpeciesChoice1
|
||||
,EPlayerSpeciesChoice2
|
||||
,EPlayerSpeciesChoice3
|
||||
,EPlayerSpeciesChoice4
|
||||
|
||||
,EDecryptPassword1
|
||||
,EDecryptPassword2
|
||||
,EDecryptPassword3
|
||||
,EDecryptPassword4
|
||||
|
||||
,EPage1
|
||||
,EPage2
|
||||
|
||||
,EConnectionRole
|
||||
,EConnectionType
|
||||
|
||||
|
||||
,ESelDictName
|
||||
,EPlayerSpecies
|
||||
};
|
||||
|
||||
#endif // __XWORDS_HRH__
|
||||
|
|
88
xwords4/symbian/src/symgamdl.cpp
Normal file
88
xwords4/symbian/src/symgamdl.cpp
Normal file
|
@ -0,0 +1,88 @@
|
|||
/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */
|
||||
/*
|
||||
* Copyright 2005 by Eric House (fixin@peak.org). All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <eikedwin.h>
|
||||
#include <eikmfne.h>
|
||||
#include <eikchlst.h>
|
||||
|
||||
#include "symgamdl.h"
|
||||
#include "xwords.hrh"
|
||||
|
||||
CXWGameInfoDlg::CXWGameInfoDlg( MPFORMAL_NOCOMMA )
|
||||
{
|
||||
MPASSIGN( this->mpool, mpool );
|
||||
}
|
||||
|
||||
CXWGameInfoDlg::~CXWGameInfoDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CXWGameInfoDlg::PreLayoutDynInitL()
|
||||
{
|
||||
/* This likely belongs in its own method */
|
||||
const TInt deps[] = { EConnectionRole
|
||||
,EPlayerLocationChoice1
|
||||
,EPlayerLocationChoice2
|
||||
,EPlayerLocationChoice3
|
||||
,EPlayerLocationChoice4
|
||||
};
|
||||
for ( TInt i = 0; i < sizeof(deps)/sizeof(deps[0]); ++i ) {
|
||||
HandleControlStateChangeL( deps[i] );
|
||||
}
|
||||
} /* PreLayoutDynInitL */
|
||||
|
||||
void
|
||||
CXWGameInfoDlg::HandleControlStateChangeL( TInt aControlId )
|
||||
{
|
||||
XP_LOGF( "HandleControlStateChangeL got %d", aControlId );
|
||||
CEikChoiceList* list;
|
||||
TInt index;
|
||||
|
||||
switch ( aControlId ) {
|
||||
case EConnectionRole:
|
||||
/* Hide EConnectionType if it's standalone */
|
||||
list = static_cast<CEikChoiceList*>(Control(EConnectionRole));
|
||||
|
||||
MakeLineVisible( EConnectionType, list->CurrentItem() != 0 );
|
||||
break;
|
||||
case EPlayerLocationChoice1:
|
||||
case EPlayerLocationChoice2:
|
||||
case EPlayerLocationChoice3:
|
||||
case EPlayerLocationChoice4: {
|
||||
index = aControlId - EPlayerLocationChoice1;
|
||||
list = static_cast<CEikChoiceList*>
|
||||
(Control(EPlayerLocationChoice1 + index ));
|
||||
TBool show = list->CurrentItem() == 0;
|
||||
|
||||
MakeLineVisible( EPlayerName1 + index, show );
|
||||
MakeLineVisible( EPlayerSpeciesChoice1 + index, show );
|
||||
MakeLineVisible( EDecryptPassword1 + index, show );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TBool
|
||||
CXWGameInfoDlg::OkToExitL( TInt aKeyCode )
|
||||
{
|
||||
return ETrue;
|
||||
}
|
Loading…
Reference in a new issue