| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914 |
- // Permission is hereby granted, free of charge, to any person obtaining
- // a copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to
- // permit persons to whom the Software is furnished to do so, subject to
- // the following conditions:
- //
- // The above copyright notice and this permission notice shall be
- // included in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- //
- // Copyright (c) 2004 Novell, Inc.
- //
- // Authors:
- // Peter Bartok [email protected]
- //
- // Based on work by:
- // Aleksey Ryabchuk [email protected]
- // Alexandre Pigolkine [email protected]
- // Dennis Hayes [email protected]
- // Jaak Simm [email protected]
- // John Sohn [email protected]
- //
- // $Revision: 1.11 $
- // $Modtime: $
- // $Log: Control.cs,v $
- // Revision 1.11 2004/08/06 21:30:56 pbartok
- // - Fixed recursive loop when resizing
- // - Improved/fixed redrawing on expose messages
- //
- // Revision 1.10 2004/08/06 15:53:39 jordi
- // X11 keyboard navigation
- //
- // Revision 1.9 2004/08/04 21:14:26 pbartok
- // - Fixed Invalidation bug (calculated wrong client area)
- // - Added ClientSize setter
- //
- // Revision 1.8 2004/08/04 20:11:24 pbartok
- // - Added Invalidate handling
- //
- // Revision 1.7 2004/07/27 10:38:17 jordi
- // changes to be able to run winforms samples
- //
- // Revision 1.6 2004/07/19 19:09:42 jordi
- // label control re-written: added missing functionlity, events, and properties
- //
- // Revision 1.5 2004/07/19 16:49:23 jordi
- // fixes SetBounds logic
- //
- // Revision 1.4 2004/07/19 07:29:35 jordi
- // Call RefreshWindow only if the window has created
- //
- // Revision 1.3 2004/07/15 17:03:35 jordi
- // added basic mouse handeling events
- //
- // Revision 1.2 2004/07/13 15:31:45 jordi
- // commit: new properties and fixes form size problems
- //
- // Revision 1.1 2004/07/09 05:21:25 pbartok
- // - Initial check-in
- //
- //
- // NOT COMPLETE
- using System;
- using System.Drawing;
- using System.ComponentModel;
- using System.Collections;
- using System.Diagnostics;
- using System.Threading;
- using System.Runtime.InteropServices;
- namespace System.Windows.Forms
- {
- public class Control : Component, ISynchronizeInvoke, IWin32Window
- {
- #region Local Variables
- // Basic
- internal Rectangle bounds; // bounding rectangle for control
- internal object creator_thread; // thread that created the control
- internal ControlNativeWindow window; // object for native window handle
- internal string name; // for object naming
- // State
- internal bool has_focus; // true if control has focus
- internal bool is_visible; // true if control is visible
- internal bool is_enabled; // true if control is enabled (usable/not grayed out)
- internal int tab_index; // position in tab order of siblings
- internal bool is_disposed; // has the window already been disposed?
- internal Size window_size; // size of the window (including decorations)
- internal Size client_size; // size of the client area (window excluding decorations)
- internal ControlStyles control_style; // win32-specific, style bits for control
- // Visuals
- internal Color foreground_color; // foreground color for control
- internal Color background_color; // background color for control
- internal Image background_image; // background image for control
- internal Font font; // font for control
- internal string text; // window/title text for control
- // to be categorized...
- static internal Hashtable controls; // All of the applications controls, in a flat list
- internal ControlCollection child_controls; // our children
- internal Control parent; // our parent control
- internal int num_of_children; // number of children the control has
- internal Control[] children; // our children
- internal AccessibleObject accessibility_object; // object that contains accessibility information about our control
- internal AnchorStyles anchor_style; // TODO
- internal DockStyle dock_style; // TODO
- internal BindingContext binding_context; // TODO
- internal RightToLeft right_to_left; // drawing direction for control
- internal int layout_suspended;
- #endregion // Local Variables
- #region Private Classes
- // This helper class allows us to dispatch messages to Control.WndProc
- internal class ControlNativeWindow : NativeWindow {
- private Control control;
- public ControlNativeWindow(Control control) : base() {
- this.control=control;
- }
- protected override void WndProc(ref Message m) {
- control.WndProc(ref m);
- }
- }
- #endregion
-
- #region Public Classes
- public class ControlCollection : IList, ICollection, ICloneable, IEnumerable {
- private class Enumerator : IEnumerator {
- private Control owner;
- private int current;
- public Enumerator(Control owner) {
- this.owner=owner;
- this.current=-1;
- }
- public bool MoveNext() {
- current++;
- if (current>=owner.num_of_children) {
- return false;
- }
- return true;
- }
- public void Reset() {
- current=-1;
- }
- public object Current {
- get {
- if (current>=0 && current<owner.num_of_children) {
- return owner.children[current];
- } else {
- throw new InvalidOperationException("enumerator out of range");
- }
- }
- }
- }
- protected Control owner;
- #region ControlCollection Public Constructor
- public ControlCollection(Control owner) {
- this.owner=owner;
- }
- #endregion
- #region ControlCollection Public Instance Properties
- public int Count {
- get {
- return owner.num_of_children;
- }
- }
- public bool IsReadOnly {
- get {
- return false;
- }
- }
- public virtual Control this [int index] {
- get {
- if ((uint)index>=owner.num_of_children) {
- throw new ArgumentOutOfRangeException();
- }
- return owner.children[index];
- }
- }
- #endregion // ControlCollection Public Instance Properties
- #region ControlCollection Public Instance Methods
- public virtual void Add(Control value) {
- // Don't add it if we already have it
- for (int i=0; i<owner.num_of_children; i++) {
- if (value==owner.child_controls[i]) {
- return;
- }
- }
- value.Parent=owner;
- owner.OnControlAdded(new ControlEventArgs(value));
- }
- public virtual void AddRange(Control[] controls) {
- for (int i=0; i<controls.Length; i++) {
- Add(controls[i]);
- }
- }
- public virtual void Clear() {
- owner.SuspendLayout();
- for (int i=0; i<owner.num_of_children; i++) {
- Remove(owner.children[i]);
- }
- owner.ResumeLayout();
- }
- public bool Contains(Control control) {
- for (int i=0; i<owner.num_of_children; i++) {
- if (owner.children[i]==control) {
- return true;
- }
- }
- return false;
- }
- public void CopyTo(Array dest, int index) {
- if (owner.num_of_children>0) {
- Array.Copy(owner.children, 0, dest, index, owner.num_of_children);
- }
- }
- public override bool Equals(object other) {
- if (other is ControlCollection && (((ControlCollection)other).owner==this.owner)) {
- return(true);
- } else {
- return(false);
- }
- }
- public int GetChildIndex(Control child) {
- return GetChildIndex(child, false);
- }
- public int GetChildIndex(Control child, bool throwException) {
- int index;
- index=IndexOf(child);
- if (index==-1 && throwException) {
- throw new ArgumentException("Not a child control", "child");
- }
- return index;
- }
- public IEnumerator GetEnumerator() {
- return new ControlCollection.Enumerator(this.owner);
- }
- public override int GetHashCode() {
- return base.GetHashCode();
- }
- public int IndexOf(Control control) {
- int index;
- for (index=0; index<owner.num_of_children; index++) {
- if (owner.children[index] == control) {
- return index;
- }
- }
- return -1;
- }
- public virtual void Remove(Control value) {
- for (int i=0; i<owner.num_of_children; i++) {
- if (owner.children[i]==value) {
- RemoveAt(i);
- }
- }
- }
- public void RemoveAt(int index) {
- for (int i=index; i<owner.num_of_children; i++) {
- owner.children[i]=owner.children[i+1];
- }
- }
- public void SetChildIndex(Control child, int new_index) {
- int old_index;
- old_index=IndexOf(child);
- if (old_index==-1) {
- throw new ArgumentException("Not a child control", "child");
- }
- if (old_index==new_index) {
- return;
- }
- RemoveAt(old_index);
- if (new_index>owner.num_of_children) {
- Add(child);
- } else {
- for (int i=owner.num_of_children-1;i>new_index; i--) {
- owner.children[i+1]=owner.children[i];
- }
- owner.children[new_index]=(Control)child;
- }
- }
- #endregion // ControlCollection Public Instance Methods
- #region ControlCollection Interface Methods
- #if nodef
- int IList.Add(Control value) {
- Add(value);
-
- }
- #endif
- int IList.Add(object value) {
- if (!(value is Control)) {
- throw new ArgumentException("Not of type Control", "value");
- }
- Add((Control)value);
- // Assumes the element was added to the end of the list
- return owner.num_of_children;
- }
- void IList.Clear() {
- this.Clear();
- }
- bool IList.Contains(object value) {
- if (!(value is Control)) {
- throw new ArgumentException("Not of type Control", "value");
- }
- return this.Contains((Control)value);
- }
- int IList.IndexOf(object value) {
- if (!(value is Control)) {
- throw new ArgumentException("Not of type Control", "value");
- }
- for (int i=0; i<owner.num_of_children; i++) {
- if (owner.children[i]==(Control)value) {
- return i;
- }
- }
- return -1;
- }
- void IList.Insert(int index, object value) {
- if (!(value is Control)) {
- throw new ArgumentException("Not of type Control", "value");
- }
- if (index>owner.num_of_children) {
- throw new ArgumentOutOfRangeException("index");
- }
- for (int i=owner.num_of_children-1;i>index; i--) {
- owner.children[i+1]=owner.children[i];
- }
- owner.children[index]=(Control)value;
- }
- void IList.Remove(object value) {
- if (!(value is Control)) {
- throw new ArgumentException("Not of type Control", "value");
- }
- this.Remove((Control)value);
- }
- object IList.this [int index] {
- get {
- return owner.children[index];
- }
- set {
-
- }
- }
- bool IList.IsFixedSize {
- get {
- return false;
- }
- }
- object ICollection.SyncRoot {
- get {
- return this;
- }
- }
- bool ICollection.IsSynchronized {
- get {
- return false;
- }
- }
- Object ICloneable.Clone() {
- ControlCollection clone = new ControlCollection(this.owner);
- return clone;
- }
- #endregion // ControlCollection Interface Methods
- class ControlComparer : IComparer {
- int IComparer.Compare(object x, object y) {
- int tab_index_x;
- int tab_index_y;
- tab_index_x=((Control)x).tab_index;
- tab_index_y=((Control)y).tab_index;
- if (tab_index_x<tab_index_y) {
- return -1;
- } else if (tab_index_x>tab_index_y) {
- return 1;
- }
- return 0;
- }
- }
- }
- #endregion // ControlCollection Class
-
- #region Public Constructors
- public Control() {
- creator_thread = Thread.CurrentThread;
- controls = new Hashtable();
- child_controls = CreateControlsInstance();
- bounds = new Rectangle(0, 0, DefaultSize.Width, DefaultSize.Height);
- window_size = new Size(DefaultSize.Width, DefaultSize.Height);
- client_size = new Size(DefaultSize.Width, DefaultSize.Height);
- is_visible = true;
- is_disposed = false;
- is_enabled = true;
- has_focus = false;
- layout_suspended = 0;
- parent = null;
- background_image = null;
- }
- public Control(Control parent, string text) : this() {
- Text=text;
- Parent=parent;
- }
- public Control(Control parent, string text, int left, int top, int width, int height) : this() {
- Parent=parent;
- Left=left;
- Top=top;
- Width=width;
- Height=height;
- Text=text;
- }
- public Control(string text) : this() {
- Text=text;
- }
- public Control(string text, int left, int top, int width, int height) : this() {
- Left=left;
- Top=top;
- Width=width;
- Height=height;
- Text=text;
- }
- #endregion // Public Constructors
- #region Public Static Properties
- public static Color DefaultBackColor {
- get {
- return XplatUI.Defaults.BackColor;
- }
- }
- public static Font DefaultFont {
- get {
- return XplatUI.Defaults.Font;
- }
- }
- public static Color DefaultForeColor {
- get {
- return XplatUI.Defaults.ForeColor;
- }
- }
- public static Keys ModifierKeys {
- get {
- return XplatUI.State.ModifierKeys;
- }
- }
- public static MouseButtons MouseButtons {
- get {
- return XplatUI.State.MouseButtons;
- }
- }
- public static Point MousePosition {
- get {
- return XplatUI.State.MousePosition;
- }
- }
- #endregion // Public Static Properties
- #region Public Instance Properties
- public AccessibleObject AccessibilityObject {
- get {
- if (accessibility_object==null) {
- accessibility_object=CreateAccessibilityInstance();
- }
- return accessibility_object;
- }
- }
- public string AccessibleDefaultActionDescription {
- get {
- return AccessibilityObject.default_action;
- }
- set {
- AccessibilityObject.default_action=value;
- }
- }
- public string AccessibleDescription {
- get {
- return AccessibilityObject.description;
- }
- set {
- AccessibilityObject.description=value;
- }
- }
- public string AccessibleName {
- get {
- return AccessibilityObject.Name;
- }
- set {
- AccessibilityObject.Name=value;
- }
- }
- public AccessibleRole AccessibleRole {
- get {
- return AccessibilityObject.role;
- }
- set {
- AccessibilityObject.role=value;
- }
- }
- public virtual bool AllowDrop {
- get {
- return XplatUI.State.DropTarget;
- }
- set {
- XplatUI.State.DropTarget=value;
- }
- }
- public virtual AnchorStyles Anchor {
- get {
- return anchor_style;
- }
- set {
- anchor_style=value;
- }
- }
- public virtual Color BackColor {
- get {
- if (background_color.IsEmpty) {
- if (parent!=null) {
- return parent.BackColor;
- }
- return DefaultBackColor;
- }
- return background_color;
- }
- set {
- background_color=value;
- Refresh();
- }
- }
- public virtual Image BackgroundImage {
- get {
- return background_image;
- }
- set {
- if (background_image!=value) {
- background_image=value;
- OnBackgroundImageChanged(EventArgs.Empty);
- }
- }
- }
- public virtual BindingContext BindingContext {
- get {
- throw new NotImplementedException();
- }
- set {
- throw new NotImplementedException();
- }
- }
- public int Bottom {
- get {
- return bounds.Y+bounds.Height;
- }
- }
- public Rectangle Bounds {
- get {
- return this.bounds;
- }
- set {
- SetBounds(value.Left, value.Top, value.Width, value.Height, BoundsSpecified.All);
- }
- }
- public bool CanFocus {
- get {
- throw new NotImplementedException();
- }
- }
- public bool CanSelect {
- get {
- throw new NotImplementedException();
- }
- }
- public bool Capture {
- get {
- throw new NotImplementedException();
- }
- set {
- throw new NotImplementedException();
- }
- }
- public bool CausesValidation {
- get {
- throw new NotImplementedException();
- }
- set {
- throw new NotImplementedException();
- }
- }
- public Rectangle ClientRectangle {
- get {
- return new Rectangle(0, 0, client_size.Width, client_size.Height);
- }
- }
- public Size ClientSize {
- get {
- return client_size;
- }
- set {
- this.SetClientSizeCore(value.Width, value.Height);
- }
- }
- public String CompanyName {
- get {
- return "Mono Project, Novell, Inc.";
- }
- }
- public bool ContainsFocus {
- get {
- throw new NotImplementedException();
- }
- }
- #if notdef
- public virtual ContextMenu ContextMenu {
- get {
- throw new NotImplementedException();
- }
- set {
- throw new NotImplementedException();
- }
- }
- #endif
- public ControlCollection Controls {
- get {
- return CreateControlsInstance();
- }
- }
- public bool Created {
- get {
- throw new NotImplementedException();
- }
- }
- #if notdef
- public virtual Cursor Cursor {
- get {
- throw new NotImplementedException();
- }
- set {
- throw new NotImplementedException();
- }
- }
- public ControlBidingsCollection DataBindings {
- get {
- throw new NotImplementedException();
- }
- }
- #endif
- public virtual Rectangle DisplayRectangle {
- get {
- return ClientRectangle;
- }
- }
- public bool Disposing {
- get {
- throw new NotImplementedException();
- }
- }
- public virtual DockStyle Dock {
- get { return dock_style;}
- set {
- if (dock_style == value)
- return;
- dock_style = value;
- }
- }
- public bool Enabled {
- get {
- return is_enabled;
- }
- set {
- is_enabled = value;
- }
- }
- public virtual bool Focused {
- get {
- return this.has_focus;
- }
- set {
- throw new NotImplementedException();
- }
- }
- public virtual Font Font {
- get {
- if (font != null) {
- return font;
- }
- if (Parent != null && Parent.Font != null) {
- return Parent.Font;
- }
- return DefaultFont;
- }
- set {
- font=value;
- Refresh();
- }
- }
- public virtual Color ForeColor {
- get {
- if (foreground_color.IsEmpty) {
- if (parent!=null) {
- return parent.ForeColor;
- }
- return DefaultForeColor;
- }
- return foreground_color;
- }
- set {
- foreground_color=value;
- Refresh();
- }
- }
- public bool IsDisposed {
- get {
- return this.is_disposed;
- }
- }
- public bool IsHandleCreated {
- get {
- if ((window!=null) && (window.Handle!=IntPtr.Zero)) {
- return true;
- }
- return false;
- }
- }
- public string Name {
- get {
- return this.name;
- }
- set {
- this.name=value;
- }
- }
- public Control Parent {
- get {
- return this.parent;
- }
- set {
- if (parent!=value) {
- if (parent!=null) {
- parent.Controls.Remove(this);
- }
- parent=value;
- if (!parent.Controls.Contains(this)) {
- parent.Controls.Add(this);
- }
- XplatUI.SetParent(Handle, value.Handle);
- }
- }
- }
- public IntPtr Handle { // IWin32Window
- get
- {
- if (!IsHandleCreated) {
- CreateHandle();
- }
- return window.Handle;
- }
- }
- public bool InvokeRequired { // ISynchronizeInvoke
- get {
- if (creator_thread!=Thread.CurrentThread) {
- return true;
- }
- return false;
- }
- }
- public bool Visible {
- get {
- return this.is_visible;
- }
- set {
- if (value!=is_visible) {
- is_visible=value;
- XplatUI.SetVisible(Handle, value);
- }
- }
- }
- public virtual string Text {
- get {
- return this.text;
- }
- set {
- if (text!=value) {
- text=value;
- XplatUI.Text(Handle, text);
- }
- }
- }
- public int Left {
- get {
- return this.bounds.X;
- }
- set {
- SetBounds(value, bounds.Y, bounds.Width, bounds.Height, BoundsSpecified.X);
- }
- }
- public int Top {
- get {
- return this.bounds.Y;
- }
- set {
- SetBounds(bounds.X, value, bounds.Width, bounds.Height, BoundsSpecified.Y);
- }
- }
- public int Width {
- get {
- return this.bounds.Width;
- }
- set {
- SetBounds(bounds.X, bounds.Y, value, bounds.Height, BoundsSpecified.Width);
- }
- }
- public int Height {
- get {
- return this.bounds.Height;
- }
- set {
- SetBounds(bounds.X, bounds.Y, bounds.Width, value, BoundsSpecified.Height);
- }
- }
- public Point Location {
- get {
- return new Point(bounds.X, bounds.Y);
- }
- set {
- SetBounds(value.X, value.Y, bounds.Width, bounds.Height, BoundsSpecified.Location);
- }
- }
- public Size Size {
- get {
- return new Size(Width, Height);
- }
- set {
- SetBounds(bounds.X, bounds.Y, value.Width, value.Height, BoundsSpecified.Size);
- }
- }
-
- public int TabIndex {
- get {
- return tab_index;
- }
- set {
- tab_index = value;
- }
- }
- #endregion // Public Instance Properties
- #region Protected Instance Properties
- protected virtual CreateParams CreateParams {
- get {
- CreateParams create_params = new CreateParams();
- create_params.Caption = Text;
- create_params.X = Left;
- create_params.Y = Top;
- create_params.Width = Width;
- create_params.Height = Height;
- create_params.ClassName = XplatUI.DefaultClassName;
- create_params.ClassStyle = 0;
- create_params.ExStyle = 0;
- create_params.Param = 0;
- if (parent!=null) {
- create_params.Parent = parent.Handle;
- }
- create_params.Style = (int)WindowStyles.WS_OVERLAPPED;
- if (is_visible) {
- create_params.Style |= (int)WindowStyles.WS_VISIBLE;
- }
- return create_params;
- }
- }
- protected virtual ImeMode DefaultImeMode {
- get {
- return ImeMode.Inherit;
- }
- }
- protected virtual Size DefaultSize {
- get {
- return new Size(100, 23);
- }
- }
- #endregion // Protected Instance Properties
- #region Public Instance Methods
- public bool Contains(Control ctl) {
- Control current;
- current=ctl;
- while (current!=null) {
- if (current==ctl) {
- return true;
- }
- current=current.parent;
- }
- return false;
- }
- public void CreateControl() {
- Control child;
- CreateHandle();
- for (int i=0; i<num_of_children; i++) {
- child_controls[i].CreateControl();
- }
- OnCreateControl();
- }
- public virtual void Refresh() {
- if (IsHandleCreated == true)
- XplatUI.RefreshWindow(window.Handle);
- }
- public void SetBounds(int x, int y, int width, int height) {
- SetBounds(x, y, width, height, BoundsSpecified.All);
- }
- public void SetBounds(int x, int y, int width, int height, BoundsSpecified bounds_specified) {
- if ((bounds_specified & BoundsSpecified.X) != BoundsSpecified.X) {
- x = Left;
- }
- if ((bounds_specified & BoundsSpecified.Y) != BoundsSpecified.Y) {
- y = Top;
- }
- if ((bounds_specified & BoundsSpecified.Width)!= BoundsSpecified.Width) {
- width = Width;
- }
- if ((bounds_specified & BoundsSpecified.Height) != BoundsSpecified.Height) {
- height = Height;
- }
- if (IsHandleCreated) {
- XplatUI.MoveWindow(Handle, x, y, width, height);
- }
- UpdateBounds(x, y, width, height);
- }
- public void Show() {
- if (!IsHandleCreated) {
- this.CreateHandle();
- }
- this.Visible=true;
- }
- public object Invoke(Delegate method) { // ISynchronizeInvoke
- return Invoke(method, null);
- }
- public object Invoke(Delegate method, object[] args) { // ISynchronizeInvoke
- IAsyncResult result;
- result=BeginInvoke(method, args);
- return EndInvoke(result);
- }
- public IAsyncResult BeginInvoke(Delegate method) { // ISynchronizeInvoke
- return BeginInvoke(method, null);
- }
- protected virtual AccessibleObject CreateAccessibilityInstance() {
- return new AccessibleObject(this);
- }
- protected virtual ControlCollection CreateControlsInstance() {
- return new ControlCollection(this);
- }
- protected void UpdateBounds() {
- UpdateBounds(bounds.X, bounds.Y, bounds.Width, bounds.Height);
- }
- protected void UpdateBounds(int x, int y, int width, int height) {
- bool moved = false;
- bool resized = false;
- // Generate required notifications
- if ((this.bounds.X!=x) || (this.bounds.Y!=y)) {
- moved=true;
- }
- if ((this.Bounds.Width!=width) || (this.Bounds.Height!=height)) {
- resized=true;
- }
- bounds.X=x;
- bounds.Y=y;
- bounds.Width=width;
- bounds.Height=height;
- #if notdef
- if (IsHandleCreated) {
- XplatUI.SetWindowPos(Handle, bounds);
- }
- #endif
- if (moved) {
- OnLocationChanged(EventArgs.Empty);
- }
- if (resized) {
- OnSizeChanged(EventArgs.Empty);
- }
- }
- protected void UpdateBounds(int x, int y, int width, int height, int clientWidth, int clientHeight) {
- UpdateBounds(x, y, width, height);
- }
- public void Invalidate() {
- Invalidate(new Rectangle(0, 0, bounds.Width, bounds.Height), false);
- }
- public void Invalidate(bool invalidateChildren) {
- Invalidate(new Rectangle(0, 0, bounds.Width, bounds.Height), invalidateChildren);
- }
- public void Invalidate(System.Drawing.Rectangle rc) {
- Invalidate(rc, false);
- }
- public void Invalidate(System.Drawing.Rectangle rc, bool invalidateChildren) {
- if (!IsHandleCreated || !is_visible) {
- return;
- }
- XplatUI.Invalidate(Handle, rc, false);
- if (invalidateChildren) {
- for (int i=0; i<num_of_children; i++) children[i].Invalidate();
- }
- }
- public void Invalidate(System.Drawing.Region region) {
- Invalidate(region, false);
- }
- [MonoTODO]
- public void Invalidate(System.Drawing.Region region, bool invalidateChildren) {
- throw new NotImplementedException();
- // FIXME - should use the GetRegionScans function of the region to invalidate each area
- if (invalidateChildren) {
- for (int i=0; i<num_of_children; i++) children[i].Invalidate();
- }
- }
- [MonoTODO("BeginInvoke() : Figure out a cross-platform way to handle this")]
- public IAsyncResult BeginInvoke(Delegate method, object[] args) { // ISynchronizeInvoke
- IAsyncResult result = null;
- return result;
- }
- [MonoTODO]
- public object EndInvoke(IAsyncResult async_result) { // ISynchronizeInvoke
- object result = null;
- return result;
- }
- public void ResumeLayout()
- {
- ResumeLayout (true);
- }
- [MonoTODO]
- public void ResumeLayout(bool peformLayout)
- {
- layout_suspended--;
-
- if (layout_suspended > 0 || peformLayout == false)
- return;
- // PerformLayout and fire event
- }
-
- public void SuspendLayout()
- {
- layout_suspended++;
- }
- [MonoTODO]
- protected virtual void WndProc(ref Message m) {
- EventArgs e = new EventArgs();
- #if debug
- Console.WriteLine("Received message {0}", m);
- #endif
- switch((Msg)m.Msg) {
- #if notyet
- // Mouse handling
- case Msg.WM_LBUTTONDBLCLK: throw new NotImplementedException(); break;
- case Msg.WM_RBUTTONDOWN: throw new NotImplementedException(); break;
- case Msg.WM_RBUTTONUP: throw new NotImplementedException(); break;
- case Msg.WM_RBUTTONDBLCLK: throw new NotImplementedException(); break;
- case Msg.WM_MOUSEHOVER: throw new NotImplementedException(); break;
- case Msg.WM_MOUSELEAVE: throw new NotImplementedException(); break;
-
- // Keyboard handling
- case Msg.WM_CHAR: throw new NotImplementedException(); break;
- case Msg.WM_KEYDOWN: throw new NotImplementedException(); break;
- case Msg.WM_KEYUP: throw new NotImplementedException(); break;
- #endif
- // Window management
- case Msg.WM_PAINT: {
- Rectangle rect;
- PaintEventArgs paint_event;
- paint_event = XplatUI.PaintEventStart(Handle);
- OnPaint(paint_event);
- XplatUI.PaintEventEnd(Handle);
- DefWndProc(ref m);
- break;
- }
-
- case Msg.WM_ERASEBKGND:{
-
- if (GetStyle (ControlStyles.UserPaint)){
- PaintEventArgs eraseEventArgs = new PaintEventArgs (Graphics.FromHdc (m.WParam), new Rectangle (new Point (0,0),Size));
- OnPaintBackground (eraseEventArgs);
- m.Result = (IntPtr)1;
- }
- else {
- m.Result = (IntPtr)0;
- DefWndProc (ref m);
- }
-
- break;
- }
-
- case Msg.WM_LBUTTONUP: {
-
- int clicks = 1;
- int delta = 1;
-
- OnMouseUp (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- clicks, LowOrder ((int) m.LParam.ToInt32 ()),
- HighOrder ((int) m.LParam.ToInt32 ()), delta));
-
- break;
- }
-
- case Msg.WM_LBUTTONDOWN: {
-
- int clicks = 1;
- int delta = 1;
-
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- clicks, LowOrder ((int) m.LParam.ToInt32 ()),
- HighOrder ((int) m.LParam.ToInt32 ()), delta));
-
- break;
- }
-
-
- case Msg.WM_MOUSEMOVE: {
-
- int clicks = 1;
- int delta = 1;
-
- OnMouseMove (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- clicks, LowOrder ((int) m.LParam.ToInt32 ()),
- HighOrder ((int) m.LParam.ToInt32 ()), delta));
- break;
- }
-
- case Msg.WM_SIZE: {
-
- UpdateBounds (bounds.X, bounds.Y, LowOrder ((int) m.LParam.ToInt32 ()),
- HighOrder ((int) m.LParam.ToInt32 ()));
-
- DefWndProc(ref m);
- break;
- }
- case Msg.WM_KEYDOWN: {
- if (!ProcessKeyEventArgs (ref m))
- DefWndProc (ref m);
- break;
- }
- case Msg.WM_KEYUP: {
- if (!ProcessKeyEventArgs (ref m))
- DefWndProc (ref m);
- break;
- }
-
- #if notyet
- case Msg.WM_WINDOWPOSCHANGED: throw new NotImplementedException(); break;
- case Msg.WM_SYSCOLORCHANGE: throw new NotImplementedException(); break;
-
- #endif
- default:
- DefWndProc(ref m);
- break;
- }
-
-
-
- }
- #endregion // Public Instance Methods
- #region // Protected Instance Methods
- protected virtual void CreateHandle() {
- if (IsDisposed) {
- throw new ObjectDisposedException(Name);
- }
- if (IsHandleCreated) {
- return;
- }
- if (window==null) {
- window = new ControlNativeWindow(this);
- window.CreateHandle(CreateParams);
- }
- if (window.Handle!=IntPtr.Zero) {
- if (!controls.Contains(window.Handle)) {
- controls.Add(window.Handle, this);
- }
- creator_thread = Thread.CurrentThread;
- OnHandleCreated(EventArgs.Empty);
- }
- }
- protected virtual void DefWndProc(ref Message m) {
- window.DefWndProc(ref m);
- }
- protected virtual void DestroyHandle() {
- if (IsHandleCreated) {
- if (Handle != IntPtr.Zero) {
- controls.Remove(Handle);
- }
- if (window != null) {
- window.DestroyHandle();
- }
- }
- }
- protected virtual bool ProcessKeyEventArgs (ref Message msg)
- {
- KeyEventArgs key_event;
- switch (msg.Msg) {
- case (int)Msg.WM_KEYDOWN: {
- key_event = new KeyEventArgs ((Keys)msg.WParam.ToInt32 ());
- OnKeyDown (key_event);
- return key_event.Handled;
- }
- case (int)Msg.WM_KEYUP: {
- key_event = new KeyEventArgs ((Keys)msg.WParam.ToInt32 ());
- OnKeyUp (key_event);
- return key_event.Handled;
- }
- default:
- break;
- }
- return false;
- }
- protected virtual bool IsInputKey (Keys keyData)
- {
- return false;
- }
- protected virtual bool ProcessDialogKey (Keys keyData)
- {
- if (parent != null)
- return Parent.ProcessDialogKey (keyData);
- return false;
- }
- protected bool GetStyle(ControlStyles flag) {
- return (control_style & flag) != 0;
- }
- protected virtual bool ProcessDialogChar(char charCode) {
- throw new NotImplementedException();
- }
- protected virtual bool ProcessMnemonic(char charCode) {
- throw new NotImplementedException();
- }
- protected void RecreateHandle() {
- IEnumerator child = child_controls.GetEnumerator();
- if (IsHandleCreated) {
- DestroyHandle();
- CreateHandle();
- // FIXME ZOrder?
- while (child.MoveNext()) {
- ((Control)child.Current).RecreateHandle();
- }
- }
- }
- protected virtual void ScaleCore(float dx, float dy) {
- throw new NotImplementedException();
- }
- protected virtual void Select(bool directed, bool forward) {
- throw new NotImplementedException();
- }
- protected virtual void SetClientSizeCore(int x, int y) {
- bounds.Width=x;
- bounds.Height=y;
- XplatUI.SetWindowPos(Handle, bounds);
- }
- protected void SetStyle(ControlStyles flag, bool value) {
- if (value) {
- control_style |= flag;
- } else {
- control_style &= ~flag;
- }
- }
- #endregion // Public Instance Methods
- #region Private Instance Methods
- #endregion // Private Instance Methods
- #region Private Instance Methods
- internal virtual void DoDefaultAction() {
- // Only here to be overriden by our actual controls; this is needed by the accessibility class
- }
- #endregion // Private Instance Methods
- #region OnXXX methods
- protected virtual void OnBackColorChanged(EventArgs e) {
- if (BackColorChanged!=null) BackColorChanged(this, e);
- for (int i=0; i<num_of_children; i++) children[i].OnParentBackColorChanged(e);
- }
- protected virtual void OnBackgroundImageChanged(EventArgs e) {
- if (BackgroundImageChanged!=null) BackgroundImageChanged(this, e);
- for (int i=0; i<num_of_children; i++) children[i].OnParentBackgroundImageChanged(e);
- }
- protected virtual void OnBindingContextChanged(EventArgs e) {
- if (BindingContextChanged!=null) BindingContextChanged(this, e);
- for (int i=0; i<num_of_children; i++) children[i].OnParentBindingContextChanged(e);
- }
- protected virtual void OnCausesValidationChanged(EventArgs e) {
- if (CausesValidationChanged!=null) CausesValidationChanged(this, e);
- }
- protected virtual void OnChangeUICues(UICuesEventArgs e) {
- if (CausesValidationChanged!=null) CausesValidationChanged(this, e);
- }
- protected virtual void OnClick(EventArgs e) {
- if (Click!=null) Click(this, e);
- }
- protected virtual void OnContextMenuChanged(EventArgs e) {
- if (ContextMenuChanged!=null) ContextMenuChanged(this, e);
- }
- protected virtual void OnControlAdded(ControlEventArgs e) {
- if (ControlAdded!=null) ControlAdded(this, e);
- }
- protected virtual void OnControlRemoved(ControlEventArgs e) {
- if (ControlRemoved!=null) ControlRemoved(this, e);
- }
- protected virtual void OnCreateControl() {
- }
- protected virtual void OnCursorChanged(EventArgs e) {
- if (CursorChanged!=null) CursorChanged(this, e);
- }
- protected virtual void OnDockChanged(EventArgs e) {
- if (DockChanged!=null) DockChanged(this, e);
- }
- protected virtual void OnDoubleClick(EventArgs e) {
- if (DoubleClick!=null) DoubleClick(this, e);
- }
- protected virtual void OnDragDrop(DragEventArgs drgevent) {
- if (DragDrop!=null) DragDrop(this, drgevent);
- }
- protected virtual void OnDragEnter(DragEventArgs drgevent) {
- if (DragEnter!=null) DragEnter(this, drgevent);
- }
- protected virtual void OnDragLeave(EventArgs e) {
- if (DragLeave!=null) DragLeave(this, e);
- }
- protected virtual void OnDragOver(DragEventArgs drgevent) {
- if (DragOver!=null) DragOver(this, drgevent);
- }
- protected virtual void OnEnabledChanged(EventArgs e) {
- if (EnabledChanged!=null) EnabledChanged(this, e);
- for (int i=0; i<num_of_children; i++) children[i].OnParentEnabledChanged(e);
- }
- protected virtual void OnEnter(EventArgs e) {
- if (Enter!=null) Enter(this, e);
- }
- protected virtual void OnFontChanged(EventArgs e) {
- if (FontChanged!=null) FontChanged(this, e);
- }
- protected virtual void OnForeColorChanged(EventArgs e) {
- if (ForeColorChanged!=null) ForeColorChanged(this, e);
- for (int i=0; i<num_of_children; i++) children[i].OnParentForeColorChanged(e);
- }
- protected virtual void OnGiveFeedback(GiveFeedbackEventArgs gfbevent) {
- if (GiveFeedback!=null) GiveFeedback(this, gfbevent);
- }
-
- protected virtual void OnGotFocus(EventArgs e) {
- if (GotFocus!=null) GotFocus(this, e);
- }
- protected virtual void OnHandleCreated(EventArgs e) {
- if (HandleCreated!=null) HandleCreated(this, e);
- }
- protected virtual void OnHandleDestroyed(EventArgs e) {
- if (HandleDestroyed!=null) HandleDestroyed(this, e);
- }
- protected virtual void OnHelpRequested(HelpEventArgs hevent) {
- if (HelpRequested!=null) HelpRequested(this, hevent);
- }
- protected virtual void OnImeModeChanged(EventArgs e) {
- if (ImeModeChanged!=null) ImeModeChanged(this, e);
- }
- protected virtual void OnInvalidated(InvalidateEventArgs e) {
- if (Invalidated!=null) Invalidated(this, e);
- }
- protected virtual void OnKeyDown(KeyEventArgs e) {
- if (KeyDown!=null) KeyDown(this, e);
- }
- protected virtual void OnKeyUp(KeyEventArgs e) {
- if (KeyUp!=null) KeyUp(this, e);
- }
- protected virtual void OnLayout(LayoutEventArgs levent) {
- if (Layout!=null) Layout(this, levent);
- }
- protected virtual void OnLeave(EventArgs e) {
- if (Leave!=null) Leave(this, e);
- }
- protected virtual void OnLocationChanged(EventArgs e) {
- if (LocationChanged!=null) LocationChanged(this, e);
- }
- protected virtual void OnLostFocus(EventArgs e) {
- if (LostFocus!=null) LostFocus(this, e);
- }
- protected virtual void OnMouseDown(MouseEventArgs e) {
- if (MouseDown!=null) MouseDown(this, e);
- }
- protected virtual void OnMouseEnter(EventArgs e) {
- if (MouseEnter!=null) MouseEnter(this, e);
- }
- protected virtual void OnMouseHover(EventArgs e) {
- if (MouseHover!=null) MouseHover(this, e);
- }
- protected virtual void OnMouseLeave(EventArgs e) {
- if (MouseLeave!=null) MouseLeave(this, e);
- }
- protected virtual void OnMouseMove(MouseEventArgs e) {
- if (MouseMove!=null) MouseMove(this, e);
- }
- protected virtual void OnMouseUp(MouseEventArgs e) {
- if (MouseUp!=null) MouseUp(this, e);
- }
- protected virtual void OnMouseWheel(MouseEventArgs e) {
- if (MouseWheel!=null) MouseWheel(this, e);
- }
- protected virtual void OnMove(EventArgs e) {
- if (Move!=null) Move(this, e);
- }
- protected virtual void OnNotifyMessage(Message m) {
- // Override me!
- }
- protected virtual void OnPaint(PaintEventArgs e) {
- if (Paint!=null) Paint(this, e);
- }
- protected virtual void OnPaintBackground(PaintEventArgs pevent) {
- // Override me!
- }
- protected virtual void OnParentBackColorChanged(EventArgs e) {
- if (background_color.IsEmpty && background_image==null) {
- Invalidate();
- OnBackColorChanged(e);
- }
- }
- protected virtual void OnParentBackgroundImageChanged(EventArgs e) {
- if (background_color.IsEmpty && background_image==null) {
- Invalidate();
- OnBackgroundImageChanged(e);
- }
- }
- protected virtual void OnParentBindingContextChanged(EventArgs e) {
- if (binding_context==null) {
- binding_context=Parent.binding_context;
- OnBindingContextChanged(e);
- }
- }
- protected virtual void OnParentChanged(EventArgs e) {
- if (ParentChanged!=null) ParentChanged(this, e);
- }
- protected virtual void OnParentEnabledChanged(EventArgs e) {
- if ((is_enabled && !Parent.is_enabled) || (!is_enabled && Parent.is_enabled)) {
- is_enabled=false;
- Invalidate();
- EnabledChanged(this, e);
- }
- }
- protected virtual void OnParentFontChanged(EventArgs e) {
- if (font==null) {
- Invalidate();
- OnFontChanged(e);
- }
- }
- protected virtual void OnParentForeColorChanged(EventArgs e) {
- if (foreground_color.IsEmpty) {
- Invalidate();
- OnForeColorChanged(e);
- }
- }
- protected virtual void OnParentRightToLeftChanged(EventArgs e) {
- if (right_to_left==RightToLeft.Inherit) {
- Invalidate();
- OnRightToLeftChanged(e);
- }
- }
- protected virtual void OnParentVisibleChanged(EventArgs e) {
- if (is_visible!=Parent.is_visible) {
- is_visible=false;
- Invalidate();
- OnVisibleChanged(e);
- }
- }
- protected virtual void OnQueryContinueDrag(QueryContinueDragEventArgs e) {
- if (QueryContinueDrag!=null) QueryContinueDrag(this, e);
- }
- protected virtual void OnResize(EventArgs e) {
- if (Resize!=null) Resize(this, e);
- }
- protected virtual void OnRightToLeftChanged(EventArgs e) {
- if (RightToLeftChanged!=null) RightToLeftChanged(this, e);
- for (int i=0; i<num_of_children; i++) children[i].OnParentRightToLeftChanged(e);
- }
- protected virtual void OnSizeChanged(EventArgs e) {
- OnResize(e);
- if (SizeChanged!=null) SizeChanged(this, e);
- }
- protected virtual void OnStyleChanged(EventArgs e) {
- if (StyleChanged!=null) StyleChanged(this, e);
- }
- protected virtual void OnSystemColorsChanged(EventArgs e) {
- if (SystemColorsChanged!=null) SystemColorsChanged(this, e);
- }
- protected virtual void OnTabIndexChanged(EventArgs e) {
- if (TabIndexChanged!=null) TabIndexChanged(this, e);
- }
- protected virtual void OnTabStopChanged(EventArgs e) {
- if (TabStopChanged!=null) TabStopChanged(this, e);
- }
- protected virtual void OnTextChanged(EventArgs e) {
- if (TextChanged!=null) TextChanged(this, e);
- }
- protected virtual void OnValidated(EventArgs e) {
- if (Validated!=null) Validated(this, e);
- }
- protected virtual void OnValidating(System.ComponentModel.CancelEventArgs e) {
- if (Validating!=null) Validating(this, e);
- }
- protected virtual void OnVisibleChanged(EventArgs e) {
- if (VisibleChanged!=null) VisibleChanged(this, e);
- }
- #endregion // OnXXX methods
- #region Events
- public event EventHandler BackColorChanged;
- public event EventHandler BackgroundImageChanged;
- public event EventHandler BindingContextChanged;
- public event EventHandler CausesValidationChanged;
- public event UICuesEventHandler ChangeUICues;
- public event EventHandler Click;
- public event EventHandler ContextMenuChanged;
- public event ControlEventHandler ControlAdded;
- public event ControlEventHandler ControlRemoved;
- public event EventHandler CursorChanged;
- public event EventHandler DockChanged;
- public event EventHandler DoubleClick;
- public event DragEventHandler DragDrop;
- public event DragEventHandler DragEnter;
- public event EventHandler DragLeave;
- public event DragEventHandler DragOver;
- public event EventHandler EnabledChanged;
- public event EventHandler Enter;
- public event EventHandler FontChanged;
- public event EventHandler ForeColorChanged;
- public event GiveFeedbackEventHandler GiveFeedback;
- public event EventHandler GotFocus;
- public event EventHandler HandleCreated;
- public event EventHandler HandleDestroyed;
- public event HelpEventHandler HelpRequested;
- public event EventHandler ImeModeChanged;
- public event InvalidateEventHandler Invalidated;
- public event KeyEventHandler KeyDown;
- public event KeyPressEventHandler KeyPress;
- public event KeyEventHandler KeyUp;
- public event LayoutEventHandler Layout;
- public event EventHandler Leave;
- public event EventHandler LocationChanged;
- public event EventHandler LostFocus;
- public event MouseEventHandler MouseDown;
- public event EventHandler MouseEnter;
- public event EventHandler MouseHover;
- public event EventHandler MouseLeave;
- public event MouseEventHandler MouseMove;
- public event MouseEventHandler MouseUp;
- public event MouseEventHandler MouseWheel;
- public event EventHandler Move;
- public event PaintEventHandler Paint;
- public event EventHandler ParentChanged;
- public event QueryAccessibilityHelpEventHandler QueryAccessibilityHelp;
- public event QueryContinueDragEventHandler QueryContinueDrag;
- public event EventHandler Resize;
- public event EventHandler RightToLeftChanged;
- public event EventHandler SizeChanged;
- public event EventHandler StyleChanged;
- public event EventHandler SystemColorsChanged;
- public event EventHandler TabIndexChanged;
- public event EventHandler TabStopChanged;
- public event EventHandler TextChanged;
- public event EventHandler Validated;
- public event CancelEventHandler Validating;
- public event EventHandler VisibleChanged;
- #endregion // Events
-
- #region Private Methods
- internal static int LowOrder (int param)
- {
- return (param & 0xffff);
- }
- internal static int HighOrder (int param)
- {
- return (param >> 16);
- }
-
- internal static MouseButtons FromParamToMouseButtons (int param)
- {
- MouseButtons buttons = MouseButtons.None;
-
- if ((param & (int) MsgButtons.MK_LBUTTON) != 0)
- buttons |= MouseButtons.Left;
-
- if ((param & (int) MsgButtons.MK_MBUTTON) != 0)
- buttons |= MouseButtons.Middle;
-
- if ((param & (int) MsgButtons.MK_RBUTTON) != 0)
- buttons |= MouseButtons.Right;
-
- return buttons;
- }
- #endregion
- }
- }
|