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 );
25 lItem = Menu_GetItem( "MessageBoxWnd::Layout::Buttons::Right" );
26 String_EntitySet( lItem, normal, pRightButton );
28 if( strlen( pRightButton ) == 0 ) {
29 lItem.flag = lItem.flag | FLAG_HIDDEN;
30 } else if( lItem.flag & FLAG_HIDDEN ) {
31 lItem.flag = lItem.flag - FLAG_HIDDEN;
34 Nex_MessageBox_LeftEvent = pLeftEvent;
35 Nex_MessageBox_RightEvent = pRightEvent;
37 lItem = Menu_GetItem( "MessageBoxWnd" );
38 if( lItem.flag & FLAG_HIDDEN )
39 lItem.flag = lItem.flag - FLAG_HIDDEN;
41 Menu_Select( Menu_GetItem( "MessageBoxWnd::Layout::Buttons::Right" ), false );
44 void() Nex_MessageBox_Hide =
48 lEntity = Menu_GetItem( "MessageBoxWnd" );
49 if( !(lEntity.flag & FLAG_HIDDEN) ) {
50 lEntity.flag = lEntity.flag + FLAG_HIDDEN;
51 Menu_Reselect( false );
55 void() Nex_MessageBox_LeftButton =
57 if( Nex_MessageBox_LeftEvent ) {
58 Nex_MessageBox_LeftEvent();
60 Nex_MessageBox_Hide();
63 void() Nex_MessageBox_RightButton =
65 if( Nex_MessageBox_RightEvent ) {
66 Nex_MessageBox_RightEvent();
68 Nex_MessageBox_Hide();
71 bool( float pKey, float pAscii ) Nex_MessageBox_Key =
73 if( pKey == K_ESCAPE ) {
74 // escape == right button!
75 Nex_MessageBox_RightButton();