src/video/uikit/SDL_uikitmessagebox.m
changeset 6686 45014250760c
parent 6619 42214b6959c5
child 6714 146d1d7ecdc4
equal deleted inserted replaced
6685:8faee8f46165 6686:45014250760c
    26 #include "SDL_uikitvideo.h"
    26 #include "SDL_uikitvideo.h"
    27 
    27 
    28 
    28 
    29 /* Display a UIKit message box */
    29 /* Display a UIKit message box */
    30 
    30 
       
    31 static SDL_bool s_showingMessageBox = SDL_FALSE;
    31 
    32 
    32 @interface UIKit_UIAlertViewDelegate : NSObject <UIAlertViewDelegate> {
    33 @interface UIKit_UIAlertViewDelegate : NSObject <UIAlertViewDelegate> {
    33 @private
    34 @private
    34     int *clickedButtonIndex;
    35     int *clickedButtonIndex;
    35 }
    36 }
    58 }
    59 }
    59 
    60 
    60 @end // UIKit_UIAlertViewDelegate
    61 @end // UIKit_UIAlertViewDelegate
    61 
    62 
    62 
    63 
       
    64 SDL_bool
       
    65 UIKit_ShowingMessageBox()
       
    66 {
       
    67     return s_showingMessageBox;
       
    68 }
       
    69 
    63 int
    70 int
    64 UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
    71 UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
    65 {
    72 {
    66     int clicked;
    73     int clicked;
    67     
    74     
    84 
    91 
    85     [alert show];
    92     [alert show];
    86     
    93     
    87     // Run the main event loop until the alert has finished
    94     // Run the main event loop until the alert has finished
    88     // Note that this needs to be done on the main thread
    95     // Note that this needs to be done on the main thread
       
    96     s_showingMessageBox = SDL_TRUE;
    89     while (clicked == messageboxdata->numbuttons) {
    97     while (clicked == messageboxdata->numbuttons) {
    90         [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
    98         [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
    91     }
    99     }
       
   100     s_showingMessageBox = SDL_FALSE;
       
   101 
    92     *buttonid = messageboxdata->buttons[clicked].buttonid;
   102     *buttonid = messageboxdata->buttons[clicked].buttonid;
    93 
   103 
    94     [pool release];
   104     [pool release];
    95 
   105 
    96     return 0;
   106     return 0;