diff options
Diffstat (limited to 'libgtk_kylix/GTKForms.pas')
| -rw-r--r-- | libgtk_kylix/GTKForms.pas | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libgtk_kylix/GTKForms.pas b/libgtk_kylix/GTKForms.pas index 0f85652..7b23879 100644 --- a/libgtk_kylix/GTKForms.pas +++ b/libgtk_kylix/GTKForms.pas @@ -1,6 +1,6 @@ (* GTK-Kylix Library: GTKForms - Basic windows (TGTKForm, TGTKDialog), TGTKApplication, TGDKScreen - Version 0.6.27 (last updated 2008-10-11) + Version 0.6.28 (last updated 2008-10-12) Copyright (C) 2007 Tomas Bzatek <tbzatek@users.sourceforge.net> This library is free software; you can redistribute it and/or @@ -194,7 +194,9 @@ type // Some basic types procedure HookSynchronizeWakeup; procedure Initialize; function MessageBox(const Text: string; Buttons: TMessageButtons = [mbOK]; Style: TMessageStyle = mbInfo; - Default: TMessageButton = mbNone; Escape: TMessageButton = mbNone): TMessageButton; + Default: TMessageButton = mbNone; Escape: TMessageButton = mbNone): TMessageButton; overload; + function MessageBox(ParentWindow: PGtkWindow; const Text: string; Buttons: TMessageButtons = [mbOK]; Style: TMessageStyle = mbInfo; + Default: TMessageButton = mbNone; Escape: TMessageButton = mbNone): TMessageButton; overload; procedure ProcessMessages; procedure Run; procedure ShowException(E: Exception); @@ -716,9 +718,18 @@ end; function TGTKApplication.MessageBox(const Text: string; Buttons: TMessageButtons; Style: TMessageStyle; Default, Escape: TMessageButton): TMessageButton; +var DialogParent: PGtkWindow; +begin + if Screen.FormCount > 0 + then DialogParent := PGtkWindow(Screen.Forms[0].FWidget) + else DialogParent := nil; + Result := MessageBox(DialogParent, Text, Buttons, Style, Default, Escape); +end; + +function TGTKApplication.MessageBox(ParentWindow: PGtkWindow; const Text: string; Buttons: TMessageButtons = [mbOK]; Style: TMessageStyle = mbInfo; + Default: TMessageButton = mbNone; Escape: TMessageButton = mbNone): TMessageButton; overload; const TMessageStyleID : array[0..3] of TGtkMessageType = (GTK_MESSAGE_ERROR, GTK_MESSAGE_INFO, GTK_MESSAGE_QUESTION, GTK_MESSAGE_WARNING); var Dialog: PGtkWidget; - DialogParent: PGtkWindow; i: integer; begin if Application.Terminated then @@ -726,10 +737,7 @@ begin Result := Escape; Exit; end; - if Screen.FormCount > 0 - then DialogParent := PGtkWindow(Screen.Forms[0].FWidget) - else DialogParent := nil; - Dialog := gtk_message_dialog_new(DialogParent, GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT, TMessageStyleID[Integer(Style)], + Dialog := gtk_message_dialog_new(ParentWindow, GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT, TMessageStyleID[Integer(Style)], GTK_BUTTONS_NONE, StringToPgchar(Text)); for i := 1 to NumMessageButtons do if TMessageButton(i - 1) in Buttons |
