1 // Property of Alientrap/AK
2 // custom/messagebox.qc
4 var event Nex_MessageBox_LeftEvent = __NULL__;
5 var event Nex_MessageBox_RightEvent = __NULL__;
7 void( string pTitle, string pText, string pLeftButton, string pRightButton, event pLeftEvent, event pRightEvent )
12 lItem = Menu_GetItem( "MessageBoxWnd::Layout::Title::Caption" );
13 String_EntitySet( lItem, normal, pTitle );
14 // reset its size since this one has to be centered and AlignCenter takes care of everything
15 //lItem.size = '0 0 0';
17 lItem = Menu_GetItem( "MessageBoxWnd::Layout::Text" );
18 String_EntitySet( lItem, text, pText );
21 lItem = Menu_GetItem( "MessageBoxWnd::Layout::Buttons::Left" );
22 String_EntitySet( lItem, normal, pLeftButton );
24 // select the left button since it has to be available
25 Menu_Select( lItem, false );
27 lItem = Menu_GetItem( "MessageBoxWnd::Layout::Buttons::Right" );
28 String_EntitySet( lItem, normal, pRightButton );
30 if( strlen( pRightButton ) != 0 ) {
31 // select the right button since we prefer it (standard scheme is Yes No or Ok Cancel)
32 Menu_Select( lItem, false );
34 if( lItem.flag & FLAG_HIDDEN ) {
35 lItem.flag = lItem.flag - FLAG_HIDDEN;
38 lItem.flag = lItem.flag | FLAG_HIDDEN;
41 Nex_MessageBox_LeftEvent = pLeftEvent;
42 Nex_MessageBox_RightEvent = pRightEvent;
44 lItem = Menu_GetItem( "MessageBoxWnd" );
45 if( lItem.flag & FLAG_HIDDEN ) {
46 lItem.flag = lItem.flag - FLAG_HIDDEN;
50 void() Nex_MessageBox_Hide =
54 lEntity = Menu_GetItem( "MessageBoxWnd" );
55 if( !(lEntity.flag & FLAG_HIDDEN) ) {
56 lEntity.flag = lEntity.flag + FLAG_HIDDEN;
57 Menu_Reselect( false );
61 void() Nex_MessageBox_LeftButton =
63 if( Nex_MessageBox_LeftEvent ) {
64 Nex_MessageBox_LeftEvent();
66 Nex_MessageBox_Hide();
69 void() Nex_MessageBox_RightButton =
71 if( Nex_MessageBox_RightEvent ) {
72 Nex_MessageBox_RightEvent();
74 Nex_MessageBox_Hide();
77 bool( float pKey, float pAscii ) Nex_MessageBox_Key =
79 if( pKey == K_ESCAPE ) {
80 // escape == right button!
81 Nex_MessageBox_RightButton();