MSG msg = new MSG();
while( Win32.GetMessageA( ref msg, 0, 0, 0 ) != 0 ) {
- if ( mainForm.ExitModalLoop ) {
+ if ( mainForm.ExitModalLoop )
break;
- }
- if( Win32.IsDialogMessage ( mainForm.Handle, ref msg ) )
- continue;
-
+ Message message = new Message ();
+ message.HWnd = msg.hwnd;
+ message.Msg = msg.message;
+ message.WParam = msg.wParam;
+ message.LParam = msg.lParam;
+
+ Control receiver = Control.FromChildHandle ( message.HWnd );
+ if ( receiver != null )
+ if ( receiver.PreProcessMessage ( ref message ) )
+ continue;
+
Win32.TranslateMessage (ref msg);
Win32.DispatchMessageA (ref msg);
}
+2003-06-30 Aleksey Ryabchuk <ryabchuk@yahoo.com>
+ * Form.cs : TopLevel, AcceptButton, CancelButton
+ * Application.cs : allow keyboard messages in modal forms
+ * Control.cs : basic impl. of GetTopLevel, SetTopLevel
+
2003-06-30 Aleksey Ryabchuk <ryabchuk@yahoo.com>
* Cursors.cs : VSplit, HSplit cursors
* Form.cs: WindowState ( not finished ), changes to Form.Close
private static readonly int RECREATING_HANDLE= BitVector32.CreateMask( DISPOSED );
private static readonly int CREATED = BitVector32.CreateMask( RECREATING_HANDLE );
private static readonly int DISPOSING = BitVector32.CreateMask( CREATED );
+ private static readonly int TOPLEVEL = BitVector32.CreateMask( DISPOSING );
object tag;
protected bool mouseIsInside_;
[MonoTODO]
protected bool GetTopLevel ()
{
- throw new NotImplementedException ();
+ return statuses [ TOPLEVEL ];
}
public void Hide ()
}
protected void SetTopLevel (bool value)
- {
+ {/*
if (value)
// FIXME: verify on whether this is supposed
// to activate/deactive the window
// FIXME: this does not make sense but
// the docs say the window is hidden
Win32.ShowWindow (Handle, ShowWindowStyles.SW_HIDE);
+ */
+ if ( GetTopLevel ( ) != value && Parent != null )
+ throw new ArgumentException ( );
+
+ statuses [ TOPLEVEL ] = value;
}
[MonoTODO]
Size maximumSize;
Size minimumSize;
double opacity;
- bool topLevel;
bool autoScale;
private bool controlBox;
SizeGripStyle sizeGripStyle;
FormStartPosition formStartPosition;
FormWindowState formWindowState;
+ IButtonControl acceptButton;
+ IButtonControl cancelButton;
public Form () : base ()
{
opacity = 1.00;
- topLevel = true;
+ TopLevel = true;
modal = false;
dialogResult = DialogResult.None;
autoScale = true;
formStartPosition = FormStartPosition.WindowsDefaultLocation;
visible = false;
formWindowState = FormWindowState.Normal;
+ acceptButton = null;
+ cancelButton = null;
}
static Form ()
//
[MonoTODO]
public IButtonControl AcceptButton {
- get {
- throw new NotImplementedException ();
- }
- set {
- //FIXME:
- }
+ get { return acceptButton; }
+ set {
+ acceptButton = value;
+ }
}
[MonoTODO]
[MonoTODO]
public IButtonControl CancelButton {
- get {
- throw new NotImplementedException ();
- }
- set {
- //FIXME:
- }
+ get { return cancelButton; }
+ set {
+ cancelButton = value;
+ }
}
[MonoTODO]
[MonoTODO]
public bool TopLevel {
- get { return topLevel; }
- set { topLevel = value; }
+ get { return GetTopLevel ( ); }
+ set { SetTopLevel ( value ); }
}
public bool TopMost {
protected override bool ProcessDialogKey (Keys keyData)
{
+ if ( keyData == Keys.Enter && AcceptButton != null ) {
+ AcceptButton.PerformClick ( );
+ return true;
+ }
+ if ( keyData == Keys.Escape && CancelButton != null ) {
+ CancelButton.PerformClick ( );
+ return true;
+ }
return base.ProcessDialogKey (keyData);
}