| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229 |
- // 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-2005 Novell, Inc.
- //
- // Authors:
- // Peter Bartok [email protected]
- //
- // Partially based on work by:
- // Aleksey Ryabchuk [email protected]
- // Alexandre Pigolkine [email protected]
- // Dennis Hayes [email protected]
- // Jaak Simm [email protected]
- // John Sohn [email protected]
- //
- // COMPLETE
- using System;
- using System.ComponentModel;
- using System.ComponentModel.Design;
- using System.ComponentModel.Design.Serialization;
- using System.Collections;
- using System.Diagnostics;
- using System.Drawing;
- using System.Reflection;
- using System.Runtime.InteropServices;
- using System.Security;
- using System.Threading;
- namespace System.Windows.Forms
- {
- [Designer("System.Windows.Forms.Design.ControlDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
- [DefaultProperty("Text")]
- [DefaultEvent("Click")]
- [DesignerSerializer("System.Windows.Forms.Design.ControlCodeDomSerializer, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
- [ToolboxItemFilter("System.Windows.Forms")]
- public class Control : Component, ISynchronizeInvoke, IWin32Window
- {
- #region Local Variables
- // Basic
- internal Rectangle bounds; // bounding rectangle for control (client area + decorations)
- internal object creator_thread; // thread that created the control
- internal ControlNativeWindow window; // object for native window handle
- internal string name; // for object naming
- // State
- private bool create_handled; // true if OnCreateControl has been sent
- internal bool has_focus; // true if control has focus
- internal bool is_visible; // true if control is visible
- internal bool is_entered; // is the mouse inside the control?
- internal bool is_enabled; // true if control is enabled (usable/not grayed out)
- internal bool is_selected; // true if control is selected
- internal bool is_accessible; // true if the control is visible to accessibility applications
- internal bool is_captured; // tracks if the control has captured the mouse
- internal bool is_toplevel; // tracks if the control is a toplevel window
- internal bool is_recreating; // tracks if the handle for the control is being recreated
- internal bool causes_validation; // tracks if validation is executed on changes
- internal int tab_index; // position in tab order of siblings
- internal bool tab_stop = true; // is the control a tab stop?
- internal bool is_disposed; // has the window already been disposed?
- internal Size client_size; // size of the client area (window excluding decorations)
- internal Rectangle client_rect; // rectangle with the client area (window excluding decorations)
- internal ControlStyles control_style; // rather win32-specific, style bits for control
- internal ImeMode ime_mode = ImeMode.Inherit;
- internal bool layout_pending; // true if our parent needs to re-layout us
- internal object control_tag; // object that contains data about our control
- internal int mouse_clicks; // Counter for mouse clicks
- internal Cursor cursor; // Cursor for the window
- private bool allow_drop; // true if the control accepts droping objects on it
- // 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
- internal BorderStyle border_style; // Border style of control
- // Layout
- internal AnchorStyles anchor_style; // anchoring requirements for our control
- internal DockStyle dock_style; // docking requirements for our control (supercedes anchoring)
- internal SizeF size_ratio; // size ratio of our control to it's parent; required for anchoring
- internal Size prev_size; // previous size of the control; required for anchoring
- // to be categorized...
- static internal ArrayList controls = new ArrayList(); // All of the application's controls, in a flat list
- internal ControlCollection child_controls; // our children
- internal Control parent; // our parent control
- internal AccessibleObject accessibility_object; // object that contains accessibility information about our control
- internal BindingContext binding_context; // TODO
- internal RightToLeft right_to_left; // drawing direction for control
- internal int layout_suspended;
- internal ContextMenu context_menu; // Context menu associated with the control
- private Graphics dc_mem; // Graphics context for double buffering
- private Bitmap bmp_mem; // Bitmap for double buffering control
- private bool needs_redraw = true;
- private ControlBindingsCollection data_bindings;
- #endregion // Local Variables
- #region Private Classes
- // This helper class allows us to dispatch messages to Control.WndProc
- internal class ControlNativeWindow : NativeWindow {
- private Control owner;
- public ControlNativeWindow(Control control) : base() {
- this.owner=control;
- }
- public Control Owner {
- get {
- return owner;
- }
- }
- static internal Control ControlFromHandle(IntPtr hWnd) {
- ControlNativeWindow window;
- window = (ControlNativeWindow)window_collection[hWnd];
- return window.owner;
- }
- protected override void WndProc(ref Message m) {
- owner.WndProc(ref m);
- }
- }
- #endregion
-
- #region Public Classes
- [ComVisible(true)]
- public class ControlAccessibleObject : AccessibleObject {
- #region ControlAccessibleObject Local Variables
- private Control owner;
- #endregion // ControlAccessibleObject Local Variables
- #region ControlAccessibleObject Constructors
- public ControlAccessibleObject(Control ownerControl) {
- this.owner = ownerControl;
- }
- #endregion // ControlAccessibleObject Constructors
- #region ControlAccessibleObject Public Instance Properties
- public override string DefaultAction {
- get {
- return base.DefaultAction;
- }
- }
- public override string Description {
- get {
- return base.Description;
- }
- }
- public IntPtr Handle {
- get {
- return owner.Handle;
- }
- set {
- // We don't want to let them set it
- }
- }
- public override string Help {
- get {
- return base.Help;
- }
- }
- public override string KeyboardShortcut {
- get {
- return base.KeyboardShortcut;
- }
- }
- public override string Name {
- get {
- return base.Name;
- }
- set {
- base.Name = value;
- }
- }
- public Control Owner {
- get {
- return owner;
- }
- }
- public override AccessibleObject Parent {
- get {
- return base.Parent;
- }
- }
- public override AccessibleRole Role {
- get {
- return base.Role;
- }
- }
- #endregion // ControlAccessibleObject Public Instance Properties
- #region ControlAccessibleObject Public Instance Methods
- public override int GetHelpTopic(out string FileName) {
- return base.GetHelpTopic (out FileName);
- }
- [MonoTODO("Implement this and tie it into Control.AccessibilityNotifyClients")]
- public void NotifyClients(AccessibleEvents accEvent) {
- throw new NotImplementedException();
- }
- [MonoTODO("Implement this and tie it into Control.AccessibilityNotifyClients")]
- public void NotifyClients(AccessibleEvents accEvent, int childID) {
- throw new NotImplementedException();
- }
- public override string ToString() {
- return "ControlAccessibleObject: Owner = " + owner.ToString() + ", Text: " + owner.text;
- }
- #endregion // ControlAccessibleObject Public Instance Methods
- }
- [DesignerSerializer("System.Windows.Forms.Design.ControlCollectionCodeDomSerializer, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + Consts.AssemblySystem_Design)]
- [ListBindable(false)]
- public class ControlCollection : IList, ICollection, ICloneable, IEnumerable {
- #region ControlCollection Local Variables
- private ArrayList list;
- private ArrayList impl_list;
- private Control [] all_controls;
- internal Control owner;
- #endregion // ControlCollection Local Variables
- #region ControlCollection Public Constructor
- public ControlCollection(Control owner) {
- this.owner=owner;
- this.list=new ArrayList();
- }
- #endregion
- #region ControlCollection Public Instance Properties
- public int Count {
- get {
- return list.Count;
- }
- }
- public bool IsReadOnly {
- get {
- return list.IsReadOnly;
- }
- }
- public virtual Control this[int index] {
- get {
- if (index < 0 || index >= list.Count) {
- throw new ArgumentOutOfRangeException("index", index, "ControlCollection does not have that many controls");
- }
- return (Control)list[index];
- }
- }
- #endregion // ControlCollection Public Instance Properties
-
- #region ControlCollection Private Instance Methods
- public virtual void Add (Control value)
- {
- if (value == null)
- return;
-
- if (Contains (value))
- return;
- if (value.tab_index == -1) {
- int end;
- int index;
- int use;
- use = 0;
- end = owner.child_controls.Count;
- for (int i = 0; i < end; i++) {
- index = owner.child_controls[i].tab_index;
- if (index >= use) {
- use = index + 1;
- }
- }
- value.tab_index = use;
- }
- all_controls = null;
- list.Add (value);
- value.Parent = owner;
- owner.UpdateZOrder();
- owner.OnControlAdded(new ControlEventArgs(value));
- }
-
- internal void AddToList (Control c)
- {
- all_controls = null;
- list.Add (c);
- }
- internal virtual void AddImplicit (Control control)
- {
- if (impl_list == null)
- impl_list = new ArrayList ();
- all_controls = null;
- impl_list.Add (control);
- control.Parent = owner;
- owner.UpdateZOrder ();
- }
- public virtual void AddRange (Control[] controls)
- {
- if (controls == null)
- throw new ArgumentNullException ("controls");
- owner.SuspendLayout ();
- try {
- for (int i = 0; i < controls.Length; i++)
- Add (controls[i]);
- } finally {
- owner.ResumeLayout ();
- }
- }
- internal virtual void AddRangeImplicit (Control [] controls)
- {
- if (controls == null)
- throw new ArgumentNullException ("controls");
- owner.SuspendLayout ();
- try {
- for (int i = 0; i < controls.Length; i++)
- AddImplicit (controls [i]);
- } finally {
- owner.ResumeLayout ();
- }
- }
- public virtual void Clear ()
- {
- owner.SuspendLayout();
- all_controls = null;
- for (int i = 0; i < list.Count; i++) {
- owner.OnControlRemoved(new ControlEventArgs((Control)list[i]));
- }
- list.Clear();
- owner.ResumeLayout();
- }
- internal virtual void ClearImplicit ()
- {
- if (impl_list == null)
- return;
- all_controls = null;
- impl_list.Clear ();
- }
- public bool Contains (Control value)
- {
- for (int i = list.Count; i > 0; ) {
- i--;
-
- if (list [i] == value) {
- // Do we need to do anything here?
- return true;
- }
- }
- return false;
- }
- internal bool ImplicitContains (Control value)
- {
- if (impl_list == null)
- return false;
- for (int i = impl_list.Count; i > 0; ) {
- i--;
-
- if (impl_list [i] == value) {
- // Do we need to do anything here?
- return true;
- }
- }
- return false;
- }
- internal bool AllContains (Control value)
- {
- return Contains (value) || ImplicitContains (value);
- }
- public void CopyTo (Array array, int index)
- {
- list.CopyTo(array, index);
- }
- 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=list.IndexOf(child);
- if (index==-1 && throwException) {
- throw new ArgumentException("Not a child control", "child");
- }
- return index;
- }
- public IEnumerator GetEnumerator() {
- return list.GetEnumerator();
- }
- internal IEnumerator GetAllEnumerator ()
- {
- Control [] res = GetAllControls ();
- return res.GetEnumerator ();
- }
- internal Control [] GetAllControls ()
- {
- if (all_controls != null)
- return all_controls;
- if (impl_list == null)
- return (Control []) list.ToArray (typeof (Control));
- Control [] res = new Control [list.Count + impl_list.Count];
- list.CopyTo (res);
- impl_list.CopyTo (res, list.Count);
- return res;
- }
- public override int GetHashCode() {
- return base.GetHashCode();
- }
- public int IndexOf(Control control) {
- return list.IndexOf(control);
- }
- public virtual void Remove(Control value) {
- all_controls = null;
- owner.OnControlRemoved(new ControlEventArgs(value));
- list.Remove(value);
- value.parent = null;
- owner.UpdateZOrder();
- }
- internal virtual void RemoveImplicit (Control control)
- {
- if (impl_list != null) {
- all_controls = null;
- impl_list.Remove (control);
- }
- control.Parent = null;
- owner.UpdateZOrder ();
- }
- public void RemoveAt(int index) {
- if (index < 0 || index >= list.Count) {
- throw new ArgumentOutOfRangeException("index", index, "ControlCollection does not have that many controls");
- }
- Remove ((Control)list[index]);
- }
- public void SetChildIndex(Control child, int newIndex) {
- int old_index;
- old_index=list.IndexOf(child);
- if (old_index==-1) {
- throw new ArgumentException("Not a child control", "child");
- }
- if (old_index==newIndex) {
- return;
- }
- RemoveAt(old_index);
- if (newIndex>list.Count) {
- list.Add(child);
- } else {
- list.Insert(newIndex, child);
- }
- child.parent = owner;
- owner.UpdateZOrder();
- }
- #endregion // ControlCollection Private Instance Methods
- #region ControlCollection Interface Properties
- object IList.this[int index] {
- get {
- if (index<0 || index>=list.Count) {
- throw new ArgumentOutOfRangeException("index", index, "ControlCollection does not have that many controls");
- }
- return this[index];
- }
- set {
- if (!(value is Control)) {
- throw new ArgumentException("Object of type Control required", "value");
- }
- list[index]=(Control)value;
- }
- }
- bool IList.IsFixedSize {
- get {
- return false;
- }
- }
- bool IList.IsReadOnly {
- get {
- return list.IsReadOnly;
- }
- }
- bool ICollection.IsSynchronized {
- get {
- return list.IsSynchronized;
- }
- }
- object ICollection.SyncRoot {
- get {
- return list.SyncRoot;
- }
- }
- #endregion // ControlCollection Interface Properties
- #region ControlCollection Interface Methods
- int IList.Add(object value) {
- if (value == null) {
- throw new ArgumentNullException("value", "Cannot add null controls");
- }
- if (!(value is Control)) {
- throw new ArgumentException("Object of type Control required", "value");
- }
- return list.Add(value);
- }
- bool IList.Contains(object value) {
- if (!(value is Control)) {
- throw new ArgumentException("Object of type Control required", "value");
- }
- return this.Contains((Control) value);
- }
- int IList.IndexOf(object value) {
- if (!(value is Control)) {
- throw new ArgumentException("Object of type Control required", "value");
- }
- return this.IndexOf((Control) value);
- }
- void IList.Insert(int index, object value) {
- if (!(value is Control)) {
- throw new ArgumentException("Object of type Control required", "value");
- }
- all_controls = null;
- list.Insert(index, value);
- }
- void IList.Remove(object value) {
- if (!(value is Control)) {
- throw new ArgumentException("Object of type Control required", "value");
- }
- all_controls = null;
- list.Remove(value);
- }
- void ICollection.CopyTo(Array array, int index) {
- if (list.Count>0) {
- list.CopyTo(array, index);
- }
- }
- Object ICloneable.Clone() {
- ControlCollection clone = new ControlCollection(this.owner);
- clone.list=(ArrayList)list.Clone(); // FIXME: Do we need this?
- return clone;
- }
- #endregion // ControlCollection Interface Methods
- }
- #endregion // ControlCollection Class
-
- #region Public Constructors
- public Control() {
- creator_thread = Thread.CurrentThread;
- prev_size = Size.Empty;
- anchor_style = AnchorStyles.Top | AnchorStyles.Left;
- create_handled = false;
- is_visible = true;
- is_captured = false;
- is_disposed = false;
- is_enabled = true;
- is_entered = false;
- layout_pending = false;
- is_toplevel = false;
- causes_validation = true;
- has_focus = false;
- layout_suspended = 0;
- mouse_clicks = 1;
- tab_index = -1;
- cursor = null;
- right_to_left = RightToLeft.Inherit;
- border_style = BorderStyle.None;
- background_color = Color.Empty;
- control_style = ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint |
- ControlStyles.Selectable | ControlStyles.StandardClick |
- ControlStyles.StandardDoubleClick;
- parent = null;
- background_image = null;
- text = string.Empty;
- name = string.Empty;
- window = new ControlNativeWindow(this);
- child_controls = CreateControlsInstance();
- client_size = new Size(DefaultSize.Width, DefaultSize.Height);
- client_rect = new Rectangle(0, 0, DefaultSize.Width, DefaultSize.Height);
- XplatUI.CalculateWindowRect(IntPtr.Zero, ref client_rect, CreateParams.Style, CreateParams.ExStyle, IntPtr.Zero, out bounds);
- if ((CreateParams.Style & (int)WindowStyles.WS_CHILD) == 0) {
- bounds.X=-1;
- bounds.Y=-1;
- }
- }
- 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;
- bounds.X=left;
- bounds.Y=top;
- bounds.Width=width;
- bounds.Height=height;
- SetBoundsCore(left, top, width, height, BoundsSpecified.All);
- Text=text;
- }
- public Control(string text) : this() {
- Text=text;
- }
- public Control(string text, int left, int top, int width, int height) : this() {
- bounds.X=left;
- bounds.Y=top;
- bounds.Width=width;
- bounds.Height=height;
- SetBoundsCore(left, top, width, height, BoundsSpecified.All);
- Text=text;
- }
- protected override void Dispose(bool disposing) {
- is_disposed = true;
- if (dc_mem!=null) {
- dc_mem.Dispose();
- dc_mem=null;
- }
- if (bmp_mem!=null) {
- bmp_mem.Dispose();
- bmp_mem=null;
- }
- DestroyHandle();
- controls.Remove(this);
- }
- #endregion // Public Constructors
- #region Internal Properties
- internal BorderStyle InternalBorderStyle {
- get {
- return border_style;
- }
- set {
- if (!Enum.IsDefined (typeof (BorderStyle), value))
- throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for BorderStyle", value));
- if (border_style != value) {
- border_style = value;
- if (IsHandleCreated) {
- XplatUI.SetBorderStyle(window.Handle, (FormBorderStyle)border_style);
- Refresh();
- }
- }
- }
- }
- #endregion // Internal Properties
- #region Private & Internal Methods
- internal IAsyncResult BeginInvokeInternal (Delegate method, object [] args) {
- AsyncMethodResult result;
- AsyncMethodData data;
- Control p;
- p = this;
- do {
- if (!p.IsHandleCreated) {
- throw new InvalidOperationException("Cannot call Invoke or InvokeAsync on a control until the window handle is created");
- }
- p = p.parent;
- } while (p != null);
- result = new AsyncMethodResult ();
- data = new AsyncMethodData ();
- data.Method = method;
- data.Args = args;
- data.Result = new WeakReference (result);
- #if NET_2_0
- if (!ExecutionContext.IsFlowSuppressed ()) {
- data.Context = ExecutionContext.Capture ();
- }
- #else
- #if !MWF_ON_MSRUNTIME
- if (SecurityManager.SecurityEnabled) {
- data.Stack = CompressedStack.GetCompressedStack ();
- }
- #endif
- #endif
- XplatUI.SendAsyncMethod (data);
- return result;
- }
- internal Graphics DeviceContext {
- get {
- if (dc_mem==null) {
- CreateBuffers(this.Width, this.Height);
- }
- return dc_mem;
- }
- }
- private Bitmap ImageBuffer {
- get {
- if (bmp_mem==null) {
- CreateBuffers(this.Width, this.Height);
- }
- return bmp_mem;
- }
- }
- internal void CreateBuffers (int width, int height) {
- if (dc_mem != null) {
- dc_mem.Dispose ();
- }
- if (bmp_mem != null)
- bmp_mem.Dispose ();
- if (width < 1) {
- width = 1;
- }
- if (height < 1) {
- height = 1;
- }
- bmp_mem = new Bitmap (width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
- dc_mem = Graphics.FromImage (bmp_mem);
- needs_redraw = true;
- }
- internal void InvalidateBuffers ()
- {
- if (dc_mem != null) {
- dc_mem.Dispose ();
- }
- if (bmp_mem != null)
- bmp_mem.Dispose ();
- dc_mem = null;
- bmp_mem = null;
- needs_redraw = true;
- }
- internal static void SetChildColor(Control parent) {
- Control child;
- for (int i=0; i < parent.child_controls.Count; i++) {
- child=parent.child_controls[i];
- if (child.child_controls.Count>0) {
- SetChildColor(child);
- }
- }
-
- }
- internal bool Select(Control control) {
- Control parent;
- IContainerControl container;
- if (control == null) {
- return false;
- }
- parent = control.parent;
- if (((control.control_style & ControlStyles.Selectable) !=0) && (parent != null)) {
- while (parent != null) {
- if (!parent.Visible || !parent.is_enabled) {
- return false;
- }
- parent = parent.parent;
- }
- }
- control.is_selected = true;
- container = GetContainerControl();
- if (container != null) {
- container.ActiveControl = control;
- }
- if (control.IsHandleCreated) {
- XplatUI.SetFocus(control.window.Handle);
- }
- return true;
- }
- internal virtual void DoDefaultAction() {
- // Only here to be overriden by our actual controls; this is needed by the accessibility class
- }
- internal static int LowOrder (int param) {
- return ((int)(short)(param & 0xffff));
- }
- internal static int HighOrder (int param) {
- return ((int)(short)(param >> 16));
- }
- // This method exists so controls overriding OnPaintBackground can have default background painting done
- internal virtual void PaintControlBackground (PaintEventArgs pevent)
- {
- if (background_image == null) {
- pevent.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(BackColor), new Rectangle(pevent.ClipRectangle.X - 1, pevent.ClipRectangle.Y - 1, pevent.ClipRectangle.Width + 2, pevent.ClipRectangle.Height + 2));
- return;
- }
- DrawBackgroundImage (pevent.Graphics);
- }
- void DrawBackgroundImage (Graphics g)
- {
- using (TextureBrush b = new TextureBrush (background_image)) {
- g.FillRectangle (b, ClientRectangle);
- }
- }
- internal void DndEnter (DragEventArgs e)
- {
- OnDragEnter (e);
- }
- internal void DndOver (DragEventArgs e)
- {
- OnDragOver (e);
- }
- internal void DndDrop (DragEventArgs e)
- {
- OnDragDrop (e);
- }
- internal void DndLeave (EventArgs e)
- {
- OnDragLeave (e);
- }
- internal void DnDFeedback(GiveFeedbackEventArgs e)
- {
- OnGiveFeedback(e);
- }
- internal void DnDContinueDrag(QueryContinueDragEventArgs e) {
- OnQueryContinueDrag(e);
- }
-
- 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;
- }
- internal virtual bool ProcessControlMnemonic(char charCode) {
- return ProcessMnemonic(charCode);
- }
- private static Control FindFlatForward(Control container, Control start) {
- Control found;
- int index;
- int end;
- found = null;
- end = container.child_controls.Count;
- if (start != null) {
- index = start.tab_index;
- } else {
- index = -1;
- }
- for (int i = 0; i < end; i++) {
- if (found == null) {
- if (container.child_controls[i].tab_index > index) {
- found = container.child_controls[i];
- }
- } else if (found.tab_index > container.child_controls[i].tab_index) {
- if (container.child_controls[i].tab_index > index) {
- found = container.child_controls[i];
- }
- }
- }
- return found;
- }
- private static Control FindControlForward(Control container, Control start) {
- Control found;
- Control p;
- found = null;
- if (start != null) {
- if ((start is IContainerControl) || start.GetStyle(ControlStyles.ContainerControl)) {
- found = FindControlForward(start, null);
- if (found != null) {
- return found;
- }
- }
- p = start.parent;
- while (p != container) {
- found = FindFlatForward(p, start);
- if (found != null) {
- return found;
- }
- start = p;
- p = p.parent;
- }
- }
- return FindFlatForward(container, start);
- }
- private static Control FindFlatBackward(Control container, Control start) {
- Control found;
- int index;
- int end;
- found = null;
- end = container.child_controls.Count;
- if (start != null) {
- index = start.tab_index;
- } else {
- // FIXME: Possible speed-up: Keep the highest taborder index in the container
- index = -1;
- for (int i = 0; i < end; i++) {
- if (container.child_controls[i].tab_index > index) {
- index = container.child_controls[i].tab_index;
- }
- }
- index++;
- }
- for (int i = 0; i < end; i++) {
- if (found == null) {
- if (container.child_controls[i].tab_index < index) {
- found = container.child_controls[i];
- }
- } else if (found.tab_index < container.child_controls[i].tab_index) {
- if (container.child_controls[i].tab_index < index) {
- found = container.child_controls[i];
- }
- }
- }
- return found;
- }
- private static Control FindControlBackward(Control container, Control start) {
- Control found;
- found = null;
- if (start != null) {
- found = FindFlatBackward(start.parent, start);
- if (found == null && start.parent != container) {
- return start.parent;
- }
- }
- if (found == null) {
- found = FindFlatBackward(container, start);
- }
- while ((found != null) && ((found is IContainerControl) || found.GetStyle(ControlStyles.ContainerControl))) {
- found = FindControlBackward(found, null);
- if (found != null) {
- return found;
- }
- }
- return found;
- }
- private void HandleClick(int clicks) {
- if (GetStyle(ControlStyles.StandardClick)) {
- if (clicks > 1) {
- if (GetStyle(ControlStyles.StandardDoubleClick)) {
- OnDoubleClick(EventArgs.Empty);
- } else {
- OnClick(EventArgs.Empty);
- }
- } else {
- OnClick(EventArgs.Empty);
- }
- }
- }
- private void CheckDataBindings ()
- {
- if (data_bindings == null)
- return;
- BindingContext binding_context = BindingContext;
- foreach (Binding binding in data_bindings) {
- binding.Check (binding_context);
- }
- }
- #endregion // Private & Internal Methods
- #region Public Static Properties
- public static Color DefaultBackColor {
- get {
- return ThemeEngine.Current.DefaultControlBackColor;
- }
- }
- public static Font DefaultFont {
- get {
- return ThemeEngine.Current.DefaultFont;
- }
- }
- public static Color DefaultForeColor {
- get {
- return ThemeEngine.Current.DefaultControlForeColor;
- }
- }
- public static Keys ModifierKeys {
- get {
- return XplatUI.State.ModifierKeys;
- }
- }
- public static MouseButtons MouseButtons {
- get {
- return XplatUI.State.MouseButtons;
- }
- }
- public static Point MousePosition {
- get {
- return Cursor.Position;
- }
- }
-
- #if NET_2_0
- [MonoTODO]
- public static bool CheckForIllegalCrossThreadCalls
- {
- set {
- }
- get {
- return false;
- }
- }
- #endif
- #endregion // Public Static Properties
- #region Public Instance Properties
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public AccessibleObject AccessibilityObject {
- get {
- if (accessibility_object==null) {
- accessibility_object=CreateAccessibilityInstance();
- }
- return accessibility_object;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public string AccessibleDefaultActionDescription {
- get {
- return AccessibilityObject.default_action;
- }
- set {
- AccessibilityObject.default_action=value;
- }
- }
- [Localizable(true)]
- [DefaultValue(null)]
- public string AccessibleDescription {
- get {
- return AccessibilityObject.description;
- }
- set {
- AccessibilityObject.description=value;
- }
- }
- [Localizable(true)]
- [DefaultValue(null)]
- public string AccessibleName {
- get {
- return AccessibilityObject.Name;
- }
- set {
- AccessibilityObject.Name=value;
- }
- }
- [DefaultValue(AccessibleRole.Default)]
- [MWFDescription("Role of the control"), MWFCategory("Accessibility")]
- public AccessibleRole AccessibleRole {
- get {
- return AccessibilityObject.role;
- }
- set {
- AccessibilityObject.role=value;
- }
- }
- [DefaultValue(false)]
- public virtual bool AllowDrop {
- get {
- return allow_drop;
- }
- set {
- if (allow_drop == value)
- return;
- allow_drop = value;
- UpdateStyles();
- XplatUI.SetAllowDrop (Handle, value);
- }
- }
- [Localizable(true)]
- [RefreshProperties(RefreshProperties.Repaint)]
- [DefaultValue(AnchorStyles.Top | AnchorStyles.Left)]
- public virtual AnchorStyles Anchor {
- get {
- return anchor_style;
- }
- set {
- anchor_style=value;
- if (parent != null) {
- parent.PerformLayout(this, "Parent");
- }
- }
- }
- [DispId(-501)]
- public virtual Color BackColor {
- get {
- if (background_color.IsEmpty) {
- if (parent!=null) {
- return parent.BackColor;
- }
- return DefaultBackColor;
- }
- return background_color;
- }
- set {
- background_color=value;
- SetChildColor(this);
- OnBackColorChanged(EventArgs.Empty);
- Invalidate();
- }
- }
- [Localizable(true)]
- [DefaultValue(null)]
- public virtual Image BackgroundImage {
- get {
- return background_image;
- }
- set {
- if (background_image!=value) {
- background_image=value;
- OnBackgroundImageChanged(EventArgs.Empty);
- }
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public virtual BindingContext BindingContext {
- get {
- if (binding_context != null)
- return binding_context;
- if (Parent == null)
- return null;
- binding_context = Parent.BindingContext;
- return binding_context;
- }
- set {
- if (binding_context != value) {
- binding_context = value;
- OnBindingContextChanged(EventArgs.Empty);
- }
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public int Bottom {
- get {
- return bounds.Y+bounds.Height;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public Rectangle Bounds {
- get {
- return this.bounds;
- }
- set {
- SetBoundsCore(value.Left, value.Top, value.Width, value.Height, BoundsSpecified.All);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool CanFocus {
- get {
- if (Visible && is_enabled && GetStyle(ControlStyles.Selectable)) {
- return true;
- }
- return false;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool CanSelect {
- get {
- Control parent;
- if (!GetStyle(ControlStyles.Selectable) || this.parent == null) {
- return false;
- }
- parent = this.parent;
- while (parent != null) {
- if (!parent.is_visible || !parent.is_enabled) {
- return false;
- }
- parent = parent.parent;
- }
- return true;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool Capture {
- get {
- return this.is_captured;
- }
- set {
- if (this.IsHandleCreated) {
- if (value && !is_captured) {
- is_captured = true;
- XplatUI.GrabWindow(this.window.Handle, IntPtr.Zero);
- } else if (!value && is_captured) {
- XplatUI.UngrabWindow(this.window.Handle);
- is_captured = false;
- }
- }
- }
- }
- [DefaultValue(true)]
- public bool CausesValidation {
- get {
- return this.causes_validation;
- }
- set {
- if (this.causes_validation != value) {
- causes_validation = value;
- OnCausesValidationChanged(EventArgs.Empty);
- }
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public Rectangle ClientRectangle {
- get {
- client_rect.Width = client_size.Width;
- client_rect.Height = client_size.Height;
- return client_rect;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public Size ClientSize {
- get {
- #if notneeded
- if ((this is Form) && (((Form)this).form_parent_window != null)) {
- return ((Form)this).form_parent_window.ClientSize;
- }
- #endif
- return client_size;
- }
- set {
- this.SetClientSizeCore(value.Width, value.Height);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- [DescriptionAttribute("ControlCompanyNameDescr")]
- public String CompanyName {
- get {
- return "Mono Project, Novell, Inc.";
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool ContainsFocus {
- get {
- if (this.Focused) {
- return true;
- }
- for (int i=0; i < child_controls.Count; i++) {
- if (child_controls[i].ContainsFocus) {
- return true;
- }
- }
- return false;
- }
- }
- [DefaultValue(null)]
- public virtual ContextMenu ContextMenu {
- get {
- return context_menu;
- }
- set {
- if (context_menu != value) {
- context_menu = value;
- OnContextMenuChanged(EventArgs.Empty);
- }
- }
- }
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- public ControlCollection Controls {
- get {
- return this.child_controls;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool Created {
- get {
- if (!this.is_disposed && (this.window.Handle != IntPtr.Zero)) {
- return true;
- }
- return false;
- }
- }
- [AmbientValue(null)]
- public virtual Cursor Cursor {
- get {
- if (cursor != null) {
- return cursor;
- }
- if (parent != null) {
- return parent.Cursor;
- }
- return Cursors.Default;
- }
- set {
- if (cursor != value) {
- Point pt;
- cursor = value;
-
- pt = Cursor.Position;
- if (bounds.Contains(pt)) {
- if (GetChildAtPoint(pt) == null) {
- if (cursor != null) {
- XplatUI.SetCursor(window.Handle, cursor.handle);
- } else {
- if (parent != null) {
- XplatUI.SetCursor(window.Handle, parent.Cursor.handle);
- } else {
- XplatUI.SetCursor(window.Handle, Cursors.def.handle);
- }
- }
- }
- }
- OnCursorChanged(EventArgs.Empty);
- }
- }
- }
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
- [ParenthesizePropertyName(true)]
- [RefreshProperties(RefreshProperties.All)]
- public ControlBindingsCollection DataBindings {
- get {
- if (data_bindings == null)
- data_bindings = new ControlBindingsCollection (this);
- return data_bindings;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public virtual Rectangle DisplayRectangle {
- get {
- return ClientRectangle;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool Disposing {
- get {
- return is_disposed;
- }
- }
- [Localizable(true)]
- [RefreshProperties(RefreshProperties.Repaint)]
- [DefaultValue(DockStyle.None)]
- public virtual DockStyle Dock {
- get {
- return dock_style;
- }
- set {
- if (dock_style == value) {
- return;
- }
- dock_style = value;
- if (parent != null) {
- parent.PerformLayout(this, "Parent");
- }
- OnDockChanged(EventArgs.Empty);
- }
- }
- [DispId(-514)]
- [Localizable(true)]
- public bool Enabled {
- get {
- return is_enabled;
- }
- set {
- if (is_enabled == value) {
- return;
- }
- is_enabled = value;
- Refresh();
- OnEnabledChanged (EventArgs.Empty);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public virtual bool Focused {
- get {
- return this.has_focus;
- }
- }
- [DispId(-512)]
- [AmbientValue(null)]
- [Localizable(true)]
- public virtual Font Font {
- get {
- if (font != null) {
- return font;
- }
- if (Parent != null && Parent.Font != null) {
- return Parent.Font;
- }
- return DefaultFont;
- }
- set {
- if (font != null && font.Equals (value)) {
- return;
- }
- font = value;
- Invalidate();
- OnFontChanged (EventArgs.Empty);
- }
- }
- [DispId(-513)]
- public virtual Color ForeColor {
- get {
- if (foreground_color.IsEmpty) {
- if (parent!=null) {
- return parent.ForeColor;
- }
- return DefaultForeColor;
- }
- return foreground_color;
- }
- set {
- if (foreground_color != value) {
- foreground_color=value;
- Invalidate();
- OnForeColorChanged(EventArgs.Empty);
- }
- }
- }
- [DispId(-515)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public IntPtr Handle { // IWin32Window
- get {
- if (!IsHandleCreated) {
- CreateHandle();
- }
- return window.Handle;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool HasChildren {
- get {
- if (this.child_controls.Count>0) {
- return true;
- }
- return false;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Always)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public int Height {
- get {
- return this.bounds.Height;
- }
- set {
- SetBoundsCore(bounds.X, bounds.Y, bounds.Width, value, BoundsSpecified.Height);
- }
- }
- [AmbientValue(ImeMode.Inherit)]
- [Localizable(true)]
- public ImeMode ImeMode {
- get {
- if (ime_mode == DefaultImeMode) {
- if (parent != null)
- return parent.ImeMode;
- else
- return ImeMode.NoControl; // default value
- }
- return ime_mode;
- }
- set {
- if (ime_mode != value) {
- ime_mode = value;
- OnImeModeChanged(EventArgs.Empty);
- }
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool InvokeRequired { // ISynchronizeInvoke
- get {
- if (creator_thread!=Thread.CurrentThread) {
- return true;
- }
- return false;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool IsAccessible {
- get {
- return is_accessible;
- }
- set {
- is_accessible = value;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool IsDisposed {
- get {
- return this.is_disposed;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool IsHandleCreated {
- get {
- if ((window!=null) && (window.Handle!=IntPtr.Zero)) {
- return true;
- }
- return false;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Always)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public int Left {
- get {
- return this.bounds.X;
- }
- set {
- SetBoundsCore(value, bounds.Y, bounds.Width, bounds.Height, BoundsSpecified.X);
- }
- }
- [Localizable(true)]
- public Point Location {
- get {
- return new Point(bounds.X, bounds.Y);
- }
- set {
- SetBoundsCore(value.X, value.Y, bounds.Width, bounds.Height, BoundsSpecified.Location);
- }
- }
- [Browsable(false)]
- public string Name {
- get {
- return this.name;
- }
- set {
- this.name=value;
- }
- }
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public Control Parent {
- get {
- return this.parent;
- }
- set {
- if (value == this) {
- throw new ArgumentException("A circular control reference has been made. A control cannot be owned or parented to itself.");
- }
- if (parent!=value) {
- if (value==null) {
- parent.Controls.Remove(this);
- return;
- }
- parent=value;
- if (!parent.Controls.AllContains (this)) {
- Console.WriteLine ("Adding child: " + this);
- parent.Controls.Add(this);
- }
- if (IsHandleCreated) {
- XplatUI.SetParent(Handle, value.Handle);
- }
- OnParentChanged(EventArgs.Empty);
- InitLayout();
- }
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public string ProductName {
- get {
- Type t = typeof (AssemblyProductAttribute);
- Assembly assembly = GetType().Module.Assembly;
- object [] attrs = assembly.GetCustomAttributes (t, false);
- AssemblyProductAttribute a = null;
- // On MS we get a NullRefException if product attribute is not
- // set.
- if (attrs != null && attrs.Length > 0)
- a = (AssemblyProductAttribute) attrs [0];
- return a.Product;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public string ProductVersion {
- get {
- Type t = typeof (AssemblyVersionAttribute);
- Assembly assembly = GetType().Module.Assembly;
- object [] attrs = assembly.GetCustomAttributes (t, false);
- if (attrs == null || attrs.Length < 1)
- return "1.0.0.0";
- return ((AssemblyVersionAttribute)attrs [0]).Version;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool RecreatingHandle {
- get {
- return is_recreating;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public Region Region {
- get {
- return new Region(this.bounds);
- }
- set {
- Graphics g;
- RectangleF r;
- g = this.CreateGraphics();
- r = value.GetBounds(g);
- SetBounds((int)r.X, (int)r.Y, (int)r.Width, (int)r.Height);
- g.Dispose();
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public int Right {
- get {
- return this.bounds.X+this.bounds.Width;
- }
- }
- [AmbientValue(RightToLeft.Inherit)]
- [Localizable(true)]
- public virtual RightToLeft RightToLeft {
- get {
- if (right_to_left == RightToLeft.Inherit) {
- if (parent != null)
- return parent.RightToLeft;
- else
- return RightToLeft.No; // default value
- }
- return right_to_left;
- }
- set {
- if (value != right_to_left) {
- right_to_left = value;
- OnRightToLeftChanged(EventArgs.Empty);
- }
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public override ISite Site {
- get {
- return base.Site;
- }
- set {
- base.Site = value;
- }
- }
- [Localizable(true)]
- public Size Size {
- get {
- return new Size(Width, Height);
- }
- set {
- SetBoundsCore(bounds.X, bounds.Y, value.Width, value.Height, BoundsSpecified.Size);
- }
- }
- [Localizable(true)]
- [MergableProperty(false)]
- public int TabIndex {
- get {
- if (tab_index != -1) {
- return tab_index;
- }
- return 0;
- }
- set {
- if (tab_index != value) {
- tab_index = value;
- OnTabIndexChanged(EventArgs.Empty);
- }
- }
- }
- [DispId(-516)]
- [DefaultValue(true)]
- public bool TabStop {
- get {
- return tab_stop;
- }
- set {
- if (tab_stop != value) {
- tab_stop = value;
- OnTabStopChanged(EventArgs.Empty);
- }
- }
- }
- [Localizable(false)]
- [Bindable(true)]
- [TypeConverter(typeof(StringConverter))]
- [DefaultValue(null)]
- public object Tag {
- get {
- return control_tag;
- }
- set {
- control_tag = value;
- }
- }
- [DispId(-517)]
- [Localizable(true)]
- [BindableAttribute(true)]
- public virtual string Text {
- get {
- // Our implementation ignores ControlStyles.CacheText - we always cache
- return this.text;
- }
- set {
- if (value == null) {
- value = String.Empty;
- }
- if (text!=value) {
- text=value;
- if (IsHandleCreated) {
- XplatUI.Text(Handle, text);
- }
- OnTextChanged (EventArgs.Empty);
- }
- }
- }
- [EditorBrowsable(EditorBrowsableState.Always)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public int Top {
- get {
- return this.bounds.Y;
- }
- set {
- SetBoundsCore(bounds.X, value, bounds.Width, bounds.Height, BoundsSpecified.Y);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public Control TopLevelControl {
- get {
- Control p = this;
- while (p.parent != null) {
- p = p.parent;
- }
- return p;
- }
- }
- [Localizable(true)]
- public bool Visible {
- get {
- if (!is_visible) {
- return false;
- } else if (parent != null) {
- return parent.Visible;
- }
- return true;
- }
- set {
- SetVisibleCore(value);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Always)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public int Width {
- get {
- return this.bounds.Width;
- }
- set {
- SetBoundsCore(bounds.X, bounds.Y, value, bounds.Height, BoundsSpecified.Width);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Never)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public IWindowTarget WindowTarget {
- get {
- return null;
- }
- set {
- ; // MS Internal
- }
- }
- #endregion // Public Instance Properties
- #region Protected Instance Properties
- protected virtual CreateParams CreateParams {
- get {
- CreateParams create_params = new CreateParams();
- try {
- create_params.Caption = Text;
- }
- catch {
- create_params.Caption = text;
- }
- try {
- create_params.X = Left;
- }
- catch {
- create_params.X = this.bounds.X;
- }
- try {
- create_params.Y = Top;
- }
- catch {
- create_params.Y = this.bounds.Y;
- }
- try {
- create_params.Width = Width;
- }
- catch {
- create_params.Width = this.bounds.Width;
- }
- try {
- create_params.Height = Height;
- }
- catch {
- create_params.Height = this.bounds.Height;
- }
- create_params.ClassName = XplatUI.DefaultClassName;
- create_params.ClassStyle = 0;
- create_params.ExStyle = 0;
- create_params.Param = 0;
- if (allow_drop) {
- create_params.ExStyle |= (int)WindowStyles.WS_EX_ACCEPTFILES;
- }
- if (parent!=null) {
- create_params.Parent = parent.Handle;
- }
- create_params.Style = (int)WindowStyles.WS_CHILD | (int)WindowStyles.WS_CLIPCHILDREN | (int)WindowStyles.WS_CLIPSIBLINGS;
- 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);
- }
- }
- protected int FontHeight {
- get {
- return Font.Height;
- }
- set {
- ;; // Nothing to do
- }
- }
- protected bool RenderRightToLeft {
- get {
- return (this.right_to_left == RightToLeft.Yes);
- }
- }
- protected bool ResizeRedraw {
- get {
- return GetStyle(ControlStyles.ResizeRedraw);
- }
- set {
- SetStyle(ControlStyles.ResizeRedraw, value);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- protected virtual bool ShowFocusCues {
- get {
- return true;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- protected bool ShowKeyboardCues {
- get {
- return true;
- }
- }
- #endregion // Protected Instance Properties
- #region Public Static Methods
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public static Control FromChildHandle(IntPtr handle) {
- IEnumerator control = Control.controls.GetEnumerator();
- while (control.MoveNext()) {
- if (((Control)control.Current).window.Handle == handle) {
- // Found it
- if (((Control)control.Current).Parent != null) {
- return ((Control)control.Current).Parent;
- }
- }
- }
- return null;
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public static Control FromHandle(IntPtr handle) {
- IEnumerator control = Control.controls.GetEnumerator();
- while (control.MoveNext()) {
- if (((Control)control.Current).window.Handle == handle) {
- // Found it
- return ((Control)control.Current);
- }
- }
- return null;
- }
- public static bool IsMnemonic(char charCode, string text) {
- int amp;
- amp = text.IndexOf('&');
- if (amp != -1) {
- if (amp + 1 < text.Length) {
- if (text[amp + 1] != '&') {
- if (Char.ToUpper(charCode) == Char.ToUpper(text.ToCharArray(amp + 1, 1)[0])) {
- return true;
- }
- }
- }
- }
- return false;
- }
- #endregion
- #region Protected Static Methods
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected static bool ReflectMessage(IntPtr hWnd, ref Message m) {
- Control c;
- c = Control.FromHandle(hWnd);
- if (c != null) {
- c.WndProc(ref m);
- return true;
- }
- return false;
- }
- #endregion
- #region Public Instance Methods
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public IAsyncResult BeginInvoke(Delegate method) {
- return BeginInvokeInternal(method, null);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public IAsyncResult BeginInvoke (Delegate method, object[] args) {
- return BeginInvokeInternal (method, args);
- }
- public void BringToFront() {
- if ((parent != null) && (parent.child_controls[0]!=this)) {
- if (parent.child_controls.Contains(this)) {
- parent.child_controls.SetChildIndex(this, 0);
- }
- }
- XplatUI.SetZOrder(this.window.Handle, IntPtr.Zero, true, false);
- if (parent != null) {
- parent.Refresh();
- }
- }
- public bool Contains(Control ctl) {
- while (ctl != null) {
- ctl = ctl.parent;
- if (ctl == this) {
- return true;
- }
- }
- return false;
- }
- public void CreateControl() {
- if (!IsHandleCreated) {
- CreateHandle();
- }
- if (!create_handled) {
- create_handled = true;
- OnCreateControl();
- }
- Control [] controls = child_controls.GetAllControls ();
- for (int i=0; i<controls.Length; i++) {
- controls [i].CreateControl ();
- }
- }
- public Graphics CreateGraphics() {
- if (!IsHandleCreated) {
- this.CreateControl();
- }
- return Graphics.FromHwnd(this.window.Handle);
- }
- public DragDropEffects DoDragDrop(object data, DragDropEffects allowedEffects) {
- return XplatUI.StartDrag(this.window.Handle, data, allowedEffects);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public object EndInvoke (IAsyncResult async_result) {
- AsyncMethodResult result = (AsyncMethodResult) async_result;
- return result.EndInvoke ();
- }
- public Form FindForm() {
- Control c;
- c = this;
- while (c != null) {
- if (c is Form) {
- return (Form)c;
- }
- c = c.Parent;
- }
- return null;
- }
- public bool Focus() {
- if (IsHandleCreated && !has_focus) {
- has_focus = true;
- XplatUI.SetFocus(window.Handle);
- }
- return true;
- }
- public Control GetChildAtPoint(Point pt) {
- // Microsoft's version of this function doesn't seem to work, so I can't check
- // if we only consider children or also grandchildren, etc.
- // I'm gonna say 'children only'
- for (int i=0; i<child_controls.Count; i++) {
- if (child_controls[i].Bounds.Contains(pt)) {
- return child_controls[i];
- }
- }
- return null;
- }
- public IContainerControl GetContainerControl() {
- Control current = this;
- while (current!=null) {
- if ((current is IContainerControl) && ((current.control_style & ControlStyles.ContainerControl)!=0)) {
- return (IContainerControl)current;
- }
- current = current.parent;
- }
- return null;
- }
- public Control GetNextControl(Control ctl, bool forward) {
- // If we're not a container we don't play
- if (!(this is IContainerControl) && !this.GetStyle(ControlStyles.ContainerControl)) {
- return null;
- }
- // If ctl is not contained by this, we start at the first child of this
- if (!this.Contains(ctl)) {
- ctl = null;
- }
- // Search through our controls, starting at ctl, stepping into children as we encounter them
- // try to find the control with the tabindex closest to our own, or, if we're looking into
- // child controls, the one with the smallest tabindex
- if (forward) {
- return FindControlForward(this, ctl);
- }
- return FindControlBackward(this, ctl);
- }
- public void Hide() {
- this.Visible = false;
- }
- public void Invalidate() {
- Invalidate(ClientRectangle, false);
- }
- public void Invalidate(bool invalidateChildren) {
- Invalidate(ClientRectangle, invalidateChildren);
- }
- public void Invalidate(System.Drawing.Rectangle rc) {
- Invalidate(rc, false);
- }
- public void Invalidate(System.Drawing.Rectangle rc, bool invalidateChildren) {
- if (!IsHandleCreated || !Visible) {
- return;
- }
- NotifyInvalidate(rc);
- XplatUI.Invalidate(Handle, rc, false);
- if (invalidateChildren) {
- Control [] controls = child_controls.GetAllControls ();
- for (int i=0; i<controls.Length; i++)
- controls [i].Invalidate ();
- }
- OnInvalidated(new InvalidateEventArgs(rc));
- }
- public void Invalidate(System.Drawing.Region region) {
- Invalidate(region, false);
- }
- [MonoTODO("Figure out if GetRegionScans is usable")]
- 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<child_controls.Count; i++) child_controls[i].Invalidate();
- //}
- }
- public object Invoke (Delegate method) {
- return Invoke(method, null);
- }
- public object Invoke (Delegate method, object[] args) {
- if (!this.InvokeRequired) {
- return method.DynamicInvoke(args);
- }
- IAsyncResult result = BeginInvoke (method, args);
- return EndInvoke(result);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public void PerformLayout() {
- PerformLayout(null, null);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public void PerformLayout(Control affectedControl, string affectedProperty) {
- LayoutEventArgs levent = new LayoutEventArgs(affectedControl, affectedProperty);
- if (layout_suspended>0) {
- layout_pending = true;
- return;
- }
- layout_pending = false;
- // Prevent us from getting messed up
- layout_suspended++;
- // Perform all Dock and Anchor calculations
- try {
- Control child;
- AnchorStyles anchor;
- Rectangle space;
- int diff_width;
- int diff_height;
- space=this.DisplayRectangle;
- if (prev_size != Size.Empty) {
- diff_width = space.Width - prev_size.Width;
- diff_height = space.Height - prev_size.Height;
- } else {
- diff_width = 0;
- diff_height = 0;
- }
- // Deal with docking; go through in reverse, MS docs say that lowest Z-order is closest to edge
- Control [] controls = child_controls.GetAllControls ();
- for (int i = controls.Length - 1; i >= 0; i--) {
- child = controls [i];
- switch (child.Dock) {
- case DockStyle.None: {
- // Do nothing
- break;
- }
- case DockStyle.Left: {
- child.SetBounds(space.Left, space.Y, child.Width, space.Height);
- space.X+=child.Width;
- space.Width-=child.Width;
- break;
- }
- case DockStyle.Top: {
- child.SetBounds(space.Left, space.Y, space.Width, child.Height);
- space.Y+=child.Height;
- space.Height-=child.Height;
- break;
- }
-
- case DockStyle.Right: {
- child.SetBounds(space.Right-child.Width, space.Y, child.Width, space.Height);
- space.Width-=child.Width;
- break;
- }
- case DockStyle.Bottom: {
- child.SetBounds(space.Left, space.Bottom-child.Height, space.Width, child.Height);
- space.Height-=child.Height;
- break;
- }
- }
- }
- for (int i = controls.Length - 1; i >= 0; i--) {
- child=controls[i];
- if (child.Dock == DockStyle.Fill) {
- child.SetBounds(space.Left, space.Top, space.Width, space.Height);
- space.Width=0;
- space.Height=0;
- }
- }
- space=this.DisplayRectangle;
- // Deal with anchoring
- for (int i=0; i < controls.Length; i++) {
- int left;
- int top;
- int width;
- int height;
- child=controls[i];
- anchor=child.Anchor;
- left=child.Left;
- top=child.Top;
- width=child.Width;
- height=child.Height;
- // If the control is docked we don't need to do anything
- if (child.Dock != DockStyle.None) {
- continue;
- }
- if ((anchor & AnchorStyles.Left) !=0 ) {
- if ((anchor & AnchorStyles.Right) != 0) {
- // Anchoring to left and right
- width=width+diff_width;
- } else {
- ; // nothing to do
- }
- } else if ((anchor & AnchorStyles.Right) != 0) {
- left+=diff_width;
- } else {
- left+=diff_width/2;
- }
- if ((anchor & AnchorStyles.Top) !=0 ) {
- if ((anchor & AnchorStyles.Bottom) != 0) {
- height+=diff_height;
- } else {
- ; // nothing to do
- }
- } else if ((anchor & AnchorStyles.Bottom) != 0) {
- top+=diff_height;
- } else {
- top+=diff_height/2;
- }
- // Sanity
- if (width < 0) {
- width=0;
- }
- if (height < 0) {
- height=0;
- }
- child.SetBounds(left, top, width, height);
- }
- // Let everyone know
- OnLayout(levent);
- }
- // Need to make sure we decremend layout_suspended
- finally {
- layout_suspended--;
- }
- }
- public Point PointToClient (Point p) {
- int x = p.X;
- int y = p.Y;
- XplatUI.ScreenToClient (Handle, ref x, ref y);
- return new Point (x, y);
- }
- public Point PointToScreen(Point p) {
- int x = p.X;
- int y = p.Y;
- XplatUI.ClientToScreen(Handle, ref x, ref y);
- return new Point(x, y);
- }
- public virtual bool PreProcessMessage(ref Message msg) {
- Keys key_data;
- if ((msg.Msg == (int)Msg.WM_KEYDOWN) || (msg.Msg == (int)Msg.WM_SYSKEYDOWN)) {
- key_data = (Keys)msg.WParam.ToInt32();
- if (!ProcessCmdKey(ref msg, key_data)) {
- if (IsInputKey(key_data)) {
- return true;
- }
- return ProcessDialogKey(key_data);
- }
- return true;
- } else if (msg.Msg == (int)Msg.WM_CHAR) {
- if (IsInputChar((char)msg.WParam)) {
- return true;
- }
- } else if (msg.Msg == (int)Msg.WM_SYSCHAR) {
- if (IsInputChar((char)msg.WParam)) {
- return true;
- }
- return ProcessDialogChar((char)msg.WParam);
- }
- return false;
- }
- public Rectangle RectangleToClient(Rectangle r) {
- return new Rectangle(PointToClient(r.Location), r.Size);
- }
- public Rectangle RectangleToScreen(Rectangle r) {
- return new Rectangle(PointToScreen(r.Location), r.Size);
- }
- public virtual void Refresh() {
- if (IsHandleCreated == true) {
- Invalidate();
- XplatUI.UpdateWindow(window.Handle);
- Control [] controls = child_controls.GetAllControls ();
- for (int i=0; i < controls.Length; i++) {
- controls[i].Refresh();
- }
-
- }
- }
- [EditorBrowsable(EditorBrowsableState.Never)]
- public virtual void ResetBackColor() {
- background_color = Color.Empty;
- }
- [EditorBrowsable(EditorBrowsableState.Never)]
- [MonoTODO]
- public void ResetBindings() {
- // Do something
- }
- [EditorBrowsable(EditorBrowsableState.Never)]
- public virtual void ResetCursor() {
- cursor = null;
- }
- [EditorBrowsable(EditorBrowsableState.Never)]
- public virtual void ResetFont() {
- font = null;
- }
- [EditorBrowsable(EditorBrowsableState.Never)]
- public virtual void ResetForeColor() {
- foreground_color = Color.Empty;
- }
- [EditorBrowsable(EditorBrowsableState.Never)]
- public void ResetImeMode() {
- ime_mode = DefaultImeMode;
- }
- [EditorBrowsable(EditorBrowsableState.Never)]
- public virtual void ResetRightToLeft() {
- right_to_left = RightToLeft.Inherit;
- }
- public virtual void ResetText() {
- text = String.Empty;
- }
- public void ResumeLayout() {
- ResumeLayout (true);
- }
- public void ResumeLayout(bool performLayout) {
- layout_suspended--;
-
- if (layout_suspended > 0) {
- return;
- }
- if (performLayout || layout_pending) {
- PerformLayout();
- }
- }
- public void Scale(float ratio) {
- ScaleCore(ratio, ratio);
- }
- public void Scale(float dx, float dy) {
- ScaleCore(dx, dy);
- }
- public void Select() {
- Select(false, false);
- }
- public bool SelectNextControl(Control ctl, bool forward, bool tabStopOnly, bool nested, bool wrap) {
- Control c;
-
- c = ctl;
- do {
- c = GetNextControl(c, forward);
- if (c == null) {
- if (wrap) {
- wrap = false;
- continue;
- }
- break;
- }
- if (c.CanSelect && ((c.parent == ctl.parent) || nested) && (c.tab_stop || !tabStopOnly)) {
- Select(c);
- return true;
- }
- } while (c != ctl); // If we wrap back to ourselves we stop
- return false;
- }
- public void SendToBack() {
- if ((parent != null) && (parent.child_controls[parent.child_controls.Count-1]!=this)) {
- if (parent.child_controls.Contains(this)) {
- parent.child_controls.SetChildIndex(this, parent.child_controls.Count);
- }
- }
- XplatUI.SetZOrder(this.window.Handle, IntPtr.Zero, false, true);
- if (parent != null) {
- parent.Refresh();
- }
- }
- public void SetBounds(int x, int y, int width, int height) {
- SetBoundsCore(x, y, width, height, BoundsSpecified.All);
- }
- public void SetBounds(int x, int y, int width, int height, BoundsSpecified specified) {
- SetBoundsCore(x, y, width, height, specified);
- }
- public void Show() {
- if (!IsHandleCreated) {
- this.CreateControl();
- }
- this.Visible=true;
- }
- public void SuspendLayout() {
- layout_suspended++;
- }
- public void Update() {
- needs_redraw = true;
- if (IsHandleCreated) {
- XplatUI.UpdateWindow(window.Handle);
- }
- }
- #endregion // Public Instance Methods
- #region Protected Instance Methods
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [MonoTODO("Implement this and tie it into Control.ControlAccessibleObject.NotifyClients")]
- protected void AccessibilityNotifyClients(AccessibleEvents accEvent, int childID) {
- throw new NotImplementedException();
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual AccessibleObject CreateAccessibilityInstance() {
- return new Control.ControlAccessibleObject(this);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual ControlCollection CreateControlsInstance() {
- return new ControlCollection(this);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void CreateHandle() {
- if (IsDisposed) {
- throw new ObjectDisposedException(Name);
- }
- if (IsHandleCreated) {
- return;
- }
- window.CreateHandle(CreateParams);
- // Find out where the window manager placed us
- UpdateStyles();
- if ((CreateParams.Style & (int)WindowStyles.WS_CHILD) != 0) {
- XplatUI.SetBorderStyle(window.Handle, (FormBorderStyle)border_style);
- }
- UpdateBounds();
- if (window.Handle!=IntPtr.Zero) {
- if (!controls.Contains(window.Handle)) {
- controls.Add(this);
- }
- creator_thread = Thread.CurrentThread;
- OnHandleCreated(EventArgs.Empty);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void DefWndProc(ref Message m) {
- window.DefWndProc(ref m);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void DestroyHandle() {
- if (IsHandleCreated) {
- // Destroy our children before we destroy ourselves, to prevent them from
- // being implictly (without us knowing) destroyed
- Control [] controls = child_controls.GetAllControls ();
- for (int i=0; i < controls.Length; i++) {
- controls[i].DestroyHandle();
- }
- if (window != null) {
- window.DestroyHandle();
- }
- OnHandleDestroyed(EventArgs.Empty);
- }
- }
- protected bool GetStyle(ControlStyles flag) {
- return (control_style & flag) != 0;
- }
- protected bool GetTopLevel() {
- return is_toplevel;
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void InitLayout() {
- if (parent != null) {
- parent.PerformLayout(this, "parent");
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void InvokeGotFocus(Control toInvoke, EventArgs e) {
- toInvoke.OnGotFocus(e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void InvokeLostFocus(Control toInvoke, EventArgs e) {
- toInvoke.OnLostFocus(e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void InvokeOnClick(Control toInvoke, EventArgs e) {
- toInvoke.OnClick(e);
- }
- protected void InvokePaint(Control toInvoke, PaintEventArgs e) {
- toInvoke.OnPaint(e);
- }
- protected void InvokePaintBackground(Control toInvoke, PaintEventArgs e) {
- toInvoke.OnPaintBackground(e);
- }
- protected virtual bool IsInputChar (char charCode) {
- if (parent != null) {
- return parent.IsInputChar(charCode);
- }
- return false;
- }
- protected virtual bool IsInputKey (Keys keyData) {
- // Doc says this one calls IsInputChar; not sure what to do with that
- return false;
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void NotifyInvalidate(Rectangle invalidatedArea) {
- // override me?
- }
- protected virtual bool ProcessCmdKey(ref Message msg, Keys keyData) {
- if ((context_menu != null) && context_menu.ProcessCmdKey(ref msg, keyData)) {
- return true;
- }
- if (parent != null) {
- return parent.ProcessCmdKey(ref msg, keyData);
- }
- return false;
- }
- protected virtual bool ProcessDialogChar(char charCode) {
- if (parent != null) {
- return parent.ProcessDialogChar (charCode);
- }
- return false;
- }
- protected virtual bool ProcessDialogKey (Keys keyData) {
- if (parent != null) {
- return parent.ProcessDialogKey (keyData);
- }
- return false;
- }
- 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;
- }
- case (int)Msg.WM_CHAR: {
- KeyPressEventArgs key_press_event;
- key_press_event = new KeyPressEventArgs((char)msg.WParam);
- OnKeyPress(key_press_event);
- return key_press_event.Handled;
- }
- default: {
- break;
- }
- }
- return false;
- }
- protected internal virtual bool ProcessKeyMessage(ref Message msg) {
- if (parent != null) {
- if (parent.ProcessKeyPreview(ref msg)) {
- return true;
- }
- }
- return false;
- }
- protected virtual bool ProcessKeyPreview(ref Message msg) {
- if (parent != null) {
- return parent.ProcessKeyPreview(ref msg);
- }
- return false;
- }
- protected virtual bool ProcessMnemonic(char charCode) {
- // override me
- return false;
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void RaiseDragEvent(object key, DragEventArgs e) {
- // MS Internal
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void RaiseKeyEvent(object key, KeyEventArgs e) {
- // MS Internal
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void RaiseMouseEvent(object key, MouseEventArgs e) {
- // MS Internal
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void RaisePaintEvent(object key, PaintEventArgs e) {
- // MS Internal
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void RecreateHandle() {
- IEnumerator child = child_controls.GetAllEnumerator();
- is_recreating=true;
- if (IsHandleCreated) {
- DestroyHandle();
- CreateHandle();
- // FIXME ZOrder?
- while (child.MoveNext()) {
- ((Control)child.Current).RecreateHandle();
- }
- } else {
- CreateControl();
- }
- is_recreating = false;
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void ResetMouseEventArgs() {
- // MS Internal
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected ContentAlignment RtlTranslateAlignment(ContentAlignment align) {
- if (right_to_left == RightToLeft.No) {
- return align;
- }
- switch (align) {
- case ContentAlignment.TopLeft: {
- return ContentAlignment.TopRight;
- }
- case ContentAlignment.TopRight: {
- return ContentAlignment.TopLeft;
- }
- case ContentAlignment.MiddleLeft: {
- return ContentAlignment.MiddleRight;
- }
- case ContentAlignment.MiddleRight: {
- return ContentAlignment.MiddleLeft;
- }
- case ContentAlignment.BottomLeft: {
- return ContentAlignment.BottomRight;
- }
- case ContentAlignment.BottomRight: {
- return ContentAlignment.BottomLeft;
- }
- default: {
- // if it's center it doesn't change
- return align;
- }
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected HorizontalAlignment RtlTranslateAlignment(HorizontalAlignment align) {
- if ((right_to_left == RightToLeft.No) || (align == HorizontalAlignment.Center)) {
- return align;
- }
- if (align == HorizontalAlignment.Left) {
- return HorizontalAlignment.Right;
- }
- // align must be HorizontalAlignment.Right
- return HorizontalAlignment.Left;
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected LeftRightAlignment RtlTranslateAlignment(LeftRightAlignment align) {
- if (right_to_left == RightToLeft.No) {
- return align;
- }
- if (align == LeftRightAlignment.Left) {
- return LeftRightAlignment.Right;
- }
- // align must be LeftRightAlignment.Right;
- return LeftRightAlignment.Left;
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected ContentAlignment RtlTranslateContent(ContentAlignment align) {
- return RtlTranslateAlignment(align);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected HorizontalAlignment RtlTranslateHorizontal(HorizontalAlignment align) {
- return RtlTranslateAlignment(align);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected LeftRightAlignment RtlTranslateLeftRight(LeftRightAlignment align) {
- return RtlTranslateAlignment(align);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void ScaleCore(float dx, float dy) {
- Point location;
- Size size;
- SuspendLayout();
- location = new Point((int)(Left * dx), (int)(Top * dy));
- size = this.ClientSize;
-
- if (!GetStyle(ControlStyles.FixedWidth)) {
- size.Width = (int)(size.Width * dx);
- }
- if (!GetStyle(ControlStyles.FixedHeight)) {
- size.Height = (int)(size.Height * dy);
- }
- Location = location;
- ClientSize = size;
- /* Now scale our children */
- Control [] controls = child_controls.GetAllControls ();
- for (int i=0; i < controls.Length; i++) {
- controls[i].Scale(dx, dy);
- }
- ResumeLayout();
- }
- protected virtual void Select(bool directed, bool forward) {
- int index;
- bool result;
- if (!directed) {
- // Select this control
- Select(this);
- return;
- }
- if (parent == null) {
- return;
- }
- // FIXME - this thing is doing the wrong stuff, needs to be similar to SelectNextControl
- index = parent.child_controls.IndexOf(this);
- result = false;
- do {
- if (forward) {
- if ((index+1) < parent.child_controls.Count) {
- index++;
- } else {
- index = 0;
- }
- } else {
- if (index>0) {
- index++;
- } else {
- index = parent.child_controls.Count-1;
- }
- }
- result = Select(parent.child_controls[index]);
- } while (!result && parent.child_controls[index] != this);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) {
- // SetBoundsCore updates the Win32 control itself. UpdateBounds updates the controls variables and fires events, I'm guessing - pdb
- if ((specified & BoundsSpecified.X) != BoundsSpecified.X) {
- x = Left;
- }
- if ((specified & BoundsSpecified.Y) != BoundsSpecified.Y) {
- y = Top;
- }
- if ((specified & BoundsSpecified.Width) != BoundsSpecified.Width) {
- width = Width;
- }
- if ((specified & BoundsSpecified.Height) != BoundsSpecified.Height) {
- height = Height;
- }
- if (IsHandleCreated) {
- XplatUI.SetWindowPos(Handle, x, y, width, height);
- }
- UpdateBounds(x, y, width, height);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void SetClientSizeCore(int x, int y) {
- // Calculate the actual window size from the client size (it usually stays the same or grows)
- Rectangle ClientRect;
- Rectangle WindowRect;
- CreateParams cp;
- ClientRect = new Rectangle(0, 0, x, y);
- cp = this.CreateParams;
- if (XplatUI.CalculateWindowRect(Handle, ref ClientRect, cp.Style, cp.ExStyle, IntPtr.Zero, out WindowRect)==false) {
- return;
- }
- SetBoundsCore(bounds.X, bounds.Y, WindowRect.Width, WindowRect.Height, BoundsSpecified.Size);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void SetStyle(ControlStyles flag, bool value) {
- if (value) {
- control_style |= flag;
- } else {
- control_style &= ~flag;
- }
- OnStyleChanged(EventArgs.Empty);
- }
- protected void SetTopLevel(bool value) {
- if ((GetTopLevel() != value) && (parent != null)) {
- throw new Exception();
- }
- if (this is Form) {
- if (value == true) {
- if (!Visible) {
- Visible = true;
- }
- } else {
- if (Visible) {
- Visible = false;
- }
- }
- }
- is_toplevel = value;
- }
- protected virtual void SetVisibleCore(bool value) {
- if (value!=is_visible) {
- is_visible=value;
- if (IsHandleCreated) {
- XplatUI.SetVisible(Handle, value);
- // Explicitly move Toplevel windows to where we want them;
- // apparently moving unmapped toplevel windows doesn't work
- if (is_visible && (this is Form)) {
- XplatUI.SetWindowPos(window.Handle, bounds.X, bounds.Y, bounds.Width, bounds.Height);
- }
- }
- OnVisibleChanged(EventArgs.Empty);
- if (!is_visible) {
- if (dc_mem != null) {
- dc_mem.Dispose();
- dc_mem = null;
- }
- if (bmp_mem != null) {
- bmp_mem.Dispose();
- bmp_mem = null;
- }
- } else {
- this.CreateBuffers(bounds.Width, bounds.Height);
- CreateControl();
- }
- if (value == false && parent != null) {
- Control container;
- // Need to start at parent, GetContainerControl might return ourselves if we're a container
- container = (Control)parent.GetContainerControl();
- if (container != null) {
- container.SelectNextControl(this, true, true, true, true);
- }
- }
- if (parent != null) {
- parent.PerformLayout(this, "visible");
- } else {
- PerformLayout(this, "visible");
- }
- }
- }
-
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void UpdateBounds() {
- int x;
- int y;
- int width;
- int height;
- int client_width;
- int client_height;
- if (!IsHandleCreated) {
- CreateHandle();
- }
- XplatUI.GetWindowPos(this.Handle, this is Form, out x, out y, out width, out height, out client_width, out client_height);
- UpdateBounds(x, y, width, height, client_width, client_height);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void UpdateBounds(int x, int y, int width, int height) {
- // UpdateBounds only seems to set our sizes and fire events but not update the GUI window to match
- bool moved = false;
- bool resized = false;
- int client_x_diff = this.bounds.Width-this.client_size.Width;
- int client_y_diff = this.bounds.Height-this.client_size.Height;
- // Needed to 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;
- // Update client rectangle as well
- if (this.layout_suspended==0) {
- prev_size.Width=client_size.Width;
- prev_size.Height=client_size.Height;
- }
- client_size.Width=width-client_x_diff;
- client_size.Height=height-client_y_diff;
- if (moved) {
- OnLocationChanged(EventArgs.Empty);
- }
- if (resized) {
- OnSizeChanged(EventArgs.Empty);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void UpdateBounds(int x, int y, int width, int height, int clientWidth, int clientHeight) {
- UpdateBounds(x, y, width, height);
- this.client_size.Width=clientWidth;
- this.client_size.Height=clientHeight;
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void UpdateStyles() {
- if (!IsHandleCreated) {
- return;
- }
- XplatUI.SetWindowStyle(window.Handle, CreateParams);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected void UpdateZOrder() {
- Control [] controls;
- #if not
- Control ctl;
- if (parent == null) {
- return;
- }
- ctl = parent;
- controls = ctl.child_controls.GetAllControls ();
- for (int i = 1; i < controls.Length; i++ ) {
- XplatUI.SetZOrder(controls[i].window.Handle, controls[i-1].window.Handle, false, false);
- }
- #else
- if (!IsHandleCreated) {
- return;
- }
- controls = child_controls.GetAllControls ();
- for (int i = 1; i < controls.Length; i++ ) {
- XplatUI.SetZOrder(controls[i].Handle, controls[i-1].Handle, false, false);
- }
- #endif
- }
- protected virtual void WndProc(ref Message m) {
- #if debug
- Console.WriteLine("Control received message {0}", (Msg)m.Msg);
- #endif
- if ((this.control_style & ControlStyles.EnableNotifyMessage) != 0) {
- OnNotifyMessage(m);
- }
- switch((Msg)m.Msg) {
- case Msg.WM_WINDOWPOSCHANGED: {
- if (Visible) {
- UpdateBounds();
- if (GetStyle(ControlStyles.ResizeRedraw)) {
- Invalidate();
- }
- }
- return;
- }
- case Msg.WM_PAINT: {
- PaintEventArgs paint_event;
- paint_event = XplatUI.PaintEventStart(Handle, true);
- if (!needs_redraw) {
- // Just blit the previous image
- paint_event.Graphics.DrawImage (ImageBuffer, paint_event.ClipRectangle, paint_event.ClipRectangle, GraphicsUnit.Pixel);
- XplatUI.PaintEventEnd(Handle, true);
- return;
- }
- Graphics dc = null;
- if ((control_style & ControlStyles.DoubleBuffer) != 0) {
- dc = paint_event.SetGraphics (DeviceContext);
- }
- if ((control_style & (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint)) != (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint)) {
- OnPaintBackground(paint_event);
- }
- OnPaint(paint_event);
- if ((control_style & ControlStyles.DoubleBuffer) != 0) {
- dc.DrawImage (ImageBuffer, paint_event.ClipRectangle, paint_event.ClipRectangle, GraphicsUnit.Pixel);
- paint_event.SetGraphics (dc);
- needs_redraw = false;
- }
- XplatUI.PaintEventEnd(Handle, true);
- if (!GetStyle(ControlStyles.UserPaint)) {
- DefWndProc(ref m);
- }
-
- return;
- }
-
- case Msg.WM_ERASEBKGND: {
- if (GetStyle (ControlStyles.UserPaint)) {
- if (!GetStyle(ControlStyles.AllPaintingInWmPaint)) {
- PaintEventArgs eraseEventArgs = new PaintEventArgs (m.WParam == IntPtr.Zero ? Graphics.FromHwnd (m.HWnd) :
- Graphics.FromHdc (m.WParam), new Rectangle (new Point (0,0),Size));
- OnPaintBackground (eraseEventArgs);
- }
- }
- // The DefWndProc will never have to handle this, we don't ever set hbr on the window
- m.Result = (IntPtr)1;
- return;
- }
- case Msg.WM_LBUTTONUP: {
- HandleClick(mouse_clicks);
- OnMouseUp (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Left,
- mouse_clicks,
- LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- if (mouse_clicks > 1) {
- mouse_clicks = 1;
- }
- return;
- }
-
- case Msg.WM_LBUTTONDOWN: {
- if (CanSelect && !is_selected) {
- Select(this);
- }
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
-
- return;
- }
- case Msg.WM_LBUTTONDBLCLK: {
- mouse_clicks++;
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- return;
- }
- case Msg.WM_MBUTTONUP: {
- HandleClick(mouse_clicks);
- OnMouseUp (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Middle,
- mouse_clicks,
- LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- if (mouse_clicks > 1) {
- mouse_clicks = 1;
- }
- return;
- }
-
- case Msg.WM_MBUTTONDOWN: {
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
-
- return;
- }
- case Msg.WM_MBUTTONDBLCLK: {
- mouse_clicks++;
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- return;
- }
- case Msg.WM_RBUTTONUP: {
- if (context_menu != null) {
- context_menu.Show(this, new Point(LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ())));
- }
- HandleClick(mouse_clicks);
- OnMouseUp (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()) | MouseButtons.Right,
- mouse_clicks,
- LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- if (mouse_clicks > 1) {
- mouse_clicks = 1;
- }
- return;
- }
-
- case Msg.WM_RBUTTONDOWN: {
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- return;
- }
- case Msg.WM_RBUTTONDBLCLK: {
- mouse_clicks++;
- OnMouseDown (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- return;
- }
- case Msg.WM_MOUSEWHEEL: {
- OnMouseWheel (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks, LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- HighOrder(m.WParam.ToInt32())));
- return;
- }
-
- case Msg.WM_MOUSEMOVE: {
- OnMouseMove (new MouseEventArgs (FromParamToMouseButtons ((int) m.WParam.ToInt32()),
- mouse_clicks,
- LowOrder ((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()),
- 0));
- return;
- }
- case Msg.WM_MOUSE_ENTER: {
- if (is_entered) {
- return;
- }
- is_entered = true;
- OnMouseEnter(EventArgs.Empty);
- return;
- }
- case Msg.WM_MOUSE_LEAVE: {
- is_entered=false;
- OnMouseLeave(EventArgs.Empty);
- return;
- }
- case Msg.WM_MOUSEHOVER: {
- OnMouseHover(EventArgs.Empty);
- return;
- }
- case Msg.WM_SYSKEYDOWN:
- case Msg.WM_KEYDOWN:
- case Msg.WM_SYSKEYUP:
- case Msg.WM_KEYUP:
- case Msg.WM_SYSCHAR:
- case Msg.WM_CHAR: {
- Console.WriteLine("Got {0}", (Msg)m.Msg);
- if (ProcessKeyEventArgs(ref m)) {
- return;
- }
- if (PreProcessMessage(ref m)) {
- return;
- }
- if (ProcessKeyMessage(ref m)) {
- return;
- }
- DefWndProc (ref m);
- return;
- }
- case Msg.WM_HELP: {
- Point mouse_pos;
- if (m.LParam != IntPtr.Zero) {
- HELPINFO hi;
- hi = new HELPINFO();
- hi = (HELPINFO) Marshal.PtrToStructure (m.LParam, typeof (HELPINFO));
- mouse_pos = new Point(hi.MousePos.x, hi.MousePos.y);
- } else {
- mouse_pos = Control.MousePosition;
- }
- OnHelpRequested(new HelpEventArgs(mouse_pos));
- m.Result = (IntPtr)1;
- return;
- }
- case Msg.WM_KILLFOCUS: {
- OnLeave(EventArgs.Empty);
- if (CausesValidation) {
- CancelEventArgs e;
- e = new CancelEventArgs(false);
- OnValidating(e);
- if (e.Cancel) {
- Focus();
- return;
- }
- OnValidated(EventArgs.Empty);
- }
- this.has_focus = false;
- this.is_selected = false;
- OnLostFocus(EventArgs.Empty);
- return;
- }
- case Msg.WM_SETFOCUS: {
- OnEnter(EventArgs.Empty);
- this.has_focus = true;
- OnGotFocus(EventArgs.Empty);
- return;
- }
-
- case Msg.WM_SYSCOLORCHANGE: {
- ThemeEngine.Current.ResetDefaults();
- OnSystemColorsChanged(EventArgs.Empty);
- return;
- }
-
- case Msg.WM_SETCURSOR: {
- if (cursor == null) {
- DefWndProc(ref m);
- return;
- }
- XplatUI.SetCursor(window.Handle, cursor.handle);
- m.Result = (IntPtr)1;
- return;
- }
- default: {
- DefWndProc(ref m);
- return;
- }
- }
- }
- #endregion // Public Instance Methods
- #region OnXXX methods
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnBackColorChanged(EventArgs e) {
- if (BackColorChanged!=null) BackColorChanged(this, e);
- for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentBackColorChanged(e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnBackgroundImageChanged(EventArgs e) {
- if (BackgroundImageChanged!=null) BackgroundImageChanged(this, e);
- for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentBackgroundImageChanged(e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnBindingContextChanged(EventArgs e) {
- CheckDataBindings ();
- if (BindingContextChanged!=null) {
- BindingContextChanged(this, e);
- }
- for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentBindingContextChanged(e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnCausesValidationChanged(EventArgs e) {
- if (CausesValidationChanged!=null) CausesValidationChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnChangeUICues(UICuesEventArgs e) {
- if (ChangeUICues!=null) ChangeUICues(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnClick(EventArgs e) {
- if (Click!=null) Click(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnContextMenuChanged(EventArgs e) {
- if (ContextMenuChanged!=null) ContextMenuChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnControlAdded(ControlEventArgs e) {
- if (ControlAdded!=null) ControlAdded(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnControlRemoved(ControlEventArgs e) {
- if (ControlRemoved!=null) ControlRemoved(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnCreateControl() {
- // Override me!
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnCursorChanged(EventArgs e) {
- if (CursorChanged!=null) CursorChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnDockChanged(EventArgs e) {
- if (DockChanged!=null) DockChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnDoubleClick(EventArgs e) {
- if (DoubleClick!=null) DoubleClick(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnDragDrop(DragEventArgs drgevent) {
- if (DragDrop!=null) DragDrop(this, drgevent);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnDragEnter(DragEventArgs drgevent) {
- if (DragEnter!=null) DragEnter(this, drgevent);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnDragLeave(EventArgs e) {
- if (DragLeave!=null) DragLeave(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnDragOver(DragEventArgs drgevent) {
- if (DragOver!=null) DragOver(this, drgevent);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnEnabledChanged(EventArgs e) {
- if (EnabledChanged!=null) EnabledChanged(this, e);
- for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentEnabledChanged(e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnEnter(EventArgs e) {
- if (Enter!=null) Enter(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnFontChanged(EventArgs e) {
- if (FontChanged!=null) FontChanged(this, e);
- for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentFontChanged(e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnForeColorChanged(EventArgs e) {
- if (ForeColorChanged!=null) ForeColorChanged(this, e);
- for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentForeColorChanged(e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnGiveFeedback(GiveFeedbackEventArgs gfbevent) {
- if (GiveFeedback!=null) GiveFeedback(this, gfbevent);
- }
-
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnGotFocus(EventArgs e) {
- if (GotFocus!=null) GotFocus(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnHandleCreated(EventArgs e) {
- if (HandleCreated!=null) HandleCreated(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnHandleDestroyed(EventArgs e) {
- if (HandleDestroyed!=null) HandleDestroyed(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnHelpRequested(HelpEventArgs hevent) {
- if (HelpRequested!=null) HelpRequested(this, hevent);
- }
- protected virtual void OnImeModeChanged(EventArgs e) {
- if (ImeModeChanged!=null) ImeModeChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnInvalidated(InvalidateEventArgs e) {
- needs_redraw = true;
- if (Invalidated!=null) Invalidated(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnKeyDown(KeyEventArgs e) {
- if (KeyDown!=null) KeyDown(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnKeyPress(KeyPressEventArgs e) {
- if (KeyPress!=null) KeyPress(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnKeyUp(KeyEventArgs e) {
- if (KeyUp!=null) KeyUp(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnLayout(LayoutEventArgs levent) {
- if (Layout!=null) Layout(this, levent);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnLeave(EventArgs e) {
- if (Leave!=null) Leave(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnLocationChanged(EventArgs e) {
- OnMove(e);
- if (LocationChanged!=null) LocationChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnLostFocus(EventArgs e) {
- if (LostFocus!=null) LostFocus(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnMouseDown(MouseEventArgs e) {
- if (MouseDown!=null) MouseDown(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnMouseEnter(EventArgs e) {
- if (MouseEnter!=null) MouseEnter(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnMouseHover(EventArgs e) {
- if (MouseHover!=null) MouseHover(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnMouseLeave(EventArgs e) {
- if (MouseLeave!=null) MouseLeave(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnMouseMove(MouseEventArgs e) {
- if (MouseMove!=null) MouseMove(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnMouseUp(MouseEventArgs e) {
- if (MouseUp!=null) MouseUp(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnMouseWheel(MouseEventArgs e) {
- if (MouseWheel!=null) MouseWheel(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnMove(EventArgs e) {
- if (Move!=null) Move(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnNotifyMessage(Message m) {
- // Override me!
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnPaint(PaintEventArgs e) {
- if (Paint!=null) Paint(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnPaintBackground(PaintEventArgs pevent) {
- PaintControlBackground (pevent);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnParentBackColorChanged(EventArgs e) {
- if (background_color.IsEmpty && background_image==null) {
- Invalidate();
- OnBackColorChanged(e);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnParentBackgroundImageChanged(EventArgs e) {
- if (background_color.IsEmpty && background_image==null) {
- Invalidate();
- OnBackgroundImageChanged(e);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnParentBindingContextChanged(EventArgs e) {
- if (binding_context==null) {
- binding_context=Parent.binding_context;
- OnBindingContextChanged(e);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnParentChanged(EventArgs e) {
- if (ParentChanged!=null) ParentChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnParentEnabledChanged(EventArgs e) {
- if (is_enabled != Parent.is_enabled) {
- is_enabled=Parent.is_enabled;
- Invalidate();
- if (EnabledChanged != null) {
- EnabledChanged(this, e);
- }
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnParentFontChanged(EventArgs e) {
- if (font==null) {
- Invalidate();
- OnFontChanged(e);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnParentForeColorChanged(EventArgs e) {
- if (foreground_color.IsEmpty) {
- Invalidate();
- OnForeColorChanged(e);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnParentRightToLeftChanged(EventArgs e) {
- if (right_to_left==RightToLeft.Inherit) {
- Invalidate();
- OnRightToLeftChanged(e);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnParentVisibleChanged(EventArgs e) {
- if (is_visible) {
- OnVisibleChanged(e);
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnQueryContinueDrag(QueryContinueDragEventArgs e) {
- if (QueryContinueDrag!=null) QueryContinueDrag(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnResize(EventArgs e) {
- if (Resize!=null) Resize(this, e);
- PerformLayout(this, "bounds");
- if (parent != null) {
- parent.PerformLayout();
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnRightToLeftChanged(EventArgs e) {
- if (RightToLeftChanged!=null) RightToLeftChanged(this, e);
- for (int i=0; i<child_controls.Count; i++) child_controls[i].OnParentRightToLeftChanged(e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnSizeChanged(EventArgs e) {
- InvalidateBuffers ();
- OnResize(e);
- if (SizeChanged!=null) SizeChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnStyleChanged(EventArgs e) {
- if (StyleChanged!=null) StyleChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnSystemColorsChanged(EventArgs e) {
- if (SystemColorsChanged!=null) SystemColorsChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnTabIndexChanged(EventArgs e) {
- if (TabIndexChanged!=null) TabIndexChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnTabStopChanged(EventArgs e) {
- if (TabStopChanged!=null) TabStopChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnTextChanged(EventArgs e) {
- if (TextChanged!=null) TextChanged(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnValidated(EventArgs e) {
- if (Validated!=null) Validated(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnValidating(System.ComponentModel.CancelEventArgs e) {
- if (Validating!=null) Validating(this, e);
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- protected virtual void OnVisibleChanged(EventArgs e) {
- if (!is_visible) {
- if (dc_mem!=null) {
- dc_mem.Dispose ();
- dc_mem=null;
- }
- if (bmp_mem!=null) {
- bmp_mem.Dispose();
- bmp_mem=null;
- }
- } else {
- if (!is_disposed) {
- if (!this.IsHandleCreated) {
- this.CreateControl();
- }
- PerformLayout();
- }
- }
-
- if (VisibleChanged!=null) VisibleChanged(this, e);
- // We need to tell our kids
- for (int i=0; i<child_controls.Count; i++) {
- child_controls[i].OnParentVisibleChanged(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;
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- public event ControlEventHandler ControlAdded;
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- public event ControlEventHandler ControlRemoved;
- [MWFDescription("Fired when the cursor for the control has been changed"), MWFCategory("PropertyChanged")]
- 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;
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- public event EventHandler GotFocus;
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- public event EventHandler HandleCreated;
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- public event EventHandler HandleDestroyed;
- public event HelpEventHandler HelpRequested;
- public event EventHandler ImeModeChanged;
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- 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;
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- 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;
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- [Browsable(false)]
- 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
- }
- }
|