* Control.cs: Add InternalContains focus property, which hast the same
functionality of ContainsFocus, but also including implicit controls.
* ListViewItem.cs: Use InternalContainsFocus instead of ContainsFocus,
since we need to know if the focus is contained in our implicit
ItemControl when calculating Layout. Fixes part of #80888.
svn path=/trunk/mcs/; revision=76984
+2007-05-08 Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+ * Control.cs: Add InternalContains focus property, which hast the same
+ functionality of ContainsFocus, but also including implicit controls.
+ * ListViewItem.cs: Use InternalContainsFocus instead of ContainsFocus,
+ since we need to know if the focus is contained in our implicit
+ ItemControl when calculating Layout. Fixes part of #80888.
+
2007-05-08 Everaldo Canuto <everaldo@simios.org>
* ToolTip.cs: Remove center form string alignment as it must be align to
return false;
}
}
+
+ // Looks for focus in child controls
+ // and also in the implicit ones
+ internal bool InternalContainsFocus {
+ get {
+ IntPtr focused_window;
+
+ focused_window = XplatUI.GetFocus();
+ if (IsHandleCreated) {
+ if (focused_window == Handle)
+ return true;
+
+ foreach (Control child_control in child_controls.GetAllControls ())
+ if (child_control.InternalContainsFocus)
+ return true;
+ }
+
+ return false;
+ }
+ }
// Mouse is currently within the control's bounds
internal bool Entered {
SizeF sz = owner.DeviceContext.MeasureString (Text, Font);
if ((int) sz.Width > text_size.Width) {
- if (Focused && owner.ContainsFocus) {
+ if (Focused && owner.InternalContainsFocus) {
int text_width = text_size.Width;
StringFormat format = new StringFormat ();
format.Alignment = StringAlignment.Center;