master chld/haikuprg / src / Alert.cpp
 1#include <Alert.h>
 2#include <Application.h>
 3
 4#include <iostream>
 5
 6int main(void){
 7  BApplication app("application/x-vnd.example.dialogdemo");
 8
 9  BAlert *a = new BAlert("Closed Emacs",
10			 "Your code is too low quality. Emacs has been closed to prevent garbage on the disk.",
11			 "Cancel", "OK", NULL,
12			 B_WIDTH_AS_USUAL, B_INFO_ALERT);
13  a->SetFeel(B_MODAL_ALL_WINDOW_FEEL);
14  a->Activate(true);
15  
16  int32 r=a->Go();
17
18  if (r == 0){
19    do{
20     BAlert *b = new BAlert("Close Emacs",
21			 "Please agree to close emacs.",
22			 "Cancel", "OK", NULL,
23			 B_WIDTH_AS_USUAL, B_INFO_ALERT);
24     b->SetFeel(B_MODAL_ALL_WINDOW_FEEL);
25     b->Activate(true);
26    r=b->Go();
27    } while (r==0);
28  }
29
30  if (r!=0){
31    std::cout<< "okay\n";
32    system("kill `pidof Emacs`");
33  }
34  return 0;
35}