Commit Graph
469 Commits
Author SHA1 Message Date
Jonathan Pobst d579eeb969 2007-04-27 Jonathan Pobst <[email protected]>
* Application.cs: Need to handle keyboard menu deselection here.
	* Control.cs: Use WM_SYSKEYUP instead of WM_SYSCOMMAND to start menu keyboard
	navigation, allowing keyboard to work on X11.
	* ToolStrip.cs: Don't worry about handling the Menu key here anymore.

svn path=/trunk/mcs/; revision=76392
2007-04-27 16:49:44 +00:00
Jonathan Pobst 3730a821c4 2007-04-26 Jonathan Pobst <[email protected]>
* Application.cs: Create a shortcut path so that currently selected
	MenuStrips can intercept keyboard events without having focus.
	* Control.cs: Handle WM_SYSCOMMAND message to activate MenuStrips.
	* MenuStrip.cs, ToolStrip.cs, ToolStripDropDown.cs, ToolStripDropDownItem.cs,
	ToolStripItem.cs, ToolStripManager.cs, ToolStripMenuItem.cs: Support
	keyboard navigation (arrows, tab, enter, esc) on Windows.  Still need to
	generate WM_SYSCOMMAND message in X11 for other platforms.
	* ToolStripProfessionalRenderer.cs: ToolStripMenuItems need to be painted
	in OnRenderMenuItemBackground instead of OnRenderButtonBackground.
	* ToolStripSplitButton.cs: Add DefaultItem property.

svn path=/trunk/mcs/; revision=76353
2007-04-26 20:25:18 +00:00
Rolf Bjarne Kvinge 8a0fdccf3e * Control.cs: set_Text: move the call to the driver into a seperate
virtual method so that Form can override it.
* MaskedTextBox.cs: Corcompare fixes.
* Form.cs: Override UpdateWindowText and only update the styles if the
  form has been shown (fixes #81405).

svn path=/trunk/mcs/; revision=76300
2007-04-26 08:59:00 +00:00
Jonathan Pobst 6bb3e8b396 2007-04-25 Jonathan Pobst <[email protected]>
* Control.cs, Form.cs: Use the better supported WM_?BUTTONDOWN and
	WM_ACTIVATE messages instead of WM_MOUSEACTIVATE and
	WM_ACTIVATEAPP.  This fixes menus not disappearing on X11 when
	the form lost focus or another control was clicked.

svn path=/trunk/mcs/; revision=76278
2007-04-25 19:57:30 +00:00
Rolf Bjarne Kvinge d1d2a642c3 * Control.cs: Only raise OnVisibleChanged if we're not recreating the
handle.
* FormCollection.cs: Don't add a form if it's already in the
  collection.
* Form.cs: Change ShowDialog () to call ShowDialog (owner) with a null
  according to behaviour and MSDN. The ownerWin32 is the active
  window at the moment when we call ShowDialog, not the context's
  main form (the context's main form may open another form that opens
  a form with ShowDialog, the win32 owner is the second form). Add
  and remove forms to the Application.OpenForms in other places to
  better match MS behaviour. Add an IsActive property that raises
  On(de)Activated only if the active state has changed (we were
  raising OnDeactivated before OnActivated while creating forms).
* Application.cs: Refactor Enabling/Disabling of windows for modal
  dialog loops out to separate methods, and restore the thread
  context when we quit the method. Fixes #81407.

svn path=/trunk/mcs/; revision=76242
2007-04-25 10:37:01 +00:00
Rolf Bjarne Kvinge 278f453434 * ComboBox.cs: Forward ContextMenu to the underlying textbox, if any.
Fixes #80163.
* Control.cs: Replace GetContextMenuInternal() with ContextMenuInternal
  property, so that the setter can be overriden too.
* TextBox.cs: Change GetContextMenuInternal() to use
  ContextMenuInternal.

svn path=/trunk/mcs/; revision=76200
2007-04-24 16:32:37 +00:00
Jonathan Pobst e10ca89d40 2007-04-20 Jonathan Pobst <[email protected]>
* Control.cs: Use DefaultSize for Size, calculate ClientSize from
	that.  We were incorrectly doing it the other way around.  Also,
	update ClientSize if we change the BorderStyle before the control
	is created.

svn path=/trunk/mcs/; revision=76021
2007-04-20 19:29:16 +00:00
Jonathan Pobst 3a80b5d883 2007-04-19 Jonathan Pobst <[email protected]>
* Control.cs: Respect DefaultPadding.
	* GroupBox.cs: Implement DefaultPadding, DisplayRectangle takes
	padding into account.
	* ToolStrip.cs: Remove setting padding to DefaultPadding in constructor.	

svn path=/trunk/mcs/; revision=75957
2007-04-19 15:08:29 +00:00
Chris Toshok 76a9680579 2007-04-17 Chris Toshok <[email protected]>
* Control.cs (CreateControl): turns out in 2.0 we don't need this
	OnBindingContextChanged thing here.  It's only generated from
	ContainerControl.OnCreateControl.  Fixes a newly written unit test
	- BindingTest.BindingContextChangedTest4.
	

svn path=/trunk/mcs/; revision=75853
2007-04-17 19:52:30 +00:00
Chris Toshok 431dd638b5 2007-04-17 Chris Toshok <[email protected]>
* Control.cs (CreateControl): talk about a bizarre corner case.
	Don't emit OnBindingContextChanged here if we're a parentless
	control (i.e. if we're a form.).  Fixes
	BindingTest.BindingContextChangedTest2.


svn path=/trunk/mcs/; revision=75841
2007-04-17 17:49:50 +00:00
Everaldo Canuto f390ef80a6 2007-04-16 Everaldo Canuto <[email protected]>
[Fixes #79447]
	* Control.cs: Call invalidate in set_Region.

	* XplatUIX11.cs, XplatUIWin32.cs: Remove invalidate from SetClipRegion as
	it dont	works here.


svn path=/trunk/mcs/; revision=75776
2007-04-16 16:49:49 +00:00
Carlos Alberto Cortez 88f0d27bc8 2007-04-13 Carlos Alberto Cortez <[email protected]>
* Control.cs: In WmRButtonUp, send the WM_CONTEXTMENU message to
	the control after firing the OnMouseUp event, instead of sending
	the message before the mentioned event. This is so we can match the
	MS behaviour. Fixes part of #80385.


svn path=/trunk/mcs/; revision=75698
2007-04-13 22:40:59 +00:00
Carlos Alberto Cortez 00fc3a0c2e 2007-04-12 Carlos Alberto Cortez <[email protected]>
* Form.cs: Consider the implicit controls in
	GetRealChildAtPoint. We need it since this method
	is called on Form when handling the some messages in
	WndProc, and need to consider those implicit ones too.
	Fixes #80385.


svn path=/trunk/mcs/; revision=75667
2007-04-12 22:35:03 +00:00
Jonathan Pobst 8f28ca5d8f 2007-04-04 Jonathan Pobst <[email protected]>
* Control.cs: When we CreateControl, we need to also create all of the
	control's children.  The child's OnLoad must also fire before the parent's
	OnLoad.  Fixes the toolbox size in PDN.

svn path=/trunk/mcs/; revision=75399
2007-04-04 17:08:31 +00:00
Everaldo Canuto f830c10560 2007-04-04 Everaldo Canuto <[email protected]>
* Control.cs: GetRealChildAtPoint method added, it make an
	recursive child control search for the point. 

	* Form.cs: Makes use of GetRealChildAtPoint in mouse event after closes
	menu.

	* MenuAPI.cs: Makes use of GetRealChildAtPoint in UpdateCursor.


svn path=/trunk/mcs/; revision=75376
2007-04-04 08:29:24 +00:00
Jonathan Pobst 3114e9029c 2007-04-03 Jonathan Pobst <[email protected]>
* Control.cs: Fix an issue where if a user resized a control inside
	a sizing method like OnResize, we would overwrite their explicit
	value.  Also, only call DefaultSize once in the constructor instead
	of 4 times.  Also, do not call SetBoundsCore from SetBounds if 
	nothing actually changed.

svn path=/trunk/mcs/; revision=75367
2007-04-03 22:35:32 +00:00
Rolf Bjarne Kvinge 94601da6de * XplatUI.cs, XplatUIDriver.cs: Updated CalculateWindowRect parameters.
* CreateParams.cs: Fix IsSet, wasn't working correctly when the style
  to check for is a mix of several styles (such as WS_CAPTION for
  instance).
* Control.cs: Don't paint an area bigger than the client area when
  painting the background colour. Add an internal GetCreateParams.
  Update calls to XplatUI.CalculateWindowRect due to API change.
* XplatUIX11.cs: In PerformNCCalc set the initial size to the whole
  window's size, and handle WM_NCCALCSIZE in DefWndProc to calculate
  the size if it hasn't been handled by any windows. When creating
  and moving windows, X wants the location of the entire window, but
  the size of the client window, so add
  TranslateClientRectangleToXClientRectangle,
  TranslateWindowSizeToXWindowSIze and
  TranslatedXWindowSizeToWindowSize to cope with this, and call them
  before every window creation and move. Update CalculateWIndowRect
  to use Hwnd.GetWindowRect (one step towards removing DeriveStyles).
  In AddConfigureNotify don't do anything if the hwnd is a zombie
  (fixes the BadWindow we were getting while running the tests),
  always calculate the offsets when it's a parentless window, not
  only when reparented, and translate the window size, since we're
  getting the client size of the whole window, excluding entire
  window.
* Theme.cs: Added BorderSizableSize.
* XplatUIWin32.cs: Fix RECT Height and Width. Don't fake styles here
  anymore. Update calls to XplatUI.CalculateWindowRect due to API
  chang
* Form.cs: Update calls to XplatUI.CalculateWindowRect due to API
  change. Fake the window styles here instead of in XplatUIWin32 so
  that all back-ends get the same window styles (and it's Form that's
  deciding when to use wm, not the Win32 backend anyways)
* Hwnd.cs: Completely reworked GetWindowRectangle and
  GetClientRectangle - they are now passed a CreateParams and they
  only use Style and ExStyle to determine the rectangles (they should
  now work just like Win32AdjustWindowRectEx - though quite a few
  special cases are probably missing). They should also be 100%
  complimentary (i.e. GetWindowRectangle (GetClientRectangle (rect))
  == rect), and all numbers (borders, menu sizes) are taken from the
  current theme. Added a GetBorders helper function that will return
  the borders for any given CreateParams (including captions and
  menus), and GetBorderSize that returns the given border size only.
* XplatUIOSX.cs: Update calls to CalculateWindowRect and
  Hwnd.GetClientRectangle.

svn path=/trunk/mcs/; revision=75328
2007-04-03 08:30:59 +00:00
Rolf Bjarne Kvinge 6ac024e9ed * Control.cs: Call ContainerControl.ChildControlRemoved whenever a
control is removed from a control collecftion.
* XplatUIX11.cs: The first location for toplevel form is (22, 22).
  Fixes FormPropertyTest (failed on rare occasions).
* XplatUIWin32.cs: Add a workaround in SetParent for strange behaviour
  of Win32SetParent (when changing from no parent to a parent it
  might add the new parent's location in screen coordinates to this
  window's location).
* Form.cs: Rework ChangingParent once again, now the handle is
  recreated whenever a FormWindowManager is added or removed (that is
  whenever a normal form is parented or abandoned). Also change
  CreateParams so that all non-toplevel windows always get the
  specified sice (StartupPosition is never considered for
  non-TopLevel forms).
* ContainerControl.cs: Add ChildControlRemoved, the container control
  needs to be notified when a control is removed from it's
  collection, in the case the removed control is the active control.
* Hwnd.cs: Completely reworked GetWindowRectangle and
  GetClientRectangle - they are now passed a CreateParams and they
  only use Style and ExStyle to determine the rectangles (they should
  now work just like Win32AdjustWindowRectEx - though quite a few
  special cases are probably missing). They should also be 100%
  complimentary (i.e. GetWindowRectangle (GetClientRectangle (rect))
  == rect), and all numbers (borders, menu sizes) are taken from the
  current theme. Added a GetBorders helper function that will return
  the borders for any given CreateParams (including captions and
  menus), and GetBorderSize that returns the given border size only.

svn path=/trunk/mcs/; revision=75287
2007-04-02 16:54:59 +00:00
Jonathan Pobst 5af4b938ca 2007-03-28 Jonathan Pobst <[email protected]>
* Control.cs: We need to call OnVisibleChanged for our implicit
	children as well as our normal children.  Fixes scrollbars in
	comboboxes not showing up.

svn path=/trunk/mcs/; revision=75102
2007-03-28 19:31:15 +00:00
Jonathan Pobst 5f3001022e 2007-03-28 Jonathan Pobst <[email protected]>
* Control.cs, Form.cs: Anywhere we call CreateHandle, we need to do
	the check for IsHandleCreated first.  The check in CreateHandle is not
	good enough because CreateHandle can be overriden, and the override 
	should not be called if the handle is already created.

svn path=/trunk/mcs/; revision=75094
2007-03-28 18:04:10 +00:00
Jonathan Pobst 18bdd3d4d1 2007-03-27 Jonathan Pobst <[email protected]>
* Control.cs: Call OnVisibleChanged in SetVisibleCore for non-forms.
	Fixes tab control issues where controls would not show up because they
	never received their OnVisibleChanged call.

svn path=/trunk/mcs/; revision=75034
2007-03-27 17:29:13 +00:00
Jonathan Pobst 698a427fe2 2007-03-27 Jonathan Pobst <[email protected]>
* Control.cs: We won't get a WM_SHOWWINDOW when we create a window that
	is maximized or minimized, so move CreateControl to Control.OnVisibleChanged.
	* Form.cs: After we set the form visible, send a fake WM_SHOWWINDOW if we
	are max or min.  Remove WS_VISIBLE from CreateParams unless we are recreating
	the handle.  Fix WindowState by using the internal variable until we are 
	sure that we've been shown.
	* XplatUIX11.cs: Do not generate a WM_SHOWWINDOW message if new form is
	max or min.
	[Fixes bug #81198]

svn path=/trunk/mcs/; revision=75026
2007-03-27 16:16:10 +00:00
Jonathan Pobst 9b71ac9c4d 2007-03-24 Jonathan Pobst <[email protected]>
* Control.cs: Make SetBoundsCore match MS better.  The BoundsSpecified
	parameter indicates which aspects were explicit/user-set.
	* ComboBox.cs, ListBox.cs: Call SetBoundsCore correctly. (no 0 parameters).

2007-03-24  Jonathan Pobst  <[email protected]>

	* DefaultLayout.cs: Call SetBounds with BoundsSpecified.None instead
	of using SetImplicitBounds.
	* TableLayout.cs: Call SetBounds with BoundsSpecified.None instead of
	modifying Control.Bounds.

2007-03-24  Jonathan Pobst  <[email protected]>

	* DefaultLayoutTest.cs: Enable some NotWorking tests that now
	work correctly.

svn path=/trunk/mcs/; revision=74947
2007-03-24 20:56:11 +00:00
Miguel de Icaza 6440f2de85 2007-03-22 Miguel de Icaza <[email protected]>
* ToolStripPanel.cs (Join): added stubs to build PDN3

	* Control.cs (AutoScrollOffset): Add.

svn path=/trunk/mcs/; revision=74860
2007-03-23 00:05:07 +00:00
Rolf Bjarne Kvinge 82202c92a7 * Control.cs: ChangeParent: Call Form's ChangingParent even if the
handle is not created yet.
* Form.cs: Select: Don't call CreateHandle if the handle is already
  created, avoids a stack overflow on Windows when we are recreating
  controls.
* ScrollableControl.cs: Set the correct z-order for the scrollbars when
  they are made visible, and override AfterTopMostControl to keep
  them on top when other controls are brought to front.
  CalculateCanvas: Scrollbars are only visible if auto_scroll is true
  or force_*scroll_visible is true (old implementation always shows
  scrollbars when needed, no matter what auto_scroll was set to).
* InternalWindowManager.cs: UpdateWindowDecorations: Add a
  IsHandleCreated check.

svn path=/trunk/mcs/; revision=74798
2007-03-22 11:57:42 +00:00
Everaldo Canuto 99997dca76 2007-03-22 Everaldo Canuto <[email protected]>
[Fixes #80380]
	
	* Control.cs:
	- UpdateCursor method added to update the screen cursor.
	- GetAvailableCursor method added to return cursor for enabled tree,
	it searches for cursor on control and it's parent's for enabled control.
	- Call UpdateCursor method on setter of Cursor property.
	- On setter of Enabled call UpdateCursor when it is false, we need to
	change cursor to normal (or to this parent cursor) because cursor 
	setting theres no effect to disabled controls.
	- Some minor source changes to follow the coding style guidelines.

	* XplatUIX11.cs: In MotionNotify only dispatch SET_CURSOR event for enabled 
	controls.


svn path=/trunk/mcs/; revision=74790
2007-03-22 08:11:46 +00:00
Jonathan Pobst 8751be83f6 2007-03-21 Jonathan Pobst <[email protected]>
* Control.cs: Don't trigger a layout if an implicit control is added
	that isn't visible.  Also, don't notify the owner when an implicit control
	is added.  (Owners shouldn't even know about their implicit controls.)

svn path=/trunk/mcs/; revision=74755
2007-03-21 18:06:59 +00:00
Chris Toshok 1924c951ad 2007-03-19 Chris Toshok <[email protected]>
* Control.cs (WmPaint): don't make use of the Handle property
	after an event is emitted, as the user could have closed the
	form/destroyed the control.  Store the Handle in a local variable
	and make use of that.  Fixes bug #80768.


svn path=/trunk/mcs/; revision=74662
2007-03-20 05:23:28 +00:00
Rolf Bjarne Kvinge a0e0099310 * Control.cs: ControlCollection.Add: Remove a couple of duplicated
casts and throw if setting the parent of an mdichild that already
  has an mdiparent. Update signature for 2.0 profile. ProductName: If
  there's no AssemblyProductAttribute in the assembly, use the type's
  namespace (as MS seems to do). CreateControl: don't create the
  handle if the control is not visible (according to MS behaviour and
  spec).  SetTopLevel: Only create handle if the control is not a
  form. Change FocusInternal to virtual so that it can be overriden
  by Form.

* TextBox.cs: Update call to FocusInternal.
* Form.cs: Always create the handle when calling Focus on a MdiChild.
  The form is not a toplevel form when it's a mdi child, so update
  is_toplevel accordingly. ShowIcon/TransparencyKey: avoid creating
  the handle if it hasn't been created. Show (IWin32Window): Don't
  allow this overload for toplevel windows.
  CenterToParent/CenterToScreen/Select: create the handle as MS does.
  SetVisibleCore: if called on a MdiChild and the parent isn't
  visible yet, save the visibility and restore it when the parent is
  made visible.
* ScrollableControl.cs: Refactor out scrollbar visibility code to
  separate methods, since the visibility of the scrollbars can be
  changed from several places, not only from AutoScroll.

svn path=/trunk/mcs/; revision=74609
2007-03-19 15:15:06 +00:00
Chris Toshok 3c5187faf3 2007-03-19 Chris Toshok <[email protected]>
[ Fixes bug #80604]
	
	* XplatUIX11.cs (WaitForHwndMessage): change this to actually
	swallow the message we're waiting on, instead of delivering it, as
	this is only used for the WM_SHOWWINDOW raised from
	MapWindow/UnmapWindow, and the message needs to be generated
	(MapWindow, UnmapWindow): generate the WM_SHOWWINDOW message
	before doing the Map/Unmap.  Also make sure that the Hwnd is still
	alive after the message has been handled.

	*before* the window is shown.

	* Control.cs (CreateControl): guard a few more things inside the
	if (!is_created) block, as we might end up being called again -
	yay .net.
	(WmShowWindow): call CreateControl if we're showing the control.


svn path=/trunk/mcs/; revision=74599
2007-03-19 11:08:52 +00:00
Rolf Bjarne Kvinge dfce92a8c0 * Control.cs: Fix 2.0 signature for Invoke. Support invoking on
controls without a handle if they have any parent with a handle. In
  Dispose add a check whether the handle is created or not before
  calling BeginInvoke, this removes the need of the extra disposing
  parameter (which was bogus anyway since it didn't prevent the
  invoke from happening, it only skipped the check for an existing
  handle, meaning that the invoke would call on an inexistent
  handle).

svn path=/trunk/mcs/; revision=74593
2007-03-19 09:02:46 +00:00
Jonathan Pobst 75d1eabcec 2007-03-15 Jonathan Pobst <[email protected]>
* Control.cs: Modify UpdateStyles to store distances when bounds >=
	0 instead of just bounds > 0.  [Fixes bug #80912]

svn path=/trunk/mcs/; revision=74397
2007-03-15 17:03:21 +00:00
Chris Toshok 460827a8c1 In Test/System.Windows.Forms:
2007-03-15  Ivan N. Zlatev <[email protected]>
	
	* Common.cs, TestHelper.cs: Replaces all uses of the custom
	WM_MOUSE_LEAVE with the system WM_MOUSELEAVE message.

In System.Windows.Forms:
2007-03-15  Ivan N. Zlatev <[email protected]>
	
	* ComboBox.cs, Control.cs, XplatUIStructs.cs, XplatUIX11GTK.cs,
	XplatUIX11.cs, XplatUIWin32.cs, InternalWindowManager.cs,
	XplatUIOSX.cs, TextControl.cs: Replaces all uses of the custom
	WM_MOUSE_LEAVE with the system WM_MOUSELEAVE message.

In System.Windows.Forms.X11Internal:
2007-03-15  Ivan N. Zlatev <[email protected]>

	* X11Display.cs: Replaces all uses of the custom 
	WM_MOUSE_LEAVE with the system WM_MOUSELEAVE message.


svn path=/trunk/mcs/; revision=74346
2007-03-15 11:23:30 +00:00
Chris Toshok c5d2bc146a In System.Windows.Forms:
2007-03-15  Chris Toshok  <[email protected]>

	[ Fixes #81101 ]
	
	* Control.cs: add Ivan's fix for 81101, with a slight modification
	- you can set control.Target to null.

In Test/System.Windows.Forms:
2007-03-15  Chris Toshok  <[email protected]>

	* ControlTest.cs: add Ivan's WindowTargetTest after fixing them,
	with an extra one included.


svn path=/trunk/mcs/; revision=74344
2007-03-15 11:13:32 +00:00
Jonathan Pobst a864bc768e 2007-03-12 Jonathan Pobst <[email protected]>
* Control.cs: Another place we don't call SizeFromClientSize.
	* Form.cs: Another place we don't call SizeFromClientSize.
	[Fixes bug #81125]

2007-03-12  Jonathan Pobst  <[email protected]>

	* ControlTest.cs: Add test for bug #81125.

svn path=/trunk/mcs/; revision=74152
2007-03-12 22:16:35 +00:00
Jonathan Pobst 5fd89913bf 2007-03-12 Jonathan Pobst <[email protected]>
* Control.cs: We can't call SizeFromClientSize in the constructor,
	but we still need to do the same work, so make an internal version.
	[Fixes bug #80621]

svn path=/trunk/mcs/; revision=74129
2007-03-12 16:10:03 +00:00
Chris Toshok 478e177707 * Control.cs: really remove the call to XplatUI.SetVisible from
CreateHandle(), like I said I did when I merged the branch.


svn path=/trunk/mcs/; revision=74044
2007-03-10 01:32:45 +00:00
Jonathan Pobst 6a0c783338 2007-03-09 Jonathan Pobst <[email protected]>
* Control.cs: Wire up MouseDoubleClick event.

svn path=/trunk/mcs/; revision=74017
2007-03-09 17:59:23 +00:00
Jonathan Pobst 9bb8881343 2007-03-08 Jonathan Pobst <[email protected]>
* Control.cs: Create internal setter for client_size to allow it to be
	set without triggering resizing code.
	* Form.cs: Calculate client_size in constructor, only change client_size
	in FormBorderStyle property if Handle has been created.
	[Fixes #80574, #80791]

2007-03-08  Jonathan Pobst  <[email protected]>

	* FormTest.cs: Add tests for bugs #80574, #80791.

svn path=/trunk/mcs/; revision=73943
2007-03-08 16:09:36 +00:00
Jonathan Pobst 21bb3933cf 2007-03-07 Jonathan Pobst <[email protected]>
* XplatUIWin32.cs: The no_activate stuff was forcing us to create a
	Handle before we were supposed to.  Now checks ActivateOnShow property
	in Control.
	* Control.cs: Add internal ActivateOnShow property.
	* ComboBox.cs, Form.cs, MenuAPI.cs, ToolStripDropDown.cs: Return false
	for ActivateOnShow.
	* Hwnd.cs Remove no longer needed no_activate field.

svn path=/trunk/mcs/; revision=73921
2007-03-07 22:31:11 +00:00
Chris Toshok 0d5bce9d20 In Test/System.Windows.Forms:
2007-03-05  Chris Toshok  <[email protected]>

	[merge -r72718:73765 from mwf-handle-branch]

	2007-03-05  Chris Toshok  <[email protected]>

		* ControlHandleTest.cs: make this build on both 1.1 and 2.0
		profiles.

	2007-02-28  Chris Toshok  <[email protected]>

		* ControlTest.cs: Flesh out ControlInvokeTest to make sure that
		the Control thread dies (that Application.Run returns, basically).
		This works in isolation, but for some reason it isn't exiting when
		run in concert with other tests (this test is the cause of the
		hangs running the unit tests.)  Marking NotWorking for the time
		being.  This needs to be fixed before merging back to the
		mainline, imo.

In System.Windows.Forms:
2007-03-07  Chris Toshok  <[email protected]>

	[merge -r72718:73765 from mwf-handle-branch, and include 2 changes
	to make the rest of the world happy]

	* Control.cs (CreateHandle): there's no need to call
	XplatUI.SetVisible here, it's effectively done by
	XplatUI.CreateWindow on X now, and always was on windows.

	* XplatUIX11.cs (WaitForHwndMessage): only use the PostQuitState
	shortcircuit out of the loop if we have a message loop running on
	this thread.

	[Changelog from merge]

	2007-03-05  Chris Toshok  <[email protected]>

		* Control.cs (AccessibilityNotifyClients): turns out in 1.1 this
		causes handle creation.

	2007-02-28  Chris Toshok  <[email protected]>

		* ApplicationContext.cs: Add a flag to make sure we only raise the
		ThreadExit event once (ExitThreadCore can be indirectly called
		from a few places.)  I don't like the additional flag, but it
		makes the event ordering/count correct.

		* Application.cs (MWFThread.LoopCount): don't use an enumerator
		without locking the collection.  An enumerator doesn't give us any
		protection from modification anyway.  Lock the thread hash and
		replace the complicated enumerator loop with a foreach.
		(Application.CloseForms): make internal so it can be called from
		ApplicationContext.  This should probably be moved to MWFThread.
		(Application.ExitThread): don't call MWFThread.Current.Exit()
		here.  just call XplatUI.PostQuitMessage.  We'll exit the thread
		when the runloop exits (in response to WM_QUIT.)
		(Application.RunLoop): add a comment (and check) for
		context.MainForm being null after setting context.MainForm.Visible
		= true.  This is because you're perfectly free to dispose of a
		form in VisibilityChanged.  Chalk this up to another case where we
		need to synchronously generate WM_ACTIVATE from Control.Show.
		Also, add handling for WM_QUIT here so we'll exit the loop.
		
		* XplatUIX11.cs: clean up MapWindow and UnmapWindow a bit.  The
		fact that we don't wait if we're only unmapping the whole_window
		makes me a bit nervous, but it doesn't seem to cause any problems
		yet.

		also, add a comment about the stupid, broken and wrong resetting
		of PostQuitState to false in GetMessage().

		In PostQuitMessage, we need to add a WM_QUIT message to the
		thread's queue.  We use the FosterParent to get the right
		handle/hwnd/queue.

		Lastly, in SetVisible, we need to unmap both windows, since the
		waiting only happens when we're unmapping the client window.  So
		now, the *only* time we unmap just the whole_window is in the hack
		for resizing a control to 0,0.
		
	2007-02-21  Chris Toshok  <[email protected]>

		* Application.cs (CloseForms): rewrite this so that we don't
		modify the list while we're traversing it.

	2007-02-20  Chris Toshok  <[email protected]>

		* ListBox.cs (.ctor): move the Control.AddImplicits here instead
		of OnHandleCreated.
		(HorizontalScrollEvent): only call XplatUI.ScrollWindow if the
		handle is created.  otherwise we'll create it here.
		(VerticalScrollEvent): same here.

		* Application.cs (CloseForms): call Form.Dispose, don't post
		WM_CLOSE_INTERNAL.

		* Form.cs (WndProc): we don't need to use CLOSE_INTERNAL
		here. Application should Dispose() of the Form's.

		* XplatUIX11.cs (WaitForHwndMessage): break out of the loop on
		WM_DESTROY as well.
		(MapWindow,UnmapWindow): only actually do the waiting for
		SHOWWINDOW if the control we're dealing with is a Form.
		(CreateWindow): if the control isn't a form, SendMessage
		WM_SHOWWINDOW here (if the WS_VISIBLE style is set).

		* Control.cs (SetVisibleCore): always use is_visible here, not
		value.  If we use value, we can end up re-setting something
		visible if, for instance, you do Control.Hide() in a delegate
		attached to VisibleChanged as we do in FormTest.ShowDialogTest.

	2007-02-20  Chris Toshok  <[email protected]>

		* XplatUIX11.cs (WaitForHwndMessage): we need to loop until we get
		the message we need.  PeekMessage returning false should not be a
		condition under which we exit the loop.

	2007-02-15  Chris Toshok  <[email protected]>

		* Control.cs (Refresh): only refresh if we've got a handle and are
		visible.
		(CreateAccessibilityInstance): CreateControl() here.
		(UpdateChildrenZOrder): complicate the code loop even more by
		taking into account controls that haven't had their handle
		created, and those that aren't visible.  But on the flip side,
		simplify the code by splitting it into two loops.  one which
		builds up the list of child controls we're interested in, and the
		other that sets the z order of those children.

	2007-02-14  Chris Toshok  <[email protected]>

		* Control.cs: Control.AccessibilityObject causes the control to be
		created, not just the handle.

	2007-02-14  Chris Toshok  <[email protected]>

		* Control.cs: rework UpdateChildrenZOrder to correctly handle the
		problem on X where a window might have its handle created (and be
		visible) while the window is unmapped.  calling XConfigureWindow
		on an unmapped window is bad, and generates X errors.

	2007-02-13  Chris Toshok  <[email protected]>

		* Control.cs (CreateHandle): don't loop over our children setting
		their parent here.  do it when in WndProc when we're shown.
		(UpdateChildrenZOrder): make this internal so we can call it from
		ScrollableControl.
		(WndProc): for WM_SHOWWINDOW, reparent the child control after
		creating its handle.  Also, remove the calls to PerformLayout from
		here.  they're done in ScrollableControl.OnVisibleChanged.  Also,
		OnVisibleChanged only seems to be called directly here for the
		toplevel control.  It's propagated down the window hierarchy by
		calls to child.OnParentVisibleChanged.
		(OnVisibleChanged): don't do layout here - it's done (oddly
		enough, according to a glance at stack traces on ms.net..) in
		ScrollableControl.
		
		* ScrollableControl.cs (OnVisibleChanged): make sure we update the
		z order of our children before calling PerformLayout.

	2007-02-12  Chris Toshok  <[email protected]>

		[big change, fixes #80020]
		
		* AccessibleObject.cs: we need to make owner internal again to fix
		some of ControlAccessibleObject.

		* Control.cs: lots of changes here.  add support for WM_CREATE,
		for which we generate OnHandleCreated.  Remove the OnHandleCreated
		call from CreateHandle.  Also add support for WM_SHOWWINDOW where
		we create child controls.  leave the MonoTODO's for the
		accessibility calls, but fix the exceptions so the tests pass.

		Add the InvalidOperationExceptions to Invoke methods, and remove a
		couple of InvokeInternal methods we aren't using.
		
		Also, add a couple of CreateHandle calls in places where we know
		the handles are being created but our code doesn't reference
		.Handle.

		Make SetVisibleCore call OnVisibleChange if the handle isn't
		created.  If the handle is created, we rely on XplatUI.SetVisible
		generating the event synchronously.
		
		Lastly, make sure we don't use this.Handle inside CreateHandle,
		because we can call back into client (and that code can dispose of
		the control).

		* XplatUIStructs.cs: misc/cleanup.

		* XplatUIX11.cs: Map/Unmap X events correspond to WM_SHOWWINDOW,
		although we don't populate the wParam properly.
		(CreateWindow): generate WM_CREATE.
		(MapWindow,UnmapWindow): make these calls synchronous, at great
		performance expense (particularly in the unmap case), to match
		win32 behavior.

		* Form.cs (.ctor): remove the call to UpdateBounds. we don't need
		to call it.
		(set_MdiParent): don't recreate the handle unless it's been
		created already.
		
		* MdiClient.cs (OnResize): don't InvalidateNC Parent.Handle unless
		it's created.

		* NativeWindow.cs: this is probably the weirdest part of the
		patch.  We need a way to link up the window being created to the
		WM_CREATE message.  Since we can only be creating one window at a
		time on a given thread, we keep track of a per-thread reference so
		we can dispatch it properly.  We also need to keep track of the
		Hwnd currently being created so that the win32 backend doesn't
		have problems.
		
		* XplatUIWin32.cs: a similar change to the one we made in
		NativeWindow.cs.


svn path=/trunk/mcs/; revision=73907
2007-03-07 20:22:27 +00:00
Jonathan Pobst 150a680413 2007-03-02 Jonathan Pobst <[email protected]>
* ButtonBase.cs: Add 2.0 properties.
	* Button.cs: Override Draw for 2.0.
	* Control.cs: Add Entered and Selected properties.
	* FlatButtonAppearance.cs, TextFormatFlags.cs, TextImageRelation.cs,
	TextRenderer.cs: Make internal for 1.1 to unify drawing code.
	* Theme.cs: New abstract functions for drawing Standard, Flat, Popup
	buttons.
	* ThemeWin32Classic.cs: Implement layout calculations for 2.0 buttons.

2007-03-02  Jonathan Pobst  <[email protected]>

	* ThemeElements.cs: Driver code to theme class that actually draws 
	theme elements.
	* ThemeElementsDefault.cs: Default [win32 style] implementation of 
	Standard, Flat, Popup buttons.

2007-03-02  Jonathan Pobst  <[email protected]>

	* System.Windows.Forms.dll.sources: Add ThemeElements.cs,
	ThemeElementsDefault.cs.

svn path=/trunk/mcs/; revision=73637
2007-03-02 16:01:31 +00:00
Rolf Bjarne Kvinge 02d4c8e753 * System.Windows.Forms.dll.sources: Added FormWindowManager.cs and
ToolWindowManager.cs
* System.Windows.Forms/ToolWindowManager.cs: Added, contains logic for
  tool windows.
* System.Windows.Forms/CreateParams.cs: Add a few helper methods and an
  internal variable to know which control the CreateParams belongs
  to.
* System.Windows.Forms/Control.cs: Call Form.ChangingParent when the
  parent is about to be changed.
* System.Windows.Forms/XplatUIX11.cs: DeriveStyles (): Set
  caption_height for all windows that have captions and are children.
  Update to use ToolWindowManager instead of InternalWindowManager
  for ToolWindows.
* System.Windows.Forms/XplatUIWin32.cs: Set fake window styles for all
  windows that have window managers.
* System.Windows.Forms/MdiWindowManager.cs: Added MaximizedTitleButtons
  (the buttons are now duplicated for mdi windows when they are
  maximized, first for the buttons the window itself has, then for
  the buttons that appear in the menu bar. Makes things a little
  easier). Updated UpdateWindowDecorations, SetWindowState and the
  mouse eventhandlers accordingly.
* System.Windows.Forms/Form.cs: Add ChangingParent (), contains the
  logic of what should happen when the parent changes. In MdiParent
  don't set things that ChangingParent () is doing. When handling
  WM_CLOSE, we can close the form if there are any other modal forms
  and the current form is a descendent of the modal form.
* System.Windows.Forms/InternalWindowManager.cs: A lot of refactoring,
  the title buttons are now extracted to a separate container class
  that takes care of all button code (clicks, tooltips, etc). Moved
  Iconic|Maximized|Normal Bounds properties to this class from
  MdiWindowManager, so that the window state logic can succeed for
  other than mdi wm's. Implemented general window state change logic.
  Moved CreateButtons to ThemeWin32Classic, since the theme might
  override which buttons are available when as well as the exact
  location.
* System.Windows.Forms/FormWindowManager.cs: Added, contains logic for
  normal forms.
* System.Windows.Forms/ThemeWin32Classic.cs:
  ManagedWindowSetButtonLocations now decides which buttons go where
  (and if they are at all visible). Removed special handling of
  maximized windows, since they aren't special. In
  DrawManagedWindowDecorations don't try to draw the text if it is
  empty.
* System.Windows.Forms/MdiClient.cs: ArrangeIconicWindows: Don't
  calculate any sizes, use whatever the wm gives us.
* System.Windows.Forms.X11Internal/X11Hwnd.cs: Update to use
  ToolWindowManager.
* Test/System.Windows.Forms/FormTest.cs: Added
  MaximizedParentedFormTest.

svn path=/trunk/mcs/; revision=73636
2007-03-02 15:49:40 +00:00
Jonathan Pobst 09790caa7f 2007-03-01 Jonathan Pobst <[email protected]>
* XplatUIWin32.cs: Register a new class with Windows each time we get
	a new ClassStyle.  [Fixes bugs #79432, #80817]
	* Controls.cs: Set the correct ClassStyle in CreateParams.
	* ToolStripDropDown.cs: Don't request an invalid ClassStyle.

svn path=/trunk/mcs/; revision=73629
2007-03-02 01:54:23 +00:00
Rolf Bjarne Kvinge edbd106dc6 2007-02-20 Rolf Bjarne Kvinge <[email protected]>
* Control.cs: Fix BeginInvoke signature for 2.0 profile.
	Seems like the class status pages doesn't catch params differences.


svn path=/trunk/mcs/; revision=73173
2007-02-20 15:11:02 +00:00
Rolf Bjarne Kvinge 192d58aeec * Application.cs: When disabling all forms but the main form, do not
disable any descendants of the main form (such as mdi children or
  other parented forms). Fixes #80822 on Windows.
* Form.cs: If we have a parent, set the WS_CHILD style.
* Control.cs: Update the window styles if the control whose parent has
  changed is a form (the WS_CHILD style has to be switched).

svn path=/trunk/mcs/; revision=73105
2007-02-19 11:27:11 +00:00
Andreia Gaita f54c441cf6 * Control.cs: Code reorganization only.
- Reorganize the WndProc cases so that each case has it's own handling method, 
  to help with the no-line-numbering stack traces.
  - Formatting changes (it's vstudio's fault, really :p)

2007-02-13  Andreia Gaita  <[email protected]>

svn path=/trunk/mcs/; revision=72776
2007-02-13 14:41:34 +00:00
Chris Toshok 4cf8d669e0 revert r72565 and r72581. these will go on a branch and be merged back in once they stabilize and don't break everyone.
svn path=/trunk/mcs/; revision=72688
2007-02-12 20:27:27 +00:00
Chris Toshok 7e341e7144 2007-02-09 Chris Toshok <[email protected]>
[big change, fixes #80020]
	
	* AccessibleObject.cs: we need to make owner internal again to fix
	some of ControlAccessibleObject.

	* Control.cs: lots of changes here.  add support for WM_CREATE,
	for which we generate OnHandleCreated.  Remove the OnHandleCreated
	call from CreateHandle.  Also add support for WM_SHOWWINDOW where
	we create child controls.  leave the MonoTODO's for the
	accessibility calls, but fix the exceptions so the tests pass.

	Add the InvalidOperationExceptions to Invoke methods, and remove a
	couple of InvokeInternal methods we aren't using.
	
	Also, add a couple of CreateHandle calls in places where we know
	the handles are being created but our code doesn't reference
	.Handle.

	Make SetVisibleCore call OnVisibleChange if the handle isn't
	created.  If the handle is created, we rely on XplatUI.SetVisible
	generating the event synchronously.
	
	Lastly, make sure we don't use this.Handle inside CreateHandle,
	because we can call back into client (and that code can dispose of
	the control).

	* XplatUIStructs.cs: misc/cleanup.

	* XplatUIX11.cs: Map/Unmap X events correspond to WM_SHOWWINDOW,
	although we don't populate the wParam properly.
	(CreateWindow): generate WM_CREATE.
	(MapWindow,UnmapWindow): make these calls synchronous, at great
	performance expense (particularly in the unmap case), to match
	win32 behavior.

	* Form.cs (.ctor): remove the call to UpdateBounds. we don't need
	to call it.
	(set_MdiParent): don't recreate the handle unless it's been
	created already.
	
	* MdiClient.cs (OnResize): don't InvalidateNC Parent.Handle unless
	it's created.

	* NativeWindow.cs: this is probably the weirdest part of the
	patch.  We need a way to link up the window being created to the
	WM_CREATE message.  Since we can only be creating one window at a
	time on a given thread, we keep track of a per-thread reference so
	we can dispatch it properly.  We also need to keep track of the
	Hwnd currently being created so that the win32 backend doesn't
	have problems.
	
	* XplatUIWin32.cs: a similar change to the one we made in
	NativeWindow.cs.


svn path=/trunk/mcs/; revision=72565
2007-02-10 02:33:49 +00:00
Chris Toshok 802a9dd0d8 2007-02-07 Chris Toshok <[email protected]>
* Control.cs (SetVisibleCore): check in the proposed patch for
	80604, and set is_visible before calling CreateControl.


svn path=/trunk/mcs/; revision=72456
2007-02-07 21:16:37 +00:00