nuklear.h 966 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764
  1. /*
  2. /// # Nuklear
  3. /// ![](https://cloud.githubusercontent.com/assets/8057201/11761525/ae06f0ca-a0c6-11e5-819d-5610b25f6ef4.gif)
  4. ///
  5. /// ## Contents
  6. /// 1. About section
  7. /// 2. Highlights section
  8. /// 3. Features section
  9. /// 4. Usage section
  10. /// 1. Flags section
  11. /// 2. Constants section
  12. /// 3. Dependencies section
  13. /// 5. Example section
  14. /// 6. API section
  15. /// 1. Context section
  16. /// 2. Input section
  17. /// 3. Drawing section
  18. /// 4. Window section
  19. /// 5. Layouting section
  20. /// 6. Groups section
  21. /// 7. Tree section
  22. /// 8. Properties section
  23. /// 7. License section
  24. /// 8. Changelog section
  25. /// 9. Gallery section
  26. /// 10. Credits section
  27. ///
  28. /// ## About
  29. /// This is a minimal state immediate mode graphical user interface toolkit
  30. /// written in ANSI C and licensed under public domain. It was designed as a simple
  31. /// embeddable user interface for application and does not have any dependencies,
  32. /// a default renderbackend or OS window and input handling but instead provides a very modular
  33. /// library approach by using simple input state for input and draw
  34. /// commands describing primitive shapes as output. So instead of providing a
  35. /// layered library that tries to abstract over a number of platform and
  36. /// render backends it only focuses on the actual UI.
  37. ///
  38. /// ## Highlights
  39. /// - Graphical user interface toolkit
  40. /// - Single header library
  41. /// - Written in C89 (a.k.a. ANSI C or ISO C90)
  42. /// - Small codebase (~18kLOC)
  43. /// - Focus on portability, efficiency and simplicity
  44. /// - No dependencies (not even the standard library if not wanted)
  45. /// - Fully skinnable and customizable
  46. /// - Low memory footprint with total memory control if needed or wanted
  47. /// - UTF-8 support
  48. /// - No global or hidden state
  49. /// - Customizable library modules (you can compile and use only what you need)
  50. /// - Optional font baker and vertex buffer output
  51. ///
  52. /// ## Features
  53. /// - Absolutely no platform dependent code
  54. /// - Memory management control ranging from/to
  55. /// - Ease of use by allocating everything from standard library
  56. /// - Control every byte of memory inside the library
  57. /// - Font handling control ranging from/to
  58. /// - Use your own font implementation for everything
  59. /// - Use this libraries internal font baking and handling API
  60. /// - Drawing output control ranging from/to
  61. /// - Simple shapes for more high level APIs which already have drawing capabilities
  62. /// - Hardware accessible anti-aliased vertex buffer output
  63. /// - Customizable colors and properties ranging from/to
  64. /// - Simple changes to color by filling a simple color table
  65. /// - Complete control with ability to use skinning to decorate widgets
  66. /// - Bendable UI library with widget ranging from/to
  67. /// - Basic widgets like buttons, checkboxes, slider, ...
  68. /// - Advanced widget like abstract comboboxes, contextual menus,...
  69. /// - Compile time configuration to only compile what you need
  70. /// - Subset which can be used if you do not want to link or use the standard library
  71. /// - Can be easily modified to only update on user input instead of frame updates
  72. ///
  73. /// ## Usage
  74. /// This library is self contained in one single header file and can be used either
  75. /// in header only mode or in implementation mode. The header only mode is used
  76. /// by default when included and allows including this header in other headers
  77. /// and does not contain the actual implementation. <br /><br />
  78. ///
  79. /// The implementation mode requires to define the preprocessor macro
  80. /// NK_IMPLEMENTATION in *one* .c/.cpp file before #includeing this file, e.g.:
  81. ///
  82. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~C
  83. /// #define NK_IMPLEMENTATION
  84. /// #include "nuklear.h"
  85. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  86. ///
  87. /// Also optionally define the symbols listed in the section "OPTIONAL DEFINES"
  88. /// below in header and implementation mode if you want to use additional functionality
  89. /// or need more control over the library.
  90. ///
  91. /// !!! WARNING
  92. /// Every time nuklear is included define the same compiler flags. This very important not doing so could lead to compiler errors or even worse stack corruptions.
  93. ///
  94. /// ### Flags
  95. /// Flag | Description
  96. /// --------------------------------|------------------------------------------
  97. /// NK_PRIVATE | If defined declares all functions as static, so they can only be accessed inside the file that contains the implementation
  98. /// NK_INCLUDE_FIXED_TYPES | If defined it will include header `<stdint.h>` for fixed sized types otherwise nuklear tries to select the correct type. If that fails it will throw a compiler error and you have to select the correct types yourself.
  99. /// NK_INCLUDE_DEFAULT_ALLOCATOR | If defined it will include header `<stdlib.h>` and provide additional functions to use this library without caring for memory allocation control and therefore ease memory management.
  100. /// NK_INCLUDE_STANDARD_IO | If defined it will include header `<stdio.h>` and provide additional functions depending on file loading.
  101. /// NK_INCLUDE_STANDARD_VARARGS | If defined it will include header <stdio.h> and provide additional functions depending on file loading.
  102. /// NK_INCLUDE_VERTEX_BUFFER_OUTPUT | Defining this adds a vertex draw command list backend to this library, which allows you to convert queue commands into vertex draw commands. This is mainly if you need a hardware accessible format for OpenGL, DirectX, Vulkan, Metal,...
  103. /// NK_INCLUDE_FONT_BAKING | Defining this adds `stb_truetype` and `stb_rect_pack` implementation to this library and provides font baking and rendering. If you already have font handling or do not want to use this font handler you don't have to define it.
  104. /// NK_INCLUDE_DEFAULT_FONT | Defining this adds the default font: ProggyClean.ttf into this library which can be loaded into a font atlas and allows using this library without having a truetype font
  105. /// NK_INCLUDE_COMMAND_USERDATA | Defining this adds a userdata pointer into each command. Can be useful for example if you want to provide custom shaders depending on the used widget. Can be combined with the style structures.
  106. /// NK_BUTTON_TRIGGER_ON_RELEASE | Different platforms require button clicks occurring either on buttons being pressed (up to down) or released (down to up). By default this library will react on buttons being pressed, but if you define this it will only trigger if a button is released.
  107. /// NK_ZERO_COMMAND_MEMORY | Defining this will zero out memory for each drawing command added to a drawing queue (inside nk_command_buffer_push). Zeroing command memory is very useful for fast checking (using memcmp) if command buffers are equal and avoid drawing frames when nothing on screen has changed since previous frame.
  108. /// NK_UINT_DRAW_INDEX | Defining this will set the size of vertex index elements when using NK_VERTEX_BUFFER_OUTPUT to 32bit instead of the default of 16bit
  109. /// NK_KEYSTATE_BASED_INPUT | Define this if your backend uses key state for each frame rather than key press/release events
  110. ///
  111. /// !!! WARNING
  112. /// The following flags will pull in the standard C library:
  113. /// - NK_INCLUDE_DEFAULT_ALLOCATOR
  114. /// - NK_INCLUDE_STANDARD_IO
  115. /// - NK_INCLUDE_STANDARD_VARARGS
  116. ///
  117. /// !!! WARNING
  118. /// The following flags if defined need to be defined for both header and implementation:
  119. /// - NK_INCLUDE_FIXED_TYPES
  120. /// - NK_INCLUDE_DEFAULT_ALLOCATOR
  121. /// - NK_INCLUDE_STANDARD_VARARGS
  122. /// - NK_INCLUDE_VERTEX_BUFFER_OUTPUT
  123. /// - NK_INCLUDE_FONT_BAKING
  124. /// - NK_INCLUDE_DEFAULT_FONT
  125. /// - NK_INCLUDE_STANDARD_VARARGS
  126. /// - NK_INCLUDE_COMMAND_USERDATA
  127. /// - NK_UINT_DRAW_INDEX
  128. ///
  129. /// ### Constants
  130. /// Define | Description
  131. /// --------------------------------|---------------------------------------
  132. /// NK_BUFFER_DEFAULT_INITIAL_SIZE | Initial buffer size allocated by all buffers while using the default allocator functions included by defining NK_INCLUDE_DEFAULT_ALLOCATOR. If you don't want to allocate the default 4k memory then redefine it.
  133. /// NK_MAX_NUMBER_BUFFER | Maximum buffer size for the conversion buffer between float and string Under normal circumstances this should be more than sufficient.
  134. /// NK_INPUT_MAX | Defines the max number of bytes which can be added as text input in one frame. Under normal circumstances this should be more than sufficient.
  135. ///
  136. /// !!! WARNING
  137. /// The following constants if defined need to be defined for both header and implementation:
  138. /// - NK_MAX_NUMBER_BUFFER
  139. /// - NK_BUFFER_DEFAULT_INITIAL_SIZE
  140. /// - NK_INPUT_MAX
  141. ///
  142. /// ### Dependencies
  143. /// Function | Description
  144. /// ------------|---------------------------------------------------------------
  145. /// NK_ASSERT | If you don't define this, nuklear will use <assert.h> with assert().
  146. /// NK_MEMSET | You can define this to 'memset' or your own memset implementation replacement. If not nuklear will use its own version.
  147. /// NK_MEMCPY | You can define this to 'memcpy' or your own memcpy implementation replacement. If not nuklear will use its own version.
  148. /// NK_SQRT | You can define this to 'sqrt' or your own sqrt implementation replacement. If not nuklear will use its own slow and not highly accurate version.
  149. /// NK_SIN | You can define this to 'sinf' or your own sine implementation replacement. If not nuklear will use its own approximation implementation.
  150. /// NK_COS | You can define this to 'cosf' or your own cosine implementation replacement. If not nuklear will use its own approximation implementation.
  151. /// NK_STRTOD | You can define this to `strtod` or your own string to double conversion implementation replacement. If not defined nuklear will use its own imprecise and possibly unsafe version (does not handle nan or infinity!).
  152. /// NK_DTOA | You can define this to `dtoa` or your own double to string conversion implementation replacement. If not defined nuklear will use its own imprecise and possibly unsafe version (does not handle nan or infinity!).
  153. /// NK_VSNPRINTF| If you define `NK_INCLUDE_STANDARD_VARARGS` as well as `NK_INCLUDE_STANDARD_IO` and want to be safe define this to `vsnprintf` on compilers supporting later versions of C or C++. By default nuklear will check for your stdlib version in C as well as compiler version in C++. if `vsnprintf` is available it will define it to `vsnprintf` directly. If not defined and if you have older versions of C or C++ it will be defined to `vsprintf` which is unsafe.
  154. ///
  155. /// !!! WARNING
  156. /// The following dependencies will pull in the standard C library if not redefined:
  157. /// - NK_ASSERT
  158. ///
  159. /// !!! WARNING
  160. /// The following dependencies if defined need to be defined for both header and implementation:
  161. /// - NK_ASSERT
  162. ///
  163. /// !!! WARNING
  164. /// The following dependencies if defined need to be defined only for the implementation part:
  165. /// - NK_MEMSET
  166. /// - NK_MEMCPY
  167. /// - NK_SQRT
  168. /// - NK_SIN
  169. /// - NK_COS
  170. /// - NK_STRTOD
  171. /// - NK_DTOA
  172. /// - NK_VSNPRINTF
  173. ///
  174. /// ## Example
  175. ///
  176. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  177. /// // init gui state
  178. /// enum {EASY, HARD};
  179. /// static int op = EASY;
  180. /// static float value = 0.6f;
  181. /// static int i = 20;
  182. /// struct nk_context ctx;
  183. ///
  184. /// nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);
  185. /// if (nk_begin(&ctx, "Show", nk_rect(50, 50, 220, 220),
  186. /// NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
  187. /// // fixed widget pixel width
  188. /// nk_layout_row_static(&ctx, 30, 80, 1);
  189. /// if (nk_button_label(&ctx, "button")) {
  190. /// // event handling
  191. /// }
  192. ///
  193. /// // fixed widget window ratio width
  194. /// nk_layout_row_dynamic(&ctx, 30, 2);
  195. /// if (nk_option_label(&ctx, "easy", op == EASY)) op = EASY;
  196. /// if (nk_option_label(&ctx, "hard", op == HARD)) op = HARD;
  197. ///
  198. /// // custom widget pixel width
  199. /// nk_layout_row_begin(&ctx, NK_STATIC, 30, 2);
  200. /// {
  201. /// nk_layout_row_push(&ctx, 50);
  202. /// nk_label(&ctx, "Volume:", NK_TEXT_LEFT);
  203. /// nk_layout_row_push(&ctx, 110);
  204. /// nk_slider_float(&ctx, 0, &value, 1.0f, 0.1f);
  205. /// }
  206. /// nk_layout_row_end(&ctx);
  207. /// }
  208. /// nk_end(&ctx);
  209. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  210. ///
  211. /// ![](https://cloud.githubusercontent.com/assets/8057201/10187981/584ecd68-675c-11e5-897c-822ef534a876.png)
  212. ///
  213. /// ## API
  214. ///
  215. */
  216. #ifndef NK_SINGLE_FILE
  217. #define NK_SINGLE_FILE
  218. #endif
  219. #ifndef NK_NUKLEAR_H_
  220. #define NK_NUKLEAR_H_
  221. #ifdef __cplusplus
  222. extern "C" {
  223. #endif
  224. /*
  225. * ==============================================================
  226. *
  227. * CONSTANTS
  228. *
  229. * ===============================================================
  230. */
  231. #define NK_UNDEFINED (-1.0f)
  232. #define NK_UTF_INVALID 0xFFFD /* internal invalid utf8 rune */
  233. #define NK_UTF_SIZE 4 /* describes the number of bytes a glyph consists of*/
  234. #ifndef NK_INPUT_MAX
  235. #define NK_INPUT_MAX 16
  236. #endif
  237. #ifndef NK_MAX_NUMBER_BUFFER
  238. #define NK_MAX_NUMBER_BUFFER 64
  239. #endif
  240. #ifndef NK_SCROLLBAR_HIDING_TIMEOUT
  241. #define NK_SCROLLBAR_HIDING_TIMEOUT 4.0f
  242. #endif
  243. /*
  244. * ==============================================================
  245. *
  246. * HELPER
  247. *
  248. * ===============================================================
  249. */
  250. #ifndef NK_API
  251. #ifdef NK_PRIVATE
  252. #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199409L))
  253. #define NK_API static inline
  254. #elif defined(__cplusplus)
  255. #define NK_API static inline
  256. #else
  257. #define NK_API static
  258. #endif
  259. #else
  260. #define NK_API extern
  261. #endif
  262. #endif
  263. #ifndef NK_LIB
  264. #ifdef NK_SINGLE_FILE
  265. #define NK_LIB static
  266. #else
  267. #define NK_LIB extern
  268. #endif
  269. #endif
  270. #define NK_INTERN static
  271. #define NK_STORAGE static
  272. #define NK_GLOBAL static
  273. #define NK_FLAG(x) (1 << (x))
  274. #define NK_STRINGIFY(x) #x
  275. #define NK_MACRO_STRINGIFY(x) NK_STRINGIFY(x)
  276. #define NK_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1 ## arg2
  277. #define NK_STRING_JOIN_DELAY(arg1, arg2) NK_STRING_JOIN_IMMEDIATE(arg1, arg2)
  278. #define NK_STRING_JOIN(arg1, arg2) NK_STRING_JOIN_DELAY(arg1, arg2)
  279. #ifdef _MSC_VER
  280. #define NK_UNIQUE_NAME(name) NK_STRING_JOIN(name,__COUNTER__)
  281. #else
  282. #define NK_UNIQUE_NAME(name) NK_STRING_JOIN(name,__LINE__)
  283. #endif
  284. #ifndef NK_STATIC_ASSERT
  285. #define NK_STATIC_ASSERT(exp) typedef char NK_UNIQUE_NAME(_dummy_array)[(exp)?1:-1]
  286. #endif
  287. #ifndef NK_FILE_LINE
  288. #ifdef _MSC_VER
  289. #define NK_FILE_LINE __FILE__ ":" NK_MACRO_STRINGIFY(__COUNTER__)
  290. #else
  291. #define NK_FILE_LINE __FILE__ ":" NK_MACRO_STRINGIFY(__LINE__)
  292. #endif
  293. #endif
  294. #define NK_MIN(a,b) ((a) < (b) ? (a) : (b))
  295. #define NK_MAX(a,b) ((a) < (b) ? (b) : (a))
  296. #define NK_CLAMP(i,v,x) (NK_MAX(NK_MIN(v,x), i))
  297. #ifdef NK_INCLUDE_STANDARD_VARARGS
  298. #if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
  299. #include <sal.h>
  300. #define NK_PRINTF_FORMAT_STRING _Printf_format_string_
  301. #else
  302. #define NK_PRINTF_FORMAT_STRING
  303. #endif
  304. #if defined(__GNUC__)
  305. #define NK_PRINTF_VARARG_FUNC(fmtargnumber) __attribute__((format(__printf__, fmtargnumber, fmtargnumber+1)))
  306. #define NK_PRINTF_VALIST_FUNC(fmtargnumber) __attribute__((format(__printf__, fmtargnumber, 0)))
  307. #else
  308. #define NK_PRINTF_VARARG_FUNC(fmtargnumber)
  309. #define NK_PRINTF_VALIST_FUNC(fmtargnumber)
  310. #endif
  311. #endif
  312. /*
  313. * ===============================================================
  314. *
  315. * BASIC
  316. *
  317. * ===============================================================
  318. */
  319. #ifdef NK_INCLUDE_FIXED_TYPES
  320. #include <stdint.h>
  321. #define NK_INT8 int8_t
  322. #define NK_UINT8 uint8_t
  323. #define NK_INT16 int16_t
  324. #define NK_UINT16 uint16_t
  325. #define NK_INT32 int32_t
  326. #define NK_UINT32 uint32_t
  327. #define NK_SIZE_TYPE uintptr_t
  328. #define NK_POINTER_TYPE uintptr_t
  329. #else
  330. #ifndef NK_INT8
  331. #define NK_INT8 signed char
  332. #endif
  333. #ifndef NK_UINT8
  334. #define NK_UINT8 unsigned char
  335. #endif
  336. #ifndef NK_INT16
  337. #define NK_INT16 signed short
  338. #endif
  339. #ifndef NK_UINT16
  340. #define NK_UINT16 unsigned short
  341. #endif
  342. #ifndef NK_INT32
  343. #if defined(_MSC_VER)
  344. #define NK_INT32 __int32
  345. #else
  346. #define NK_INT32 signed int
  347. #endif
  348. #endif
  349. #ifndef NK_UINT32
  350. #if defined(_MSC_VER)
  351. #define NK_UINT32 unsigned __int32
  352. #else
  353. #define NK_UINT32 unsigned int
  354. #endif
  355. #endif
  356. #ifndef NK_SIZE_TYPE
  357. #if defined(_WIN64) && defined(_MSC_VER)
  358. #define NK_SIZE_TYPE unsigned __int64
  359. #elif (defined(_WIN32) || defined(WIN32)) && defined(_MSC_VER)
  360. #define NK_SIZE_TYPE unsigned __int32
  361. #elif defined(__GNUC__) || defined(__clang__)
  362. #if defined(__x86_64__) || defined(__ppc64__)
  363. #define NK_SIZE_TYPE unsigned long
  364. #else
  365. #define NK_SIZE_TYPE unsigned int
  366. #endif
  367. #else
  368. #define NK_SIZE_TYPE unsigned long
  369. #endif
  370. #endif
  371. #ifndef NK_POINTER_TYPE
  372. #if defined(_WIN64) && defined(_MSC_VER)
  373. #define NK_POINTER_TYPE unsigned __int64
  374. #elif (defined(_WIN32) || defined(WIN32)) && defined(_MSC_VER)
  375. #define NK_POINTER_TYPE unsigned __int32
  376. #elif defined(__GNUC__) || defined(__clang__)
  377. #if defined(__x86_64__) || defined(__ppc64__)
  378. #define NK_POINTER_TYPE unsigned long
  379. #else
  380. #define NK_POINTER_TYPE unsigned int
  381. #endif
  382. #else
  383. #define NK_POINTER_TYPE unsigned long
  384. #endif
  385. #endif
  386. #endif
  387. typedef NK_INT8 nk_char;
  388. typedef NK_UINT8 nk_uchar;
  389. typedef NK_UINT8 nk_byte;
  390. typedef NK_INT16 nk_short;
  391. typedef NK_UINT16 nk_ushort;
  392. typedef NK_INT32 nk_int;
  393. typedef NK_UINT32 nk_uint;
  394. typedef NK_SIZE_TYPE nk_size;
  395. typedef NK_POINTER_TYPE nk_ptr;
  396. typedef nk_uint nk_hash;
  397. typedef nk_uint nk_flags;
  398. typedef nk_uint nk_rune;
  399. /* Make sure correct type size:
  400. * This will fire with a negative subscript error if the type sizes
  401. * are set incorrectly by the compiler, and compile out if not */
  402. NK_STATIC_ASSERT(sizeof(nk_short) == 2);
  403. NK_STATIC_ASSERT(sizeof(nk_ushort) == 2);
  404. NK_STATIC_ASSERT(sizeof(nk_uint) == 4);
  405. NK_STATIC_ASSERT(sizeof(nk_int) == 4);
  406. NK_STATIC_ASSERT(sizeof(nk_byte) == 1);
  407. NK_STATIC_ASSERT(sizeof(nk_flags) >= 4);
  408. NK_STATIC_ASSERT(sizeof(nk_rune) >= 4);
  409. NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
  410. NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
  411. /* ============================================================================
  412. *
  413. * API
  414. *
  415. * =========================================================================== */
  416. struct nk_buffer;
  417. struct nk_allocator;
  418. struct nk_command_buffer;
  419. struct nk_draw_command;
  420. struct nk_convert_config;
  421. struct nk_style_item;
  422. struct nk_text_edit;
  423. struct nk_draw_list;
  424. struct nk_user_font;
  425. struct nk_panel;
  426. struct nk_context;
  427. struct nk_draw_vertex_layout_element;
  428. struct nk_style_button;
  429. struct nk_style_toggle;
  430. struct nk_style_selectable;
  431. struct nk_style_slide;
  432. struct nk_style_progress;
  433. struct nk_style_scrollbar;
  434. struct nk_style_edit;
  435. struct nk_style_property;
  436. struct nk_style_chart;
  437. struct nk_style_combo;
  438. struct nk_style_tab;
  439. struct nk_style_window_header;
  440. struct nk_style_window;
  441. enum {nk_false, nk_true};
  442. struct nk_color {nk_byte r,g,b,a;};
  443. struct nk_colorf {float r,g,b,a;};
  444. struct nk_vec2 {float x,y;};
  445. struct nk_vec2i {short x, y;};
  446. struct nk_rect {float x,y,w,h;};
  447. struct nk_recti {short x,y,w,h;};
  448. typedef char nk_glyph[NK_UTF_SIZE];
  449. typedef union {void *ptr; int id;} nk_handle;
  450. struct nk_image {nk_handle handle;unsigned short w,h;unsigned short region[4];};
  451. struct nk_cursor {struct nk_image img; struct nk_vec2 size, offset;};
  452. struct nk_scroll {nk_uint x, y;};
  453. enum nk_heading {NK_UP, NK_RIGHT, NK_DOWN, NK_LEFT};
  454. enum nk_button_behavior {NK_BUTTON_DEFAULT, NK_BUTTON_REPEATER};
  455. enum nk_modify {NK_FIXED = nk_false, NK_MODIFIABLE = nk_true};
  456. enum nk_orientation {NK_VERTICAL, NK_HORIZONTAL};
  457. enum nk_collapse_states {NK_MINIMIZED = nk_false, NK_MAXIMIZED = nk_true};
  458. enum nk_show_states {NK_HIDDEN = nk_false, NK_SHOWN = nk_true};
  459. enum nk_chart_type {NK_CHART_LINES, NK_CHART_COLUMN, NK_CHART_MAX};
  460. enum nk_chart_event {NK_CHART_HOVERING = 0x01, NK_CHART_CLICKED = 0x02};
  461. enum nk_color_format {NK_RGB, NK_RGBA};
  462. enum nk_popup_type {NK_POPUP_STATIC, NK_POPUP_DYNAMIC};
  463. enum nk_layout_format {NK_DYNAMIC, NK_STATIC};
  464. enum nk_tree_type {NK_TREE_NODE, NK_TREE_TAB};
  465. typedef void*(*nk_plugin_alloc)(nk_handle, void *old, nk_size);
  466. typedef void (*nk_plugin_free)(nk_handle, void *old);
  467. typedef int(*nk_plugin_filter)(const struct nk_text_edit*, nk_rune unicode);
  468. typedef void(*nk_plugin_paste)(nk_handle, struct nk_text_edit*);
  469. typedef void(*nk_plugin_copy)(nk_handle, const char*, int len);
  470. struct nk_allocator {
  471. nk_handle userdata;
  472. nk_plugin_alloc alloc;
  473. nk_plugin_free free;
  474. };
  475. enum nk_symbol_type {
  476. NK_SYMBOL_NONE,
  477. NK_SYMBOL_X,
  478. NK_SYMBOL_UNDERSCORE,
  479. NK_SYMBOL_CIRCLE_SOLID,
  480. NK_SYMBOL_CIRCLE_OUTLINE,
  481. NK_SYMBOL_RECT_SOLID,
  482. NK_SYMBOL_RECT_OUTLINE,
  483. NK_SYMBOL_TRIANGLE_UP,
  484. NK_SYMBOL_TRIANGLE_DOWN,
  485. NK_SYMBOL_TRIANGLE_LEFT,
  486. NK_SYMBOL_TRIANGLE_RIGHT,
  487. NK_SYMBOL_PLUS,
  488. NK_SYMBOL_MINUS,
  489. NK_SYMBOL_MAX
  490. };
  491. /* =============================================================================
  492. *
  493. * CONTEXT
  494. *
  495. * =============================================================================*/
  496. /*/// ### Context
  497. /// Contexts are the main entry point and the majestro of nuklear and contain all required state.
  498. /// They are used for window, memory, input, style, stack, commands and time management and need
  499. /// to be passed into all nuklear GUI specific functions.
  500. ///
  501. /// #### Usage
  502. /// To use a context it first has to be initialized which can be achieved by calling
  503. /// one of either `nk_init_default`, `nk_init_fixed`, `nk_init`, `nk_init_custom`.
  504. /// Each takes in a font handle and a specific way of handling memory. Memory control
  505. /// hereby ranges from standard library to just specifying a fixed sized block of memory
  506. /// which nuklear has to manage itself from.
  507. ///
  508. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  509. /// struct nk_context ctx;
  510. /// nk_init_xxx(&ctx, ...);
  511. /// while (1) {
  512. /// // [...]
  513. /// nk_clear(&ctx);
  514. /// }
  515. /// nk_free(&ctx);
  516. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  517. ///
  518. /// #### Reference
  519. /// Function | Description
  520. /// --------------------|-------------------------------------------------------
  521. /// __nk_init_default__ | Initializes context with standard library memory allocation (malloc,free)
  522. /// __nk_init_fixed__ | Initializes context from single fixed size memory block
  523. /// __nk_init__ | Initializes context with memory allocator callbacks for alloc and free
  524. /// __nk_init_custom__ | Initializes context from two buffers. One for draw commands the other for window/panel/table allocations
  525. /// __nk_clear__ | Called at the end of the frame to reset and prepare the context for the next frame
  526. /// __nk_free__ | Shutdown and free all memory allocated inside the context
  527. /// __nk_set_user_data__| Utility function to pass user data to draw command
  528. */
  529. #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR
  530. /*/// #### nk_init_default
  531. /// Initializes a `nk_context` struct with a default standard library allocator.
  532. /// Should be used if you don't want to be bothered with memory management in nuklear.
  533. ///
  534. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  535. /// int nk_init_default(struct nk_context *ctx, const struct nk_user_font *font);
  536. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  537. ///
  538. /// Parameter | Description
  539. /// ------------|---------------------------------------------------------------
  540. /// __ctx__ | Must point to an either stack or heap allocated `nk_context` struct
  541. /// __font__ | Must point to a previously initialized font handle for more info look at font documentation
  542. ///
  543. /// Returns either `false(0)` on failure or `true(1)` on success.
  544. ///
  545. */
  546. NK_API int nk_init_default(struct nk_context*, const struct nk_user_font*);
  547. #endif
  548. /*/// #### nk_init_fixed
  549. /// Initializes a `nk_context` struct from single fixed size memory block
  550. /// Should be used if you want complete control over nuklear's memory management.
  551. /// Especially recommended for system with little memory or systems with virtual memory.
  552. /// For the later case you can just allocate for example 16MB of virtual memory
  553. /// and only the required amount of memory will actually be committed.
  554. ///
  555. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  556. /// int nk_init_fixed(struct nk_context *ctx, void *memory, nk_size size, const struct nk_user_font *font);
  557. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  558. ///
  559. /// !!! Warning
  560. /// make sure the passed memory block is aligned correctly for `nk_draw_commands`.
  561. ///
  562. /// Parameter | Description
  563. /// ------------|--------------------------------------------------------------
  564. /// __ctx__ | Must point to an either stack or heap allocated `nk_context` struct
  565. /// __memory__ | Must point to a previously allocated memory block
  566. /// __size__ | Must contain the total size of __memory__
  567. /// __font__ | Must point to a previously initialized font handle for more info look at font documentation
  568. ///
  569. /// Returns either `false(0)` on failure or `true(1)` on success.
  570. */
  571. NK_API int nk_init_fixed(struct nk_context*, void *memory, nk_size size, const struct nk_user_font*);
  572. /*/// #### nk_init
  573. /// Initializes a `nk_context` struct with memory allocation callbacks for nuklear to allocate
  574. /// memory from. Used internally for `nk_init_default` and provides a kitchen sink allocation
  575. /// interface to nuklear. Can be useful for cases like monitoring memory consumption.
  576. ///
  577. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  578. /// int nk_init(struct nk_context *ctx, struct nk_allocator *alloc, const struct nk_user_font *font);
  579. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  580. ///
  581. /// Parameter | Description
  582. /// ------------|---------------------------------------------------------------
  583. /// __ctx__ | Must point to an either stack or heap allocated `nk_context` struct
  584. /// __alloc__ | Must point to a previously allocated memory allocator
  585. /// __font__ | Must point to a previously initialized font handle for more info look at font documentation
  586. ///
  587. /// Returns either `false(0)` on failure or `true(1)` on success.
  588. */
  589. NK_API int nk_init(struct nk_context*, struct nk_allocator*, const struct nk_user_font*);
  590. /*/// #### nk_init_custom
  591. /// Initializes a `nk_context` struct from two different either fixed or growing
  592. /// buffers. The first buffer is for allocating draw commands while the second buffer is
  593. /// used for allocating windows, panels and state tables.
  594. ///
  595. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  596. /// int nk_init_custom(struct nk_context *ctx, struct nk_buffer *cmds, struct nk_buffer *pool, const struct nk_user_font *font);
  597. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  598. ///
  599. /// Parameter | Description
  600. /// ------------|---------------------------------------------------------------
  601. /// __ctx__ | Must point to an either stack or heap allocated `nk_context` struct
  602. /// __cmds__ | Must point to a previously initialized memory buffer either fixed or dynamic to store draw commands into
  603. /// __pool__ | Must point to a previously initialized memory buffer either fixed or dynamic to store windows, panels and tables
  604. /// __font__ | Must point to a previously initialized font handle for more info look at font documentation
  605. ///
  606. /// Returns either `false(0)` on failure or `true(1)` on success.
  607. */
  608. NK_API int nk_init_custom(struct nk_context*, struct nk_buffer *cmds, struct nk_buffer *pool, const struct nk_user_font*);
  609. /*/// #### nk_clear
  610. /// Resets the context state at the end of the frame. This includes mostly
  611. /// garbage collector tasks like removing windows or table not called and therefore
  612. /// used anymore.
  613. ///
  614. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  615. /// void nk_clear(struct nk_context *ctx);
  616. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  617. ///
  618. /// Parameter | Description
  619. /// ------------|-----------------------------------------------------------
  620. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  621. */
  622. NK_API void nk_clear(struct nk_context*);
  623. /*/// #### nk_free
  624. /// Frees all memory allocated by nuklear. Not needed if context was
  625. /// initialized with `nk_init_fixed`.
  626. ///
  627. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  628. /// void nk_free(struct nk_context *ctx);
  629. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  630. ///
  631. /// Parameter | Description
  632. /// ------------|-----------------------------------------------------------
  633. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  634. */
  635. NK_API void nk_free(struct nk_context*);
  636. #ifdef NK_INCLUDE_COMMAND_USERDATA
  637. /*/// #### nk_set_user_data
  638. /// Sets the currently passed userdata passed down into each draw command.
  639. ///
  640. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  641. /// void nk_set_user_data(struct nk_context *ctx, nk_handle data);
  642. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  643. ///
  644. /// Parameter | Description
  645. /// ------------|--------------------------------------------------------------
  646. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  647. /// __data__ | Handle with either pointer or index to be passed into every draw commands
  648. */
  649. NK_API void nk_set_user_data(struct nk_context*, nk_handle handle);
  650. #endif
  651. /* =============================================================================
  652. *
  653. * INPUT
  654. *
  655. * =============================================================================*/
  656. /*/// ### Input
  657. /// The input API is responsible for holding the current input state composed of
  658. /// mouse, key and text input states.
  659. /// It is worth noting that no direct OS or window handling is done in nuklear.
  660. /// Instead all input state has to be provided by platform specific code. This on one hand
  661. /// expects more work from the user and complicates usage but on the other hand
  662. /// provides simple abstraction over a big number of platforms, libraries and other
  663. /// already provided functionality.
  664. ///
  665. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  666. /// nk_input_begin(&ctx);
  667. /// while (GetEvent(&evt)) {
  668. /// if (evt.type == MOUSE_MOVE)
  669. /// nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
  670. /// else if (evt.type == [...]) {
  671. /// // [...]
  672. /// }
  673. /// } nk_input_end(&ctx);
  674. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  675. ///
  676. /// #### Usage
  677. /// Input state needs to be provided to nuklear by first calling `nk_input_begin`
  678. /// which resets internal state like delta mouse position and button transistions.
  679. /// After `nk_input_begin` all current input state needs to be provided. This includes
  680. /// mouse motion, button and key pressed and released, text input and scrolling.
  681. /// Both event- or state-based input handling are supported by this API
  682. /// and should work without problems. Finally after all input state has been
  683. /// mirrored `nk_input_end` needs to be called to finish input process.
  684. ///
  685. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  686. /// struct nk_context ctx;
  687. /// nk_init_xxx(&ctx, ...);
  688. /// while (1) {
  689. /// Event evt;
  690. /// nk_input_begin(&ctx);
  691. /// while (GetEvent(&evt)) {
  692. /// if (evt.type == MOUSE_MOVE)
  693. /// nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
  694. /// else if (evt.type == [...]) {
  695. /// // [...]
  696. /// }
  697. /// }
  698. /// nk_input_end(&ctx);
  699. /// // [...]
  700. /// nk_clear(&ctx);
  701. /// } nk_free(&ctx);
  702. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  703. ///
  704. /// #### Reference
  705. /// Function | Description
  706. /// --------------------|-------------------------------------------------------
  707. /// __nk_input_begin__ | Begins the input mirroring process. Needs to be called before all other `nk_input_xxx` calls
  708. /// __nk_input_motion__ | Mirrors mouse cursor position
  709. /// __nk_input_key__ | Mirrors key state with either pressed or released
  710. /// __nk_input_button__ | Mirrors mouse button state with either pressed or released
  711. /// __nk_input_scroll__ | Mirrors mouse scroll values
  712. /// __nk_input_char__ | Adds a single ASCII text character into an internal text buffer
  713. /// __nk_input_glyph__ | Adds a single multi-byte UTF-8 character into an internal text buffer
  714. /// __nk_input_unicode__| Adds a single unicode rune into an internal text buffer
  715. /// __nk_input_end__ | Ends the input mirroring process by calculating state changes. Don't call any `nk_input_xxx` function referenced above after this call
  716. */
  717. enum nk_keys {
  718. NK_KEY_NONE,
  719. NK_KEY_SHIFT,
  720. NK_KEY_CTRL,
  721. NK_KEY_DEL,
  722. NK_KEY_ENTER,
  723. NK_KEY_TAB,
  724. NK_KEY_BACKSPACE,
  725. NK_KEY_COPY,
  726. NK_KEY_CUT,
  727. NK_KEY_PASTE,
  728. NK_KEY_UP,
  729. NK_KEY_DOWN,
  730. NK_KEY_LEFT,
  731. NK_KEY_RIGHT,
  732. /* Shortcuts: text field */
  733. NK_KEY_TEXT_INSERT_MODE,
  734. NK_KEY_TEXT_REPLACE_MODE,
  735. NK_KEY_TEXT_RESET_MODE,
  736. NK_KEY_TEXT_LINE_START,
  737. NK_KEY_TEXT_LINE_END,
  738. NK_KEY_TEXT_START,
  739. NK_KEY_TEXT_END,
  740. NK_KEY_TEXT_UNDO,
  741. NK_KEY_TEXT_REDO,
  742. NK_KEY_TEXT_SELECT_ALL,
  743. NK_KEY_TEXT_WORD_LEFT,
  744. NK_KEY_TEXT_WORD_RIGHT,
  745. /* Shortcuts: scrollbar */
  746. NK_KEY_SCROLL_START,
  747. NK_KEY_SCROLL_END,
  748. NK_KEY_SCROLL_DOWN,
  749. NK_KEY_SCROLL_UP,
  750. NK_KEY_MAX
  751. };
  752. enum nk_buttons {
  753. NK_BUTTON_LEFT,
  754. NK_BUTTON_MIDDLE,
  755. NK_BUTTON_RIGHT,
  756. NK_BUTTON_DOUBLE,
  757. NK_BUTTON_MAX
  758. };
  759. /*/// #### nk_input_begin
  760. /// Begins the input mirroring process by resetting text, scroll
  761. /// mouse, previous mouse position and movement as well as key state transitions,
  762. ///
  763. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  764. /// void nk_input_begin(struct nk_context*);
  765. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  766. ///
  767. /// Parameter | Description
  768. /// ------------|-----------------------------------------------------------
  769. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  770. */
  771. NK_API void nk_input_begin(struct nk_context*);
  772. /*/// #### nk_input_motion
  773. /// Mirrors current mouse position to nuklear
  774. ///
  775. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  776. /// void nk_input_motion(struct nk_context *ctx, int x, int y);
  777. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  778. ///
  779. /// Parameter | Description
  780. /// ------------|-----------------------------------------------------------
  781. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  782. /// __x__ | Must hold an integer describing the current mouse cursor x-position
  783. /// __y__ | Must hold an integer describing the current mouse cursor y-position
  784. */
  785. NK_API void nk_input_motion(struct nk_context*, int x, int y);
  786. /*/// #### nk_input_key
  787. /// Mirrors the state of a specific key to nuklear
  788. ///
  789. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  790. /// void nk_input_key(struct nk_context*, enum nk_keys key, int down);
  791. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  792. ///
  793. /// Parameter | Description
  794. /// ------------|-----------------------------------------------------------
  795. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  796. /// __key__ | Must be any value specified in enum `nk_keys` that needs to be mirrored
  797. /// __down__ | Must be 0 for key is up and 1 for key is down
  798. */
  799. NK_API void nk_input_key(struct nk_context*, enum nk_keys, int down);
  800. /*/// #### nk_input_button
  801. /// Mirrors the state of a specific mouse button to nuklear
  802. ///
  803. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  804. /// void nk_input_button(struct nk_context *ctx, enum nk_buttons btn, int x, int y, int down);
  805. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  806. ///
  807. /// Parameter | Description
  808. /// ------------|-----------------------------------------------------------
  809. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  810. /// __btn__ | Must be any value specified in enum `nk_buttons` that needs to be mirrored
  811. /// __x__ | Must contain an integer describing mouse cursor x-position on click up/down
  812. /// __y__ | Must contain an integer describing mouse cursor y-position on click up/down
  813. /// __down__ | Must be 0 for key is up and 1 for key is down
  814. */
  815. NK_API void nk_input_button(struct nk_context*, enum nk_buttons, int x, int y, int down);
  816. /*/// #### nk_input_scroll
  817. /// Copies the last mouse scroll value to nuklear. Is generally
  818. /// a scroll value. So does not have to come from mouse and could also originate
  819. /// TODO finish this sentence
  820. ///
  821. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  822. /// void nk_input_scroll(struct nk_context *ctx, struct nk_vec2 val);
  823. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  824. ///
  825. /// Parameter | Description
  826. /// ------------|-----------------------------------------------------------
  827. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  828. /// __val__ | vector with both X- as well as Y-scroll value
  829. */
  830. NK_API void nk_input_scroll(struct nk_context*, struct nk_vec2 val);
  831. /*/// #### nk_input_char
  832. /// Copies a single ASCII character into an internal text buffer
  833. /// This is basically a helper function to quickly push ASCII characters into
  834. /// nuklear.
  835. ///
  836. /// !!! Note
  837. /// Stores up to NK_INPUT_MAX bytes between `nk_input_begin` and `nk_input_end`.
  838. ///
  839. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  840. /// void nk_input_char(struct nk_context *ctx, char c);
  841. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  842. ///
  843. /// Parameter | Description
  844. /// ------------|-----------------------------------------------------------
  845. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  846. /// __c__ | Must be a single ASCII character preferable one that can be printed
  847. */
  848. NK_API void nk_input_char(struct nk_context*, char);
  849. /*/// #### nk_input_glyph
  850. /// Converts an encoded unicode rune into UTF-8 and copies the result into an
  851. /// internal text buffer.
  852. ///
  853. /// !!! Note
  854. /// Stores up to NK_INPUT_MAX bytes between `nk_input_begin` and `nk_input_end`.
  855. ///
  856. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  857. /// void nk_input_glyph(struct nk_context *ctx, const nk_glyph g);
  858. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  859. ///
  860. /// Parameter | Description
  861. /// ------------|-----------------------------------------------------------
  862. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  863. /// __g__ | UTF-32 unicode codepoint
  864. */
  865. NK_API void nk_input_glyph(struct nk_context*, const nk_glyph);
  866. /*/// #### nk_input_unicode
  867. /// Converts a unicode rune into UTF-8 and copies the result
  868. /// into an internal text buffer.
  869. /// !!! Note
  870. /// Stores up to NK_INPUT_MAX bytes between `nk_input_begin` and `nk_input_end`.
  871. ///
  872. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  873. /// void nk_input_unicode(struct nk_context*, nk_rune rune);
  874. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  875. ///
  876. /// Parameter | Description
  877. /// ------------|-----------------------------------------------------------
  878. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  879. /// __rune__ | UTF-32 unicode codepoint
  880. */
  881. NK_API void nk_input_unicode(struct nk_context*, nk_rune);
  882. /*/// #### nk_input_end
  883. /// End the input mirroring process by resetting mouse grabbing
  884. /// state to ensure the mouse cursor is not grabbed indefinitely.
  885. ///
  886. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  887. /// void nk_input_end(struct nk_context *ctx);
  888. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  889. ///
  890. /// Parameter | Description
  891. /// ------------|-----------------------------------------------------------
  892. /// __ctx__ | Must point to a previously initialized `nk_context` struct
  893. */
  894. NK_API void nk_input_end(struct nk_context*);
  895. /* =============================================================================
  896. *
  897. * DRAWING
  898. *
  899. * =============================================================================*/
  900. /*/// ### Drawing
  901. /// This library was designed to be render backend agnostic so it does
  902. /// not draw anything to screen directly. Instead all drawn shapes, widgets
  903. /// are made of, are buffered into memory and make up a command queue.
  904. /// Each frame therefore fills the command buffer with draw commands
  905. /// that then need to be executed by the user and his own render backend.
  906. /// After that the command buffer needs to be cleared and a new frame can be
  907. /// started. It is probably important to note that the command buffer is the main
  908. /// drawing API and the optional vertex buffer API only takes this format and
  909. /// converts it into a hardware accessible format.
  910. ///
  911. /// #### Usage
  912. /// To draw all draw commands accumulated over a frame you need your own render
  913. /// backend able to draw a number of 2D primitives. This includes at least
  914. /// filled and stroked rectangles, circles, text, lines, triangles and scissors.
  915. /// As soon as this criterion is met you can iterate over each draw command
  916. /// and execute each draw command in a interpreter like fashion:
  917. ///
  918. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  919. /// const struct nk_command *cmd = 0;
  920. /// nk_foreach(cmd, &ctx) {
  921. /// switch (cmd->type) {
  922. /// case NK_COMMAND_LINE:
  923. /// your_draw_line_function(...)
  924. /// break;
  925. /// case NK_COMMAND_RECT
  926. /// your_draw_rect_function(...)
  927. /// break;
  928. /// case //...:
  929. /// //[...]
  930. /// }
  931. /// }
  932. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  933. ///
  934. /// In program flow context draw commands need to be executed after input has been
  935. /// gathered and the complete UI with windows and their contained widgets have
  936. /// been executed and before calling `nk_clear` which frees all previously
  937. /// allocated draw commands.
  938. ///
  939. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  940. /// struct nk_context ctx;
  941. /// nk_init_xxx(&ctx, ...);
  942. /// while (1) {
  943. /// Event evt;
  944. /// nk_input_begin(&ctx);
  945. /// while (GetEvent(&evt)) {
  946. /// if (evt.type == MOUSE_MOVE)
  947. /// nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
  948. /// else if (evt.type == [...]) {
  949. /// [...]
  950. /// }
  951. /// }
  952. /// nk_input_end(&ctx);
  953. /// //
  954. /// // [...]
  955. /// //
  956. /// const struct nk_command *cmd = 0;
  957. /// nk_foreach(cmd, &ctx) {
  958. /// switch (cmd->type) {
  959. /// case NK_COMMAND_LINE:
  960. /// your_draw_line_function(...)
  961. /// break;
  962. /// case NK_COMMAND_RECT
  963. /// your_draw_rect_function(...)
  964. /// break;
  965. /// case ...:
  966. /// // [...]
  967. /// }
  968. /// nk_clear(&ctx);
  969. /// }
  970. /// nk_free(&ctx);
  971. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  972. ///
  973. /// You probably noticed that you have to draw all of the UI each frame which is
  974. /// quite wasteful. While the actual UI updating loop is quite fast rendering
  975. /// without actually needing it is not. So there are multiple things you could do.
  976. ///
  977. /// First is only update on input. This of course is only an option if your
  978. /// application only depends on the UI and does not require any outside calculations.
  979. /// If you actually only update on input make sure to update the UI two times each
  980. /// frame and call `nk_clear` directly after the first pass and only draw in
  981. /// the second pass. In addition it is recommended to also add additional timers
  982. /// to make sure the UI is not drawn more than a fixed number of frames per second.
  983. ///
  984. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  985. /// struct nk_context ctx;
  986. /// nk_init_xxx(&ctx, ...);
  987. /// while (1) {
  988. /// // [...wait for input ]
  989. /// // [...do two UI passes ...]
  990. /// do_ui(...)
  991. /// nk_clear(&ctx);
  992. /// do_ui(...)
  993. /// //
  994. /// // draw
  995. /// const struct nk_command *cmd = 0;
  996. /// nk_foreach(cmd, &ctx) {
  997. /// switch (cmd->type) {
  998. /// case NK_COMMAND_LINE:
  999. /// your_draw_line_function(...)
  1000. /// break;
  1001. /// case NK_COMMAND_RECT
  1002. /// your_draw_rect_function(...)
  1003. /// break;
  1004. /// case ...:
  1005. /// //[...]
  1006. /// }
  1007. /// nk_clear(&ctx);
  1008. /// }
  1009. /// nk_free(&ctx);
  1010. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1011. ///
  1012. /// The second probably more applicable trick is to only draw if anything changed.
  1013. /// It is not really useful for applications with continuous draw loop but
  1014. /// quite useful for desktop applications. To actually get nuklear to only
  1015. /// draw on changes you first have to define `NK_ZERO_COMMAND_MEMORY` and
  1016. /// allocate a memory buffer that will store each unique drawing output.
  1017. /// After each frame you compare the draw command memory inside the library
  1018. /// with your allocated buffer by memcmp. If memcmp detects differences
  1019. /// you have to copy the command buffer into the allocated buffer
  1020. /// and then draw like usual (this example uses fixed memory but you could
  1021. /// use dynamically allocated memory).
  1022. ///
  1023. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1024. /// //[... other defines ...]
  1025. /// #define NK_ZERO_COMMAND_MEMORY
  1026. /// #include "nuklear.h"
  1027. /// //
  1028. /// // setup context
  1029. /// struct nk_context ctx;
  1030. /// void *last = calloc(1,64*1024);
  1031. /// void *buf = calloc(1,64*1024);
  1032. /// nk_init_fixed(&ctx, buf, 64*1024);
  1033. /// //
  1034. /// // loop
  1035. /// while (1) {
  1036. /// // [...input...]
  1037. /// // [...ui...]
  1038. /// void *cmds = nk_buffer_memory(&ctx.memory);
  1039. /// if (memcmp(cmds, last, ctx.memory.allocated)) {
  1040. /// memcpy(last,cmds,ctx.memory.allocated);
  1041. /// const struct nk_command *cmd = 0;
  1042. /// nk_foreach(cmd, &ctx) {
  1043. /// switch (cmd->type) {
  1044. /// case NK_COMMAND_LINE:
  1045. /// your_draw_line_function(...)
  1046. /// break;
  1047. /// case NK_COMMAND_RECT
  1048. /// your_draw_rect_function(...)
  1049. /// break;
  1050. /// case ...:
  1051. /// // [...]
  1052. /// }
  1053. /// }
  1054. /// }
  1055. /// nk_clear(&ctx);
  1056. /// }
  1057. /// nk_free(&ctx);
  1058. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1059. ///
  1060. /// Finally while using draw commands makes sense for higher abstracted platforms like
  1061. /// X11 and Win32 or drawing libraries it is often desirable to use graphics
  1062. /// hardware directly. Therefore it is possible to just define
  1063. /// `NK_INCLUDE_VERTEX_BUFFER_OUTPUT` which includes optional vertex output.
  1064. /// To access the vertex output you first have to convert all draw commands into
  1065. /// vertexes by calling `nk_convert` which takes in your preferred vertex format.
  1066. /// After successfully converting all draw commands just iterate over and execute all
  1067. /// vertex draw commands:
  1068. ///
  1069. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1070. /// // fill configuration
  1071. /// struct your_vertex
  1072. /// {
  1073. /// float pos[2]; // important to keep it to 2 floats
  1074. /// float uv[2];
  1075. /// unsigned char col[4];
  1076. /// };
  1077. /// struct nk_convert_config cfg = {};
  1078. /// static const struct nk_draw_vertex_layout_element vertex_layout[] = {
  1079. /// {NK_VERTEX_POSITION, NK_FORMAT_FLOAT, NK_OFFSETOF(struct your_vertex, pos)},
  1080. /// {NK_VERTEX_TEXCOORD, NK_FORMAT_FLOAT, NK_OFFSETOF(struct your_vertex, uv)},
  1081. /// {NK_VERTEX_COLOR, NK_FORMAT_R8G8B8A8, NK_OFFSETOF(struct your_vertex, col)},
  1082. /// {NK_VERTEX_LAYOUT_END}
  1083. /// };
  1084. /// cfg.shape_AA = NK_ANTI_ALIASING_ON;
  1085. /// cfg.line_AA = NK_ANTI_ALIASING_ON;
  1086. /// cfg.vertex_layout = vertex_layout;
  1087. /// cfg.vertex_size = sizeof(struct your_vertex);
  1088. /// cfg.vertex_alignment = NK_ALIGNOF(struct your_vertex);
  1089. /// cfg.circle_segment_count = 22;
  1090. /// cfg.curve_segment_count = 22;
  1091. /// cfg.arc_segment_count = 22;
  1092. /// cfg.global_alpha = 1.0f;
  1093. /// cfg.null = dev->null;
  1094. /// //
  1095. /// // setup buffers and convert
  1096. /// struct nk_buffer cmds, verts, idx;
  1097. /// nk_buffer_init_default(&cmds);
  1098. /// nk_buffer_init_default(&verts);
  1099. /// nk_buffer_init_default(&idx);
  1100. /// nk_convert(&ctx, &cmds, &verts, &idx, &cfg);
  1101. /// //
  1102. /// // draw
  1103. /// nk_draw_foreach(cmd, &ctx, &cmds) {
  1104. /// if (!cmd->elem_count) continue;
  1105. /// //[...]
  1106. /// }
  1107. /// nk_buffer_free(&cms);
  1108. /// nk_buffer_free(&verts);
  1109. /// nk_buffer_free(&idx);
  1110. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1111. ///
  1112. /// #### Reference
  1113. /// Function | Description
  1114. /// --------------------|-------------------------------------------------------
  1115. /// __nk__begin__ | Returns the first draw command in the context draw command list to be drawn
  1116. /// __nk__next__ | Increments the draw command iterator to the next command inside the context draw command list
  1117. /// __nk_foreach__ | Iterates over each draw command inside the context draw command list
  1118. /// __nk_convert__ | Converts from the abstract draw commands list into a hardware accessible vertex format
  1119. /// __nk_draw_begin__ | Returns the first vertex command in the context vertex draw list to be executed
  1120. /// __nk__draw_next__ | Increments the vertex command iterator to the next command inside the context vertex command list
  1121. /// __nk__draw_end__ | Returns the end of the vertex draw list
  1122. /// __nk_draw_foreach__ | Iterates over each vertex draw command inside the vertex draw list
  1123. */
  1124. enum nk_anti_aliasing {NK_ANTI_ALIASING_OFF, NK_ANTI_ALIASING_ON};
  1125. enum nk_convert_result {
  1126. NK_CONVERT_SUCCESS = 0,
  1127. NK_CONVERT_INVALID_PARAM = 1,
  1128. NK_CONVERT_COMMAND_BUFFER_FULL = NK_FLAG(1),
  1129. NK_CONVERT_VERTEX_BUFFER_FULL = NK_FLAG(2),
  1130. NK_CONVERT_ELEMENT_BUFFER_FULL = NK_FLAG(3)
  1131. };
  1132. struct nk_draw_null_texture {
  1133. nk_handle texture; /* texture handle to a texture with a white pixel */
  1134. struct nk_vec2 uv; /* coordinates to a white pixel in the texture */
  1135. };
  1136. struct nk_convert_config {
  1137. float global_alpha; /* global alpha value */
  1138. enum nk_anti_aliasing line_AA; /* line anti-aliasing flag can be turned off if you are tight on memory */
  1139. enum nk_anti_aliasing shape_AA; /* shape anti-aliasing flag can be turned off if you are tight on memory */
  1140. unsigned circle_segment_count; /* number of segments used for circles: default to 22 */
  1141. unsigned arc_segment_count; /* number of segments used for arcs: default to 22 */
  1142. unsigned curve_segment_count; /* number of segments used for curves: default to 22 */
  1143. struct nk_draw_null_texture null; /* handle to texture with a white pixel for shape drawing */
  1144. const struct nk_draw_vertex_layout_element *vertex_layout; /* describes the vertex output format and packing */
  1145. nk_size vertex_size; /* sizeof one vertex for vertex packing */
  1146. nk_size vertex_alignment; /* vertex alignment: Can be obtained by NK_ALIGNOF */
  1147. };
  1148. /*/// #### nk__begin
  1149. /// Returns a draw command list iterator to iterate all draw
  1150. /// commands accumulated over one frame.
  1151. ///
  1152. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1153. /// const struct nk_command* nk__begin(struct nk_context*);
  1154. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1155. ///
  1156. /// Parameter | Description
  1157. /// ------------|-----------------------------------------------------------
  1158. /// __ctx__ | must point to an previously initialized `nk_context` struct at the end of a frame
  1159. ///
  1160. /// Returns draw command pointer pointing to the first command inside the draw command list
  1161. */
  1162. NK_API const struct nk_command* nk__begin(struct nk_context*);
  1163. /*/// #### nk__next
  1164. /// Returns draw command pointer pointing to the next command inside the draw command list
  1165. ///
  1166. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1167. /// const struct nk_command* nk__next(struct nk_context*, const struct nk_command*);
  1168. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1169. ///
  1170. /// Parameter | Description
  1171. /// ------------|-----------------------------------------------------------
  1172. /// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame
  1173. /// __cmd__ | Must point to an previously a draw command either returned by `nk__begin` or `nk__next`
  1174. ///
  1175. /// Returns draw command pointer pointing to the next command inside the draw command list
  1176. */
  1177. NK_API const struct nk_command* nk__next(struct nk_context*, const struct nk_command*);
  1178. /*/// #### nk_foreach
  1179. /// Iterates over each draw command inside the context draw command list
  1180. ///
  1181. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1182. /// #define nk_foreach(c, ctx)
  1183. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1184. ///
  1185. /// Parameter | Description
  1186. /// ------------|-----------------------------------------------------------
  1187. /// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame
  1188. /// __cmd__ | Command pointer initialized to NULL
  1189. ///
  1190. /// Iterates over each draw command inside the context draw command list
  1191. */
  1192. #define nk_foreach(c, ctx) for((c) = nk__begin(ctx); (c) != 0; (c) = nk__next(ctx,c))
  1193. #ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT
  1194. /*/// #### nk_convert
  1195. /// Converts all internal draw commands into vertex draw commands and fills
  1196. /// three buffers with vertexes, vertex draw commands and vertex indices. The vertex format
  1197. /// as well as some other configuration values have to be configured by filling out a
  1198. /// `nk_convert_config` struct.
  1199. ///
  1200. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1201. /// nk_flags nk_convert(struct nk_context *ctx, struct nk_buffer *cmds,
  1202. /// struct nk_buffer *vertices, struct nk_buffer *elements, const struct nk_convert_config*);
  1203. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1204. ///
  1205. /// Parameter | Description
  1206. /// ------------|-----------------------------------------------------------
  1207. /// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame
  1208. /// __cmds__ | Must point to a previously initialized buffer to hold converted vertex draw commands
  1209. /// __vertices__| Must point to a previously initialized buffer to hold all produced vertices
  1210. /// __elements__| Must point to a previously initialized buffer to hold all produced vertex indices
  1211. /// __config__ | Must point to a filled out `nk_config` struct to configure the conversion process
  1212. ///
  1213. /// Returns one of enum nk_convert_result error codes
  1214. ///
  1215. /// Parameter | Description
  1216. /// --------------------------------|-----------------------------------------------------------
  1217. /// NK_CONVERT_SUCCESS | Signals a successful draw command to vertex buffer conversion
  1218. /// NK_CONVERT_INVALID_PARAM | An invalid argument was passed in the function call
  1219. /// NK_CONVERT_COMMAND_BUFFER_FULL | The provided buffer for storing draw commands is full or failed to allocate more memory
  1220. /// NK_CONVERT_VERTEX_BUFFER_FULL | The provided buffer for storing vertices is full or failed to allocate more memory
  1221. /// NK_CONVERT_ELEMENT_BUFFER_FULL | The provided buffer for storing indicies is full or failed to allocate more memory
  1222. */
  1223. NK_API nk_flags nk_convert(struct nk_context*, struct nk_buffer *cmds, struct nk_buffer *vertices, struct nk_buffer *elements, const struct nk_convert_config*);
  1224. /*/// #### nk__draw_begin
  1225. /// Returns a draw vertex command buffer iterator to iterate over the vertex draw command buffer
  1226. ///
  1227. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1228. /// const struct nk_draw_command* nk__draw_begin(const struct nk_context*, const struct nk_buffer*);
  1229. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1230. ///
  1231. /// Parameter | Description
  1232. /// ------------|-----------------------------------------------------------
  1233. /// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame
  1234. /// __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer
  1235. ///
  1236. /// Returns vertex draw command pointer pointing to the first command inside the vertex draw command buffer
  1237. */
  1238. NK_API const struct nk_draw_command* nk__draw_begin(const struct nk_context*, const struct nk_buffer*);
  1239. /*/// #### nk__draw_end
  1240. /// Returns the vertex draw command at the end of the vertex draw command buffer
  1241. ///
  1242. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1243. /// const struct nk_draw_command* nk__draw_end(const struct nk_context *ctx, const struct nk_buffer *buf);
  1244. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1245. ///
  1246. /// Parameter | Description
  1247. /// ------------|-----------------------------------------------------------
  1248. /// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame
  1249. /// __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer
  1250. ///
  1251. /// Returns vertex draw command pointer pointing to the end of the last vertex draw command inside the vertex draw command buffer
  1252. */
  1253. NK_API const struct nk_draw_command* nk__draw_end(const struct nk_context*, const struct nk_buffer*);
  1254. /*/// #### nk__draw_next
  1255. /// Increments the vertex draw command buffer iterator
  1256. ///
  1257. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1258. /// const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*, const struct nk_buffer*, const struct nk_context*);
  1259. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1260. ///
  1261. /// Parameter | Description
  1262. /// ------------|-----------------------------------------------------------
  1263. /// __cmd__ | Must point to an previously either by `nk__draw_begin` or `nk__draw_next` returned vertex draw command
  1264. /// __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer
  1265. /// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame
  1266. ///
  1267. /// Returns vertex draw command pointer pointing to the end of the last vertex draw command inside the vertex draw command buffer
  1268. */
  1269. NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*, const struct nk_buffer*, const struct nk_context*);
  1270. /*/// #### nk_draw_foreach
  1271. /// Iterates over each vertex draw command inside a vertex draw command buffer
  1272. ///
  1273. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1274. /// #define nk_draw_foreach(cmd,ctx, b)
  1275. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1276. ///
  1277. /// Parameter | Description
  1278. /// ------------|-----------------------------------------------------------
  1279. /// __cmd__ | `nk_draw_command`iterator set to NULL
  1280. /// __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer
  1281. /// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame
  1282. */
  1283. #define nk_draw_foreach(cmd,ctx, b) for((cmd)=nk__draw_begin(ctx, b); (cmd)!=0; (cmd)=nk__draw_next(cmd, b, ctx))
  1284. #endif
  1285. /* =============================================================================
  1286. *
  1287. * WINDOW
  1288. *
  1289. * =============================================================================
  1290. /// ### Window
  1291. /// Windows are the main persistent state used inside nuklear and are life time
  1292. /// controlled by simply "retouching" (i.e. calling) each window each frame.
  1293. /// All widgets inside nuklear can only be added inside the function pair `nk_begin_xxx`
  1294. /// and `nk_end`. Calling any widgets outside these two functions will result in an
  1295. /// assert in debug or no state change in release mode.<br /><br />
  1296. ///
  1297. /// Each window holds frame persistent state like position, size, flags, state tables,
  1298. /// and some garbage collected internal persistent widget state. Each window
  1299. /// is linked into a window stack list which determines the drawing and overlapping
  1300. /// order. The topmost window thereby is the currently active window.<br /><br />
  1301. ///
  1302. /// To change window position inside the stack occurs either automatically by
  1303. /// user input by being clicked on or programmatically by calling `nk_window_focus`.
  1304. /// Windows by default are visible unless explicitly being defined with flag
  1305. /// `NK_WINDOW_HIDDEN`, the user clicked the close button on windows with flag
  1306. /// `NK_WINDOW_CLOSABLE` or if a window was explicitly hidden by calling
  1307. /// `nk_window_show`. To explicitly close and destroy a window call `nk_window_close`.<br /><br />
  1308. ///
  1309. /// #### Usage
  1310. /// To create and keep a window you have to call one of the two `nk_begin_xxx`
  1311. /// functions to start window declarations and `nk_end` at the end. Furthermore it
  1312. /// is recommended to check the return value of `nk_begin_xxx` and only process
  1313. /// widgets inside the window if the value is not 0. Either way you have to call
  1314. /// `nk_end` at the end of window declarations. Furthermore, do not attempt to
  1315. /// nest `nk_begin_xxx` calls which will hopefully result in an assert or if not
  1316. /// in a segmentation fault.
  1317. ///
  1318. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1319. /// if (nk_begin_xxx(...) {
  1320. /// // [... widgets ...]
  1321. /// }
  1322. /// nk_end(ctx);
  1323. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1324. ///
  1325. /// In the grand concept window and widget declarations need to occur after input
  1326. /// handling and before drawing to screen. Not doing so can result in higher
  1327. /// latency or at worst invalid behavior. Furthermore make sure that `nk_clear`
  1328. /// is called at the end of the frame. While nuklear's default platform backends
  1329. /// already call `nk_clear` for you if you write your own backend not calling
  1330. /// `nk_clear` can cause asserts or even worse undefined behavior.
  1331. ///
  1332. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1333. /// struct nk_context ctx;
  1334. /// nk_init_xxx(&ctx, ...);
  1335. /// while (1) {
  1336. /// Event evt;
  1337. /// nk_input_begin(&ctx);
  1338. /// while (GetEvent(&evt)) {
  1339. /// if (evt.type == MOUSE_MOVE)
  1340. /// nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
  1341. /// else if (evt.type == [...]) {
  1342. /// nk_input_xxx(...);
  1343. /// }
  1344. /// }
  1345. /// nk_input_end(&ctx);
  1346. ///
  1347. /// if (nk_begin_xxx(...) {
  1348. /// //[...]
  1349. /// }
  1350. /// nk_end(ctx);
  1351. ///
  1352. /// const struct nk_command *cmd = 0;
  1353. /// nk_foreach(cmd, &ctx) {
  1354. /// case NK_COMMAND_LINE:
  1355. /// your_draw_line_function(...)
  1356. /// break;
  1357. /// case NK_COMMAND_RECT
  1358. /// your_draw_rect_function(...)
  1359. /// break;
  1360. /// case //...:
  1361. /// //[...]
  1362. /// }
  1363. /// nk_clear(&ctx);
  1364. /// }
  1365. /// nk_free(&ctx);
  1366. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1367. ///
  1368. /// #### Reference
  1369. /// Function | Description
  1370. /// ------------------------------------|----------------------------------------
  1371. /// nk_begin | Starts a new window; needs to be called every frame for every window (unless hidden) or otherwise the window gets removed
  1372. /// nk_begin_titled | Extended window start with separated title and identifier to allow multiple windows with same name but not title
  1373. /// nk_end | Needs to be called at the end of the window building process to process scaling, scrollbars and general cleanup
  1374. //
  1375. /// nk_window_find | Finds and returns the window with give name
  1376. /// nk_window_get_bounds | Returns a rectangle with screen position and size of the currently processed window.
  1377. /// nk_window_get_position | Returns the position of the currently processed window
  1378. /// nk_window_get_size | Returns the size with width and height of the currently processed window
  1379. /// nk_window_get_width | Returns the width of the currently processed window
  1380. /// nk_window_get_height | Returns the height of the currently processed window
  1381. /// nk_window_get_panel | Returns the underlying panel which contains all processing state of the current window
  1382. /// nk_window_get_content_region | Returns the position and size of the currently visible and non-clipped space inside the currently processed window
  1383. /// nk_window_get_content_region_min | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
  1384. /// nk_window_get_content_region_max | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
  1385. /// nk_window_get_content_region_size | Returns the size of the currently visible and non-clipped space inside the currently processed window
  1386. /// nk_window_get_canvas | Returns the draw command buffer. Can be used to draw custom widgets
  1387. /// nk_window_get_scroll | Gets the scroll offset of the current window
  1388. /// nk_window_has_focus | Returns if the currently processed window is currently active
  1389. /// nk_window_is_collapsed | Returns if the window with given name is currently minimized/collapsed
  1390. /// nk_window_is_closed | Returns if the currently processed window was closed
  1391. /// nk_window_is_hidden | Returns if the currently processed window was hidden
  1392. /// nk_window_is_active | Same as nk_window_has_focus for some reason
  1393. /// nk_window_is_hovered | Returns if the currently processed window is currently being hovered by mouse
  1394. /// nk_window_is_any_hovered | Return if any window currently hovered
  1395. /// nk_item_is_any_active | Returns if any window or widgets is currently hovered or active
  1396. //
  1397. /// nk_window_set_bounds | Updates position and size of the currently processed window
  1398. /// nk_window_set_position | Updates position of the currently process window
  1399. /// nk_window_set_size | Updates the size of the currently processed window
  1400. /// nk_window_set_focus | Set the currently processed window as active window
  1401. /// nk_window_set_scroll | Sets the scroll offset of the current window
  1402. //
  1403. /// nk_window_close | Closes the window with given window name which deletes the window at the end of the frame
  1404. /// nk_window_collapse | Collapses the window with given window name
  1405. /// nk_window_collapse_if | Collapses the window with given window name if the given condition was met
  1406. /// nk_window_show | Hides a visible or reshows a hidden window
  1407. /// nk_window_show_if | Hides/shows a window depending on condition
  1408. */
  1409. /*
  1410. /// #### nk_panel_flags
  1411. /// Flag | Description
  1412. /// ----------------------------|----------------------------------------
  1413. /// NK_WINDOW_BORDER | Draws a border around the window to visually separate window from the background
  1414. /// NK_WINDOW_MOVABLE | The movable flag indicates that a window can be moved by user input or by dragging the window header
  1415. /// NK_WINDOW_SCALABLE | The scalable flag indicates that a window can be scaled by user input by dragging a scaler icon at the button of the window
  1416. /// NK_WINDOW_CLOSABLE | Adds a closable icon into the header
  1417. /// NK_WINDOW_MINIMIZABLE | Adds a minimize icon into the header
  1418. /// NK_WINDOW_NO_SCROLLBAR | Removes the scrollbar from the window
  1419. /// NK_WINDOW_TITLE | Forces a header at the top at the window showing the title
  1420. /// NK_WINDOW_SCROLL_AUTO_HIDE | Automatically hides the window scrollbar if no user interaction: also requires delta time in `nk_context` to be set each frame
  1421. /// NK_WINDOW_BACKGROUND | Always keep window in the background
  1422. /// NK_WINDOW_SCALE_LEFT | Puts window scaler in the left-bottom corner instead right-bottom
  1423. /// NK_WINDOW_NO_INPUT | Prevents window of scaling, moving or getting focus
  1424. ///
  1425. /// #### nk_collapse_states
  1426. /// State | Description
  1427. /// ----------------|-----------------------------------------------------------
  1428. /// __NK_MINIMIZED__| UI section is collased and not visibile until maximized
  1429. /// __NK_MAXIMIZED__| UI section is extended and visibile until minimized
  1430. /// <br /><br />
  1431. */
  1432. enum nk_panel_flags {
  1433. NK_WINDOW_BORDER = NK_FLAG(0),
  1434. NK_WINDOW_MOVABLE = NK_FLAG(1),
  1435. NK_WINDOW_SCALABLE = NK_FLAG(2),
  1436. NK_WINDOW_CLOSABLE = NK_FLAG(3),
  1437. NK_WINDOW_MINIMIZABLE = NK_FLAG(4),
  1438. NK_WINDOW_NO_SCROLLBAR = NK_FLAG(5),
  1439. NK_WINDOW_TITLE = NK_FLAG(6),
  1440. NK_WINDOW_SCROLL_AUTO_HIDE = NK_FLAG(7),
  1441. NK_WINDOW_BACKGROUND = NK_FLAG(8),
  1442. NK_WINDOW_SCALE_LEFT = NK_FLAG(9),
  1443. NK_WINDOW_NO_INPUT = NK_FLAG(10)
  1444. };
  1445. /*/// #### nk_begin
  1446. /// Starts a new window; needs to be called every frame for every
  1447. /// window (unless hidden) or otherwise the window gets removed
  1448. ///
  1449. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1450. /// int nk_begin(struct nk_context *ctx, const char *title, struct nk_rect bounds, nk_flags flags);
  1451. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1452. ///
  1453. /// Parameter | Description
  1454. /// ------------|-----------------------------------------------------------
  1455. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1456. /// __title__ | Window title and identifier. Needs to be persistent over frames to identify the window
  1457. /// __bounds__ | Initial position and window size. However if you do not define `NK_WINDOW_SCALABLE` or `NK_WINDOW_MOVABLE` you can set window position and size every frame
  1458. /// __flags__ | Window flags defined in the nk_panel_flags section with a number of different window behaviors
  1459. ///
  1460. /// Returns `true(1)` if the window can be filled up with widgets from this point
  1461. /// until `nk_end` or `false(0)` otherwise for example if minimized
  1462. */
  1463. NK_API int nk_begin(struct nk_context *ctx, const char *title, struct nk_rect bounds, nk_flags flags);
  1464. /*/// #### nk_begin_titled
  1465. /// Extended window start with separated title and identifier to allow multiple
  1466. /// windows with same title but not name
  1467. ///
  1468. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1469. /// int nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, struct nk_rect bounds, nk_flags flags);
  1470. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1471. ///
  1472. /// Parameter | Description
  1473. /// ------------|-----------------------------------------------------------
  1474. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1475. /// __name__ | Window identifier. Needs to be persistent over frames to identify the window
  1476. /// __title__ | Window title displayed inside header if flag `NK_WINDOW_TITLE` or either `NK_WINDOW_CLOSABLE` or `NK_WINDOW_MINIMIZED` was set
  1477. /// __bounds__ | Initial position and window size. However if you do not define `NK_WINDOW_SCALABLE` or `NK_WINDOW_MOVABLE` you can set window position and size every frame
  1478. /// __flags__ | Window flags defined in the nk_panel_flags section with a number of different window behaviors
  1479. ///
  1480. /// Returns `true(1)` if the window can be filled up with widgets from this point
  1481. /// until `nk_end` or `false(0)` otherwise for example if minimized
  1482. */
  1483. NK_API int nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, struct nk_rect bounds, nk_flags flags);
  1484. /*/// #### nk_end
  1485. /// Needs to be called at the end of the window building process to process scaling, scrollbars and general cleanup.
  1486. /// All widget calls after this functions will result in asserts or no state changes
  1487. ///
  1488. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1489. /// void nk_end(struct nk_context *ctx);
  1490. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1491. ///
  1492. /// Parameter | Description
  1493. /// ------------|-----------------------------------------------------------
  1494. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1495. */
  1496. NK_API void nk_end(struct nk_context *ctx);
  1497. /*/// #### nk_window_find
  1498. /// Finds and returns a window from passed name
  1499. ///
  1500. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1501. /// struct nk_window *nk_window_find(struct nk_context *ctx, const char *name);
  1502. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1503. ///
  1504. /// Parameter | Description
  1505. /// ------------|-----------------------------------------------------------
  1506. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1507. /// __name__ | Window identifier
  1508. ///
  1509. /// Returns a `nk_window` struct pointing to the identified window or NULL if
  1510. /// no window with the given name was found
  1511. */
  1512. NK_API struct nk_window *nk_window_find(struct nk_context *ctx, const char *name);
  1513. /*/// #### nk_window_get_bounds
  1514. /// Returns a rectangle with screen position and size of the currently processed window
  1515. ///
  1516. /// !!! WARNING
  1517. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1518. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1519. /// struct nk_rect nk_window_get_bounds(const struct nk_context *ctx);
  1520. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1521. ///
  1522. /// Parameter | Description
  1523. /// ------------|-----------------------------------------------------------
  1524. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1525. ///
  1526. /// Returns a `nk_rect` struct with window upper left window position and size
  1527. */
  1528. NK_API struct nk_rect nk_window_get_bounds(const struct nk_context *ctx);
  1529. /*/// #### nk_window_get_position
  1530. /// Returns the position of the currently processed window.
  1531. ///
  1532. /// !!! WARNING
  1533. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1534. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1535. /// struct nk_vec2 nk_window_get_position(const struct nk_context *ctx);
  1536. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1537. ///
  1538. /// Parameter | Description
  1539. /// ------------|-----------------------------------------------------------
  1540. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1541. ///
  1542. /// Returns a `nk_vec2` struct with window upper left position
  1543. */
  1544. NK_API struct nk_vec2 nk_window_get_position(const struct nk_context *ctx);
  1545. /*/// #### nk_window_get_size
  1546. /// Returns the size with width and height of the currently processed window.
  1547. ///
  1548. /// !!! WARNING
  1549. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1550. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1551. /// struct nk_vec2 nk_window_get_size(const struct nk_context *ctx);
  1552. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1553. ///
  1554. /// Parameter | Description
  1555. /// ------------|-----------------------------------------------------------
  1556. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1557. ///
  1558. /// Returns a `nk_vec2` struct with window width and height
  1559. */
  1560. NK_API struct nk_vec2 nk_window_get_size(const struct nk_context*);
  1561. /*/// #### nk_window_get_width
  1562. /// Returns the width of the currently processed window.
  1563. ///
  1564. /// !!! WARNING
  1565. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1566. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1567. /// float nk_window_get_width(const struct nk_context *ctx);
  1568. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1569. ///
  1570. /// Parameter | Description
  1571. /// ------------|-----------------------------------------------------------
  1572. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1573. ///
  1574. /// Returns the current window width
  1575. */
  1576. NK_API float nk_window_get_width(const struct nk_context*);
  1577. /*/// #### nk_window_get_height
  1578. /// Returns the height of the currently processed window.
  1579. ///
  1580. /// !!! WARNING
  1581. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1582. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1583. /// float nk_window_get_height(const struct nk_context *ctx);
  1584. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1585. ///
  1586. /// Parameter | Description
  1587. /// ------------|-----------------------------------------------------------
  1588. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1589. ///
  1590. /// Returns the current window height
  1591. */
  1592. NK_API float nk_window_get_height(const struct nk_context*);
  1593. /*/// #### nk_window_get_panel
  1594. /// Returns the underlying panel which contains all processing state of the current window.
  1595. ///
  1596. /// !!! WARNING
  1597. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1598. /// !!! WARNING
  1599. /// Do not keep the returned panel pointer around, it is only valid until `nk_end`
  1600. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1601. /// struct nk_panel* nk_window_get_panel(struct nk_context *ctx);
  1602. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1603. ///
  1604. /// Parameter | Description
  1605. /// ------------|-----------------------------------------------------------
  1606. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1607. ///
  1608. /// Returns a pointer to window internal `nk_panel` state.
  1609. */
  1610. NK_API struct nk_panel* nk_window_get_panel(struct nk_context*);
  1611. /*/// #### nk_window_get_content_region
  1612. /// Returns the position and size of the currently visible and non-clipped space
  1613. /// inside the currently processed window.
  1614. ///
  1615. /// !!! WARNING
  1616. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1617. ///
  1618. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1619. /// struct nk_rect nk_window_get_content_region(struct nk_context *ctx);
  1620. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1621. ///
  1622. /// Parameter | Description
  1623. /// ------------|-----------------------------------------------------------
  1624. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1625. ///
  1626. /// Returns `nk_rect` struct with screen position and size (no scrollbar offset)
  1627. /// of the visible space inside the current window
  1628. */
  1629. NK_API struct nk_rect nk_window_get_content_region(struct nk_context*);
  1630. /*/// #### nk_window_get_content_region_min
  1631. /// Returns the upper left position of the currently visible and non-clipped
  1632. /// space inside the currently processed window.
  1633. ///
  1634. /// !!! WARNING
  1635. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1636. ///
  1637. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1638. /// struct nk_vec2 nk_window_get_content_region_min(struct nk_context *ctx);
  1639. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1640. ///
  1641. /// Parameter | Description
  1642. /// ------------|-----------------------------------------------------------
  1643. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1644. ///
  1645. /// returns `nk_vec2` struct with upper left screen position (no scrollbar offset)
  1646. /// of the visible space inside the current window
  1647. */
  1648. NK_API struct nk_vec2 nk_window_get_content_region_min(struct nk_context*);
  1649. /*/// #### nk_window_get_content_region_max
  1650. /// Returns the lower right screen position of the currently visible and
  1651. /// non-clipped space inside the currently processed window.
  1652. ///
  1653. /// !!! WARNING
  1654. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1655. ///
  1656. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1657. /// struct nk_vec2 nk_window_get_content_region_max(struct nk_context *ctx);
  1658. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1659. ///
  1660. /// Parameter | Description
  1661. /// ------------|-----------------------------------------------------------
  1662. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1663. ///
  1664. /// Returns `nk_vec2` struct with lower right screen position (no scrollbar offset)
  1665. /// of the visible space inside the current window
  1666. */
  1667. NK_API struct nk_vec2 nk_window_get_content_region_max(struct nk_context*);
  1668. /*/// #### nk_window_get_content_region_size
  1669. /// Returns the size of the currently visible and non-clipped space inside the
  1670. /// currently processed window
  1671. ///
  1672. /// !!! WARNING
  1673. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1674. ///
  1675. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1676. /// struct nk_vec2 nk_window_get_content_region_size(struct nk_context *ctx);
  1677. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1678. ///
  1679. /// Parameter | Description
  1680. /// ------------|-----------------------------------------------------------
  1681. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1682. ///
  1683. /// Returns `nk_vec2` struct with size the visible space inside the current window
  1684. */
  1685. NK_API struct nk_vec2 nk_window_get_content_region_size(struct nk_context*);
  1686. /*/// #### nk_window_get_canvas
  1687. /// Returns the draw command buffer. Can be used to draw custom widgets
  1688. /// !!! WARNING
  1689. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1690. /// !!! WARNING
  1691. /// Do not keep the returned command buffer pointer around it is only valid until `nk_end`
  1692. ///
  1693. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1694. /// struct nk_command_buffer* nk_window_get_canvas(struct nk_context *ctx);
  1695. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1696. ///
  1697. /// Parameter | Description
  1698. /// ------------|-----------------------------------------------------------
  1699. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1700. ///
  1701. /// Returns a pointer to window internal `nk_command_buffer` struct used as
  1702. /// drawing canvas. Can be used to do custom drawing.
  1703. */
  1704. NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*);
  1705. /*/// #### nk_window_get_scroll
  1706. /// Gets the scroll offset for the current window
  1707. /// !!! WARNING
  1708. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1709. ///
  1710. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1711. /// void nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y);
  1712. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1713. ///
  1714. /// Parameter | Description
  1715. /// -------------|-----------------------------------------------------------
  1716. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1717. /// __offset_x__ | A pointer to the x offset output (or NULL to ignore)
  1718. /// __offset_y__ | A pointer to the y offset output (or NULL to ignore)
  1719. */
  1720. NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y);
  1721. /*/// #### nk_window_has_focus
  1722. /// Returns if the currently processed window is currently active
  1723. /// !!! WARNING
  1724. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1725. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1726. /// int nk_window_has_focus(const struct nk_context *ctx);
  1727. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1728. ///
  1729. /// Parameter | Description
  1730. /// ------------|-----------------------------------------------------------
  1731. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1732. ///
  1733. /// Returns `false(0)` if current window is not active or `true(1)` if it is
  1734. */
  1735. NK_API int nk_window_has_focus(const struct nk_context*);
  1736. /*/// #### nk_window_is_hovered
  1737. /// Return if the current window is being hovered
  1738. /// !!! WARNING
  1739. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1740. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1741. /// int nk_window_is_hovered(struct nk_context *ctx);
  1742. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1743. ///
  1744. /// Parameter | Description
  1745. /// ------------|-----------------------------------------------------------
  1746. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1747. ///
  1748. /// Returns `true(1)` if current window is hovered or `false(0)` otherwise
  1749. */
  1750. NK_API int nk_window_is_hovered(struct nk_context*);
  1751. /*/// #### nk_window_is_collapsed
  1752. /// Returns if the window with given name is currently minimized/collapsed
  1753. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1754. /// int nk_window_is_collapsed(struct nk_context *ctx, const char *name);
  1755. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1756. ///
  1757. /// Parameter | Description
  1758. /// ------------|-----------------------------------------------------------
  1759. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1760. /// __name__ | Identifier of window you want to check if it is collapsed
  1761. ///
  1762. /// Returns `true(1)` if current window is minimized and `false(0)` if window not
  1763. /// found or is not minimized
  1764. */
  1765. NK_API int nk_window_is_collapsed(struct nk_context *ctx, const char *name);
  1766. /*/// #### nk_window_is_closed
  1767. /// Returns if the window with given name was closed by calling `nk_close`
  1768. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1769. /// int nk_window_is_closed(struct nk_context *ctx, const char *name);
  1770. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1771. ///
  1772. /// Parameter | Description
  1773. /// ------------|-----------------------------------------------------------
  1774. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1775. /// __name__ | Identifier of window you want to check if it is closed
  1776. ///
  1777. /// Returns `true(1)` if current window was closed or `false(0)` window not found or not closed
  1778. */
  1779. NK_API int nk_window_is_closed(struct nk_context*, const char*);
  1780. /*/// #### nk_window_is_hidden
  1781. /// Returns if the window with given name is hidden
  1782. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1783. /// int nk_window_is_hidden(struct nk_context *ctx, const char *name);
  1784. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1785. ///
  1786. /// Parameter | Description
  1787. /// ------------|-----------------------------------------------------------
  1788. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1789. /// __name__ | Identifier of window you want to check if it is hidden
  1790. ///
  1791. /// Returns `true(1)` if current window is hidden or `false(0)` window not found or visible
  1792. */
  1793. NK_API int nk_window_is_hidden(struct nk_context*, const char*);
  1794. /*/// #### nk_window_is_active
  1795. /// Same as nk_window_has_focus for some reason
  1796. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1797. /// int nk_window_is_active(struct nk_context *ctx, const char *name);
  1798. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1799. ///
  1800. /// Parameter | Description
  1801. /// ------------|-----------------------------------------------------------
  1802. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1803. /// __name__ | Identifier of window you want to check if it is active
  1804. ///
  1805. /// Returns `true(1)` if current window is active or `false(0)` window not found or not active
  1806. */
  1807. NK_API int nk_window_is_active(struct nk_context*, const char*);
  1808. /*/// #### nk_window_is_any_hovered
  1809. /// Returns if the any window is being hovered
  1810. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1811. /// int nk_window_is_any_hovered(struct nk_context*);
  1812. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1813. ///
  1814. /// Parameter | Description
  1815. /// ------------|-----------------------------------------------------------
  1816. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1817. ///
  1818. /// Returns `true(1)` if any window is hovered or `false(0)` otherwise
  1819. */
  1820. NK_API int nk_window_is_any_hovered(struct nk_context*);
  1821. /*/// #### nk_item_is_any_active
  1822. /// Returns if the any window is being hovered or any widget is currently active.
  1823. /// Can be used to decide if input should be processed by UI or your specific input handling.
  1824. /// Example could be UI and 3D camera to move inside a 3D space.
  1825. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1826. /// int nk_item_is_any_active(struct nk_context*);
  1827. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1828. ///
  1829. /// Parameter | Description
  1830. /// ------------|-----------------------------------------------------------
  1831. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1832. ///
  1833. /// Returns `true(1)` if any window is hovered or any item is active or `false(0)` otherwise
  1834. */
  1835. NK_API int nk_item_is_any_active(struct nk_context*);
  1836. /*/// #### nk_window_set_bounds
  1837. /// Updates position and size of window with passed in name
  1838. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1839. /// void nk_window_set_bounds(struct nk_context*, const char *name, struct nk_rect bounds);
  1840. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1841. ///
  1842. /// Parameter | Description
  1843. /// ------------|-----------------------------------------------------------
  1844. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1845. /// __name__ | Identifier of the window to modify both position and size
  1846. /// __bounds__ | Must point to a `nk_rect` struct with the new position and size
  1847. */
  1848. NK_API void nk_window_set_bounds(struct nk_context*, const char *name, struct nk_rect bounds);
  1849. /*/// #### nk_window_set_position
  1850. /// Updates position of window with passed name
  1851. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1852. /// void nk_window_set_position(struct nk_context*, const char *name, struct nk_vec2 pos);
  1853. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1854. ///
  1855. /// Parameter | Description
  1856. /// ------------|-----------------------------------------------------------
  1857. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1858. /// __name__ | Identifier of the window to modify both position
  1859. /// __pos__ | Must point to a `nk_vec2` struct with the new position
  1860. */
  1861. NK_API void nk_window_set_position(struct nk_context*, const char *name, struct nk_vec2 pos);
  1862. /*/// #### nk_window_set_size
  1863. /// Updates size of window with passed in name
  1864. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1865. /// void nk_window_set_size(struct nk_context*, const char *name, struct nk_vec2);
  1866. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1867. ///
  1868. /// Parameter | Description
  1869. /// ------------|-----------------------------------------------------------
  1870. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1871. /// __name__ | Identifier of the window to modify both window size
  1872. /// __size__ | Must point to a `nk_vec2` struct with new window size
  1873. */
  1874. NK_API void nk_window_set_size(struct nk_context*, const char *name, struct nk_vec2);
  1875. /*/// #### nk_window_set_focus
  1876. /// Sets the window with given name as active
  1877. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1878. /// void nk_window_set_focus(struct nk_context*, const char *name);
  1879. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1880. ///
  1881. /// Parameter | Description
  1882. /// ------------|-----------------------------------------------------------
  1883. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1884. /// __name__ | Identifier of the window to set focus on
  1885. */
  1886. NK_API void nk_window_set_focus(struct nk_context*, const char *name);
  1887. /*/// #### nk_window_set_scroll
  1888. /// Sets the scroll offset for the current window
  1889. /// !!! WARNING
  1890. /// Only call this function between calls `nk_begin_xxx` and `nk_end`
  1891. ///
  1892. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1893. /// void nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y);
  1894. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1895. ///
  1896. /// Parameter | Description
  1897. /// -------------|-----------------------------------------------------------
  1898. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1899. /// __offset_x__ | The x offset to scroll to
  1900. /// __offset_y__ | The y offset to scroll to
  1901. */
  1902. NK_API void nk_window_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y);
  1903. /*/// #### nk_window_close
  1904. /// Closes a window and marks it for being freed at the end of the frame
  1905. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1906. /// void nk_window_close(struct nk_context *ctx, const char *name);
  1907. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1908. ///
  1909. /// Parameter | Description
  1910. /// ------------|-----------------------------------------------------------
  1911. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1912. /// __name__ | Identifier of the window to close
  1913. */
  1914. NK_API void nk_window_close(struct nk_context *ctx, const char *name);
  1915. /*/// #### nk_window_collapse
  1916. /// Updates collapse state of a window with given name
  1917. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1918. /// void nk_window_collapse(struct nk_context*, const char *name, enum nk_collapse_states state);
  1919. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1920. ///
  1921. /// Parameter | Description
  1922. /// ------------|-----------------------------------------------------------
  1923. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1924. /// __name__ | Identifier of the window to close
  1925. /// __state__ | value out of nk_collapse_states section
  1926. */
  1927. NK_API void nk_window_collapse(struct nk_context*, const char *name, enum nk_collapse_states state);
  1928. /*/// #### nk_window_collapse_if
  1929. /// Updates collapse state of a window with given name if given condition is met
  1930. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1931. /// void nk_window_collapse_if(struct nk_context*, const char *name, enum nk_collapse_states, int cond);
  1932. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1933. ///
  1934. /// Parameter | Description
  1935. /// ------------|-----------------------------------------------------------
  1936. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1937. /// __name__ | Identifier of the window to either collapse or maximize
  1938. /// __state__ | value out of nk_collapse_states section the window should be put into
  1939. /// __cond__ | condition that has to be met to actually commit the collapse state change
  1940. */
  1941. NK_API void nk_window_collapse_if(struct nk_context*, const char *name, enum nk_collapse_states, int cond);
  1942. /*/// #### nk_window_show
  1943. /// updates visibility state of a window with given name
  1944. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1945. /// void nk_window_show(struct nk_context*, const char *name, enum nk_show_states);
  1946. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1947. ///
  1948. /// Parameter | Description
  1949. /// ------------|-----------------------------------------------------------
  1950. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1951. /// __name__ | Identifier of the window to either collapse or maximize
  1952. /// __state__ | state with either visible or hidden to modify the window with
  1953. */
  1954. NK_API void nk_window_show(struct nk_context*, const char *name, enum nk_show_states);
  1955. /*/// #### nk_window_show_if
  1956. /// Updates visibility state of a window with given name if a given condition is met
  1957. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  1958. /// void nk_window_show_if(struct nk_context*, const char *name, enum nk_show_states, int cond);
  1959. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1960. ///
  1961. /// Parameter | Description
  1962. /// ------------|-----------------------------------------------------------
  1963. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  1964. /// __name__ | Identifier of the window to either hide or show
  1965. /// __state__ | state with either visible or hidden to modify the window with
  1966. /// __cond__ | condition that has to be met to actually commit the visbility state change
  1967. */
  1968. NK_API void nk_window_show_if(struct nk_context*, const char *name, enum nk_show_states, int cond);
  1969. /* =============================================================================
  1970. *
  1971. * LAYOUT
  1972. *
  1973. * =============================================================================
  1974. /// ### Layouting
  1975. /// Layouting in general describes placing widget inside a window with position and size.
  1976. /// While in this particular implementation there are five different APIs for layouting
  1977. /// each with different trade offs between control and ease of use. <br /><br />
  1978. ///
  1979. /// All layouting methods in this library are based around the concept of a row.
  1980. /// A row has a height the window content grows by and a number of columns and each
  1981. /// layouting method specifies how each widget is placed inside the row.
  1982. /// After a row has been allocated by calling a layouting functions and then
  1983. /// filled with widgets will advance an internal pointer over the allocated row. <br /><br />
  1984. ///
  1985. /// To actually define a layout you just call the appropriate layouting function
  1986. /// and each subsequent widget call will place the widget as specified. Important
  1987. /// here is that if you define more widgets then columns defined inside the layout
  1988. /// functions it will allocate the next row without you having to make another layouting <br /><br />
  1989. /// call.
  1990. ///
  1991. /// Biggest limitation with using all these APIs outside the `nk_layout_space_xxx` API
  1992. /// is that you have to define the row height for each. However the row height
  1993. /// often depends on the height of the font. <br /><br />
  1994. ///
  1995. /// To fix that internally nuklear uses a minimum row height that is set to the
  1996. /// height plus padding of currently active font and overwrites the row height
  1997. /// value if zero. <br /><br />
  1998. ///
  1999. /// If you manually want to change the minimum row height then
  2000. /// use nk_layout_set_min_row_height, and use nk_layout_reset_min_row_height to
  2001. /// reset it back to be derived from font height. <br /><br />
  2002. ///
  2003. /// Also if you change the font in nuklear it will automatically change the minimum
  2004. /// row height for you and. This means if you change the font but still want
  2005. /// a minimum row height smaller than the font you have to repush your value. <br /><br />
  2006. ///
  2007. /// For actually more advanced UI I would even recommend using the `nk_layout_space_xxx`
  2008. /// layouting method in combination with a cassowary constraint solver (there are
  2009. /// some versions on github with permissive license model) to take over all control over widget
  2010. /// layouting yourself. However for quick and dirty layouting using all the other layouting
  2011. /// functions should be fine.
  2012. ///
  2013. /// #### Usage
  2014. /// 1. __nk_layout_row_dynamic__<br /><br />
  2015. /// The easiest layouting function is `nk_layout_row_dynamic`. It provides each
  2016. /// widgets with same horizontal space inside the row and dynamically grows
  2017. /// if the owning window grows in width. So the number of columns dictates
  2018. /// the size of each widget dynamically by formula:
  2019. ///
  2020. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2021. /// widget_width = (window_width - padding - spacing) * (1/colum_count)
  2022. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2023. ///
  2024. /// Just like all other layouting APIs if you define more widget than columns this
  2025. /// library will allocate a new row and keep all layouting parameters previously
  2026. /// defined.
  2027. ///
  2028. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2029. /// if (nk_begin_xxx(...) {
  2030. /// // first row with height: 30 composed of two widgets
  2031. /// nk_layout_row_dynamic(&ctx, 30, 2);
  2032. /// nk_widget(...);
  2033. /// nk_widget(...);
  2034. /// //
  2035. /// // second row with same parameter as defined above
  2036. /// nk_widget(...);
  2037. /// nk_widget(...);
  2038. /// //
  2039. /// // third row uses 0 for height which will use auto layouting
  2040. /// nk_layout_row_dynamic(&ctx, 0, 2);
  2041. /// nk_widget(...);
  2042. /// nk_widget(...);
  2043. /// }
  2044. /// nk_end(...);
  2045. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2046. ///
  2047. /// 2. __nk_layout_row_static__<br /><br />
  2048. /// Another easy layouting function is `nk_layout_row_static`. It provides each
  2049. /// widget with same horizontal pixel width inside the row and does not grow
  2050. /// if the owning window scales smaller or bigger.
  2051. ///
  2052. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2053. /// if (nk_begin_xxx(...) {
  2054. /// // first row with height: 30 composed of two widgets with width: 80
  2055. /// nk_layout_row_static(&ctx, 30, 80, 2);
  2056. /// nk_widget(...);
  2057. /// nk_widget(...);
  2058. /// //
  2059. /// // second row with same parameter as defined above
  2060. /// nk_widget(...);
  2061. /// nk_widget(...);
  2062. /// //
  2063. /// // third row uses 0 for height which will use auto layouting
  2064. /// nk_layout_row_static(&ctx, 0, 80, 2);
  2065. /// nk_widget(...);
  2066. /// nk_widget(...);
  2067. /// }
  2068. /// nk_end(...);
  2069. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2070. ///
  2071. /// 3. __nk_layout_row_xxx__<br /><br />
  2072. /// A little bit more advanced layouting API are functions `nk_layout_row_begin`,
  2073. /// `nk_layout_row_push` and `nk_layout_row_end`. They allow to directly
  2074. /// specify each column pixel or window ratio in a row. It supports either
  2075. /// directly setting per column pixel width or widget window ratio but not
  2076. /// both. Furthermore it is a immediate mode API so each value is directly
  2077. /// pushed before calling a widget. Therefore the layout is not automatically
  2078. /// repeating like the last two layouting functions.
  2079. ///
  2080. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2081. /// if (nk_begin_xxx(...) {
  2082. /// // first row with height: 25 composed of two widgets with width 60 and 40
  2083. /// nk_layout_row_begin(ctx, NK_STATIC, 25, 2);
  2084. /// nk_layout_row_push(ctx, 60);
  2085. /// nk_widget(...);
  2086. /// nk_layout_row_push(ctx, 40);
  2087. /// nk_widget(...);
  2088. /// nk_layout_row_end(ctx);
  2089. /// //
  2090. /// // second row with height: 25 composed of two widgets with window ratio 0.25 and 0.75
  2091. /// nk_layout_row_begin(ctx, NK_DYNAMIC, 25, 2);
  2092. /// nk_layout_row_push(ctx, 0.25f);
  2093. /// nk_widget(...);
  2094. /// nk_layout_row_push(ctx, 0.75f);
  2095. /// nk_widget(...);
  2096. /// nk_layout_row_end(ctx);
  2097. /// //
  2098. /// // third row with auto generated height: composed of two widgets with window ratio 0.25 and 0.75
  2099. /// nk_layout_row_begin(ctx, NK_DYNAMIC, 0, 2);
  2100. /// nk_layout_row_push(ctx, 0.25f);
  2101. /// nk_widget(...);
  2102. /// nk_layout_row_push(ctx, 0.75f);
  2103. /// nk_widget(...);
  2104. /// nk_layout_row_end(ctx);
  2105. /// }
  2106. /// nk_end(...);
  2107. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2108. ///
  2109. /// 4. __nk_layout_row__<br /><br />
  2110. /// The array counterpart to API nk_layout_row_xxx is the single nk_layout_row
  2111. /// functions. Instead of pushing either pixel or window ratio for every widget
  2112. /// it allows to define it by array. The trade of for less control is that
  2113. /// `nk_layout_row` is automatically repeating. Otherwise the behavior is the
  2114. /// same.
  2115. ///
  2116. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2117. /// if (nk_begin_xxx(...) {
  2118. /// // two rows with height: 30 composed of two widgets with width 60 and 40
  2119. /// const float size[] = {60,40};
  2120. /// nk_layout_row(ctx, NK_STATIC, 30, 2, ratio);
  2121. /// nk_widget(...);
  2122. /// nk_widget(...);
  2123. /// nk_widget(...);
  2124. /// nk_widget(...);
  2125. /// //
  2126. /// // two rows with height: 30 composed of two widgets with window ratio 0.25 and 0.75
  2127. /// const float ratio[] = {0.25, 0.75};
  2128. /// nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
  2129. /// nk_widget(...);
  2130. /// nk_widget(...);
  2131. /// nk_widget(...);
  2132. /// nk_widget(...);
  2133. /// //
  2134. /// // two rows with auto generated height composed of two widgets with window ratio 0.25 and 0.75
  2135. /// const float ratio[] = {0.25, 0.75};
  2136. /// nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
  2137. /// nk_widget(...);
  2138. /// nk_widget(...);
  2139. /// nk_widget(...);
  2140. /// nk_widget(...);
  2141. /// }
  2142. /// nk_end(...);
  2143. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2144. ///
  2145. /// 5. __nk_layout_row_template_xxx__<br /><br />
  2146. /// The most complex and second most flexible API is a simplified flexbox version without
  2147. /// line wrapping and weights for dynamic widgets. It is an immediate mode API but
  2148. /// unlike `nk_layout_row_xxx` it has auto repeat behavior and needs to be called
  2149. /// before calling the templated widgets.
  2150. /// The row template layout has three different per widget size specifier. The first
  2151. /// one is the `nk_layout_row_template_push_static` with fixed widget pixel width.
  2152. /// They do not grow if the row grows and will always stay the same.
  2153. /// The second size specifier is `nk_layout_row_template_push_variable`
  2154. /// which defines a minimum widget size but it also can grow if more space is available
  2155. /// not taken by other widgets.
  2156. /// Finally there are dynamic widgets with `nk_layout_row_template_push_dynamic`
  2157. /// which are completely flexible and unlike variable widgets can even shrink
  2158. /// to zero if not enough space is provided.
  2159. ///
  2160. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2161. /// if (nk_begin_xxx(...) {
  2162. /// // two rows with height: 30 composed of three widgets
  2163. /// nk_layout_row_template_begin(ctx, 30);
  2164. /// nk_layout_row_template_push_dynamic(ctx);
  2165. /// nk_layout_row_template_push_variable(ctx, 80);
  2166. /// nk_layout_row_template_push_static(ctx, 80);
  2167. /// nk_layout_row_template_end(ctx);
  2168. /// //
  2169. /// // first row
  2170. /// nk_widget(...); // dynamic widget can go to zero if not enough space
  2171. /// nk_widget(...); // variable widget with min 80 pixel but can grow bigger if enough space
  2172. /// nk_widget(...); // static widget with fixed 80 pixel width
  2173. /// //
  2174. /// // second row same layout
  2175. /// nk_widget(...);
  2176. /// nk_widget(...);
  2177. /// nk_widget(...);
  2178. /// }
  2179. /// nk_end(...);
  2180. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2181. ///
  2182. /// 6. __nk_layout_space_xxx__<br /><br />
  2183. /// Finally the most flexible API directly allows you to place widgets inside the
  2184. /// window. The space layout API is an immediate mode API which does not support
  2185. /// row auto repeat and directly sets position and size of a widget. Position
  2186. /// and size hereby can be either specified as ratio of allocated space or
  2187. /// allocated space local position and pixel size. Since this API is quite
  2188. /// powerful there are a number of utility functions to get the available space
  2189. /// and convert between local allocated space and screen space.
  2190. ///
  2191. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2192. /// if (nk_begin_xxx(...) {
  2193. /// // static row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
  2194. /// nk_layout_space_begin(ctx, NK_STATIC, 500, INT_MAX);
  2195. /// nk_layout_space_push(ctx, nk_rect(0,0,150,200));
  2196. /// nk_widget(...);
  2197. /// nk_layout_space_push(ctx, nk_rect(200,200,100,200));
  2198. /// nk_widget(...);
  2199. /// nk_layout_space_end(ctx);
  2200. /// //
  2201. /// // dynamic row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
  2202. /// nk_layout_space_begin(ctx, NK_DYNAMIC, 500, INT_MAX);
  2203. /// nk_layout_space_push(ctx, nk_rect(0.5,0.5,0.1,0.1));
  2204. /// nk_widget(...);
  2205. /// nk_layout_space_push(ctx, nk_rect(0.7,0.6,0.1,0.1));
  2206. /// nk_widget(...);
  2207. /// }
  2208. /// nk_end(...);
  2209. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2210. ///
  2211. /// #### Reference
  2212. /// Function | Description
  2213. /// ----------------------------------------|------------------------------------
  2214. /// nk_layout_set_min_row_height | Set the currently used minimum row height to a specified value
  2215. /// nk_layout_reset_min_row_height | Resets the currently used minimum row height to font height
  2216. /// nk_layout_widget_bounds | Calculates current width a static layout row can fit inside a window
  2217. /// nk_layout_ratio_from_pixel | Utility functions to calculate window ratio from pixel size
  2218. //
  2219. /// nk_layout_row_dynamic | Current layout is divided into n same sized growing columns
  2220. /// nk_layout_row_static | Current layout is divided into n same fixed sized columns
  2221. /// nk_layout_row_begin | Starts a new row with given height and number of columns
  2222. /// nk_layout_row_push | Pushes another column with given size or window ratio
  2223. /// nk_layout_row_end | Finished previously started row
  2224. /// nk_layout_row | Specifies row columns in array as either window ratio or size
  2225. //
  2226. /// nk_layout_row_template_begin | Begins the row template declaration
  2227. /// nk_layout_row_template_push_dynamic | Adds a dynamic column that dynamically grows and can go to zero if not enough space
  2228. /// nk_layout_row_template_push_variable | Adds a variable column that dynamically grows but does not shrink below specified pixel width
  2229. /// nk_layout_row_template_push_static | Adds a static column that does not grow and will always have the same size
  2230. /// nk_layout_row_template_end | Marks the end of the row template
  2231. //
  2232. /// nk_layout_space_begin | Begins a new layouting space that allows to specify each widgets position and size
  2233. /// nk_layout_space_push | Pushes position and size of the next widget in own coordinate space either as pixel or ratio
  2234. /// nk_layout_space_end | Marks the end of the layouting space
  2235. //
  2236. /// nk_layout_space_bounds | Callable after nk_layout_space_begin and returns total space allocated
  2237. /// nk_layout_space_to_screen | Converts vector from nk_layout_space coordinate space into screen space
  2238. /// nk_layout_space_to_local | Converts vector from screen space into nk_layout_space coordinates
  2239. /// nk_layout_space_rect_to_screen | Converts rectangle from nk_layout_space coordinate space into screen space
  2240. /// nk_layout_space_rect_to_local | Converts rectangle from screen space into nk_layout_space coordinates
  2241. */
  2242. /*/// #### nk_layout_set_min_row_height
  2243. /// Sets the currently used minimum row height.
  2244. /// !!! WARNING
  2245. /// The passed height needs to include both your preferred row height
  2246. /// as well as padding. No internal padding is added.
  2247. ///
  2248. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2249. /// void nk_layout_set_min_row_height(struct nk_context*, float height);
  2250. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2251. ///
  2252. /// Parameter | Description
  2253. /// ------------|-----------------------------------------------------------
  2254. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2255. /// __height__ | New minimum row height to be used for auto generating the row height
  2256. */
  2257. NK_API void nk_layout_set_min_row_height(struct nk_context*, float height);
  2258. /*/// #### nk_layout_reset_min_row_height
  2259. /// Reset the currently used minimum row height back to `font_height + text_padding + padding`
  2260. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2261. /// void nk_layout_reset_min_row_height(struct nk_context*);
  2262. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2263. ///
  2264. /// Parameter | Description
  2265. /// ------------|-----------------------------------------------------------
  2266. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2267. */
  2268. NK_API void nk_layout_reset_min_row_height(struct nk_context*);
  2269. /*/// #### nk_layout_widget_bounds
  2270. /// Returns the width of the next row allocate by one of the layouting functions
  2271. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2272. /// struct nk_rect nk_layout_widget_bounds(struct nk_context*);
  2273. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2274. ///
  2275. /// Parameter | Description
  2276. /// ------------|-----------------------------------------------------------
  2277. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2278. ///
  2279. /// Return `nk_rect` with both position and size of the next row
  2280. */
  2281. NK_API struct nk_rect nk_layout_widget_bounds(struct nk_context*);
  2282. /*/// #### nk_layout_ratio_from_pixel
  2283. /// Utility functions to calculate window ratio from pixel size
  2284. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2285. /// float nk_layout_ratio_from_pixel(struct nk_context*, float pixel_width);
  2286. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2287. ///
  2288. /// Parameter | Description
  2289. /// ------------|-----------------------------------------------------------
  2290. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2291. /// __pixel__ | Pixel_width to convert to window ratio
  2292. ///
  2293. /// Returns `nk_rect` with both position and size of the next row
  2294. */
  2295. NK_API float nk_layout_ratio_from_pixel(struct nk_context*, float pixel_width);
  2296. /*/// #### nk_layout_row_dynamic
  2297. /// Sets current row layout to share horizontal space
  2298. /// between @cols number of widgets evenly. Once called all subsequent widget
  2299. /// calls greater than @cols will allocate a new row with same layout.
  2300. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2301. /// void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols);
  2302. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2303. ///
  2304. /// Parameter | Description
  2305. /// ------------|-----------------------------------------------------------
  2306. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2307. /// __height__ | Holds height of each widget in row or zero for auto layouting
  2308. /// __columns__ | Number of widget inside row
  2309. */
  2310. NK_API void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols);
  2311. /*/// #### nk_layout_row_static
  2312. /// Sets current row layout to fill @cols number of widgets
  2313. /// in row with same @item_width horizontal size. Once called all subsequent widget
  2314. /// calls greater than @cols will allocate a new row with same layout.
  2315. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2316. /// void nk_layout_row_static(struct nk_context *ctx, float height, int item_width, int cols);
  2317. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2318. ///
  2319. /// Parameter | Description
  2320. /// ------------|-----------------------------------------------------------
  2321. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2322. /// __height__ | Holds height of each widget in row or zero for auto layouting
  2323. /// __width__ | Holds pixel width of each widget in the row
  2324. /// __columns__ | Number of widget inside row
  2325. */
  2326. NK_API void nk_layout_row_static(struct nk_context *ctx, float height, int item_width, int cols);
  2327. /*/// #### nk_layout_row_begin
  2328. /// Starts a new dynamic or fixed row with given height and columns.
  2329. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2330. /// void nk_layout_row_begin(struct nk_context *ctx, enum nk_layout_format fmt, float row_height, int cols);
  2331. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2332. ///
  2333. /// Parameter | Description
  2334. /// ------------|-----------------------------------------------------------
  2335. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2336. /// __fmt__ | either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns
  2337. /// __height__ | holds height of each widget in row or zero for auto layouting
  2338. /// __columns__ | Number of widget inside row
  2339. */
  2340. NK_API void nk_layout_row_begin(struct nk_context *ctx, enum nk_layout_format fmt, float row_height, int cols);
  2341. /*/// #### nk_layout_row_push
  2342. /// Specifies either window ratio or width of a single column
  2343. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2344. /// void nk_layout_row_push(struct nk_context*, float value);
  2345. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2346. ///
  2347. /// Parameter | Description
  2348. /// ------------|-----------------------------------------------------------
  2349. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2350. /// __value__ | either a window ratio or fixed width depending on @fmt in previous `nk_layout_row_begin` call
  2351. */
  2352. NK_API void nk_layout_row_push(struct nk_context*, float value);
  2353. /*/// #### nk_layout_row_end
  2354. /// Finished previously started row
  2355. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2356. /// void nk_layout_row_end(struct nk_context*);
  2357. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2358. ///
  2359. /// Parameter | Description
  2360. /// ------------|-----------------------------------------------------------
  2361. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2362. */
  2363. NK_API void nk_layout_row_end(struct nk_context*);
  2364. /*/// #### nk_layout_row
  2365. /// Specifies row columns in array as either window ratio or size
  2366. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2367. /// void nk_layout_row(struct nk_context*, enum nk_layout_format, float height, int cols, const float *ratio);
  2368. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2369. ///
  2370. /// Parameter | Description
  2371. /// ------------|-----------------------------------------------------------
  2372. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2373. /// __fmt__ | Either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns
  2374. /// __height__ | Holds height of each widget in row or zero for auto layouting
  2375. /// __columns__ | Number of widget inside row
  2376. */
  2377. NK_API void nk_layout_row(struct nk_context*, enum nk_layout_format, float height, int cols, const float *ratio);
  2378. /*/// #### nk_layout_row_template_begin
  2379. /// Begins the row template declaration
  2380. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2381. /// void nk_layout_row_template_begin(struct nk_context*, float row_height);
  2382. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2383. ///
  2384. /// Parameter | Description
  2385. /// ------------|-----------------------------------------------------------
  2386. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2387. /// __height__ | Holds height of each widget in row or zero for auto layouting
  2388. */
  2389. NK_API void nk_layout_row_template_begin(struct nk_context*, float row_height);
  2390. /*/// #### nk_layout_row_template_push_dynamic
  2391. /// Adds a dynamic column that dynamically grows and can go to zero if not enough space
  2392. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2393. /// void nk_layout_row_template_push_dynamic(struct nk_context*);
  2394. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2395. ///
  2396. /// Parameter | Description
  2397. /// ------------|-----------------------------------------------------------
  2398. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2399. /// __height__ | Holds height of each widget in row or zero for auto layouting
  2400. */
  2401. NK_API void nk_layout_row_template_push_dynamic(struct nk_context*);
  2402. /*/// #### nk_layout_row_template_push_variable
  2403. /// Adds a variable column that dynamically grows but does not shrink below specified pixel width
  2404. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2405. /// void nk_layout_row_template_push_variable(struct nk_context*, float min_width);
  2406. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2407. ///
  2408. /// Parameter | Description
  2409. /// ------------|-----------------------------------------------------------
  2410. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2411. /// __width__ | Holds the minimum pixel width the next column must always be
  2412. */
  2413. NK_API void nk_layout_row_template_push_variable(struct nk_context*, float min_width);
  2414. /*/// #### nk_layout_row_template_push_static
  2415. /// Adds a static column that does not grow and will always have the same size
  2416. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2417. /// void nk_layout_row_template_push_static(struct nk_context*, float width);
  2418. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2419. ///
  2420. /// Parameter | Description
  2421. /// ------------|-----------------------------------------------------------
  2422. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2423. /// __width__ | Holds the absolute pixel width value the next column must be
  2424. */
  2425. NK_API void nk_layout_row_template_push_static(struct nk_context*, float width);
  2426. /*/// #### nk_layout_row_template_end
  2427. /// Marks the end of the row template
  2428. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2429. /// void nk_layout_row_template_end(struct nk_context*);
  2430. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2431. ///
  2432. /// Parameter | Description
  2433. /// ------------|-----------------------------------------------------------
  2434. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2435. */
  2436. NK_API void nk_layout_row_template_end(struct nk_context*);
  2437. /*/// #### nk_layout_space_begin
  2438. /// Begins a new layouting space that allows to specify each widgets position and size.
  2439. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2440. /// void nk_layout_space_begin(struct nk_context*, enum nk_layout_format, float height, int widget_count);
  2441. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2442. ///
  2443. /// Parameter | Description
  2444. /// ------------|-----------------------------------------------------------
  2445. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
  2446. /// __fmt__ | Either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns
  2447. /// __height__ | Holds height of each widget in row or zero for auto layouting
  2448. /// __columns__ | Number of widgets inside row
  2449. */
  2450. NK_API void nk_layout_space_begin(struct nk_context*, enum nk_layout_format, float height, int widget_count);
  2451. /*/// #### nk_layout_space_push
  2452. /// Pushes position and size of the next widget in own coordinate space either as pixel or ratio
  2453. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2454. /// void nk_layout_space_push(struct nk_context *ctx, struct nk_rect bounds);
  2455. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2456. ///
  2457. /// Parameter | Description
  2458. /// ------------|-----------------------------------------------------------
  2459. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
  2460. /// __bounds__ | Position and size in laoyut space local coordinates
  2461. */
  2462. NK_API void nk_layout_space_push(struct nk_context*, struct nk_rect bounds);
  2463. /*/// #### nk_layout_space_end
  2464. /// Marks the end of the layout space
  2465. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2466. /// void nk_layout_space_end(struct nk_context*);
  2467. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2468. ///
  2469. /// Parameter | Description
  2470. /// ------------|-----------------------------------------------------------
  2471. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
  2472. */
  2473. NK_API void nk_layout_space_end(struct nk_context*);
  2474. /*/// #### nk_layout_space_bounds
  2475. /// Utility function to calculate total space allocated for `nk_layout_space`
  2476. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2477. /// struct nk_rect nk_layout_space_bounds(struct nk_context*);
  2478. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2479. ///
  2480. /// Parameter | Description
  2481. /// ------------|-----------------------------------------------------------
  2482. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
  2483. ///
  2484. /// Returns `nk_rect` holding the total space allocated
  2485. */
  2486. NK_API struct nk_rect nk_layout_space_bounds(struct nk_context*);
  2487. /*/// #### nk_layout_space_to_screen
  2488. /// Converts vector from nk_layout_space coordinate space into screen space
  2489. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2490. /// struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_vec2);
  2491. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2492. ///
  2493. /// Parameter | Description
  2494. /// ------------|-----------------------------------------------------------
  2495. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
  2496. /// __vec__ | Position to convert from layout space into screen coordinate space
  2497. ///
  2498. /// Returns transformed `nk_vec2` in screen space coordinates
  2499. */
  2500. NK_API struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_vec2);
  2501. /*/// #### nk_layout_space_to_local
  2502. /// Converts vector from layout space into screen space
  2503. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2504. /// struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec2);
  2505. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2506. ///
  2507. /// Parameter | Description
  2508. /// ------------|-----------------------------------------------------------
  2509. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
  2510. /// __vec__ | Position to convert from screen space into layout coordinate space
  2511. ///
  2512. /// Returns transformed `nk_vec2` in layout space coordinates
  2513. */
  2514. NK_API struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec2);
  2515. /*/// #### nk_layout_space_rect_to_screen
  2516. /// Converts rectangle from screen space into layout space
  2517. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2518. /// struct nk_rect nk_layout_space_rect_to_screen(struct nk_context*, struct nk_rect);
  2519. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2520. ///
  2521. /// Parameter | Description
  2522. /// ------------|-----------------------------------------------------------
  2523. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
  2524. /// __bounds__ | Rectangle to convert from layout space into screen space
  2525. ///
  2526. /// Returns transformed `nk_rect` in screen space coordinates
  2527. */
  2528. NK_API struct nk_rect nk_layout_space_rect_to_screen(struct nk_context*, struct nk_rect);
  2529. /*/// #### nk_layout_space_rect_to_local
  2530. /// Converts rectangle from layout space into screen space
  2531. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2532. /// struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct nk_rect);
  2533. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2534. ///
  2535. /// Parameter | Description
  2536. /// ------------|-----------------------------------------------------------
  2537. /// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
  2538. /// __bounds__ | Rectangle to convert from layout space into screen space
  2539. ///
  2540. /// Returns transformed `nk_rect` in layout space coordinates
  2541. */
  2542. NK_API struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct nk_rect);
  2543. /* =============================================================================
  2544. *
  2545. * GROUP
  2546. *
  2547. * =============================================================================
  2548. /// ### Groups
  2549. /// Groups are basically windows inside windows. They allow to subdivide space
  2550. /// in a window to layout widgets as a group. Almost all more complex widget
  2551. /// layouting requirements can be solved using groups and basic layouting
  2552. /// fuctionality. Groups just like windows are identified by an unique name and
  2553. /// internally keep track of scrollbar offsets by default. However additional
  2554. /// versions are provided to directly manage the scrollbar.
  2555. ///
  2556. /// #### Usage
  2557. /// To create a group you have to call one of the three `nk_group_begin_xxx`
  2558. /// functions to start group declarations and `nk_group_end` at the end. Furthermore it
  2559. /// is required to check the return value of `nk_group_begin_xxx` and only process
  2560. /// widgets inside the window if the value is not 0.
  2561. /// Nesting groups is possible and even encouraged since many layouting schemes
  2562. /// can only be achieved by nesting. Groups, unlike windows, need `nk_group_end`
  2563. /// to be only called if the corosponding `nk_group_begin_xxx` call does not return 0:
  2564. ///
  2565. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2566. /// if (nk_group_begin_xxx(ctx, ...) {
  2567. /// // [... widgets ...]
  2568. /// nk_group_end(ctx);
  2569. /// }
  2570. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2571. ///
  2572. /// In the grand concept groups can be called after starting a window
  2573. /// with `nk_begin_xxx` and before calling `nk_end`:
  2574. ///
  2575. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2576. /// struct nk_context ctx;
  2577. /// nk_init_xxx(&ctx, ...);
  2578. /// while (1) {
  2579. /// // Input
  2580. /// Event evt;
  2581. /// nk_input_begin(&ctx);
  2582. /// while (GetEvent(&evt)) {
  2583. /// if (evt.type == MOUSE_MOVE)
  2584. /// nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
  2585. /// else if (evt.type == [...]) {
  2586. /// nk_input_xxx(...);
  2587. /// }
  2588. /// }
  2589. /// nk_input_end(&ctx);
  2590. /// //
  2591. /// // Window
  2592. /// if (nk_begin_xxx(...) {
  2593. /// // [...widgets...]
  2594. /// nk_layout_row_dynamic(...);
  2595. /// if (nk_group_begin_xxx(ctx, ...) {
  2596. /// //[... widgets ...]
  2597. /// nk_group_end(ctx);
  2598. /// }
  2599. /// }
  2600. /// nk_end(ctx);
  2601. /// //
  2602. /// // Draw
  2603. /// const struct nk_command *cmd = 0;
  2604. /// nk_foreach(cmd, &ctx) {
  2605. /// switch (cmd->type) {
  2606. /// case NK_COMMAND_LINE:
  2607. /// your_draw_line_function(...)
  2608. /// break;
  2609. /// case NK_COMMAND_RECT
  2610. /// your_draw_rect_function(...)
  2611. /// break;
  2612. /// case ...:
  2613. /// // [...]
  2614. /// }
  2615. /// nk_clear(&ctx);
  2616. /// }
  2617. /// nk_free(&ctx);
  2618. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2619. /// #### Reference
  2620. /// Function | Description
  2621. /// --------------------------------|-------------------------------------------
  2622. /// nk_group_begin | Start a new group with internal scrollbar handling
  2623. /// nk_group_begin_titled | Start a new group with separeted name and title and internal scrollbar handling
  2624. /// nk_group_end | Ends a group. Should only be called if nk_group_begin returned non-zero
  2625. /// nk_group_scrolled_offset_begin | Start a new group with manual separated handling of scrollbar x- and y-offset
  2626. /// nk_group_scrolled_begin | Start a new group with manual scrollbar handling
  2627. /// nk_group_scrolled_end | Ends a group with manual scrollbar handling. Should only be called if nk_group_begin returned non-zero
  2628. /// nk_group_get_scroll | Gets the scroll offset for the given group
  2629. /// nk_group_set_scroll | Sets the scroll offset for the given group
  2630. */
  2631. /*/// #### nk_group_begin
  2632. /// Starts a new widget group. Requires a previous layouting function to specify a pos/size.
  2633. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2634. /// int nk_group_begin(struct nk_context*, const char *title, nk_flags);
  2635. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2636. ///
  2637. /// Parameter | Description
  2638. /// ------------|-----------------------------------------------------------
  2639. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2640. /// __title__ | Must be an unique identifier for this group that is also used for the group header
  2641. /// __flags__ | Window flags defined in the nk_panel_flags section with a number of different group behaviors
  2642. ///
  2643. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2644. */
  2645. NK_API int nk_group_begin(struct nk_context*, const char *title, nk_flags);
  2646. /*/// #### nk_group_begin_titled
  2647. /// Starts a new widget group. Requires a previous layouting function to specify a pos/size.
  2648. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2649. /// int nk_group_begin_titled(struct nk_context*, const char *name, const char *title, nk_flags);
  2650. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2651. ///
  2652. /// Parameter | Description
  2653. /// ------------|-----------------------------------------------------------
  2654. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2655. /// __id__ | Must be an unique identifier for this group
  2656. /// __title__ | Group header title
  2657. /// __flags__ | Window flags defined in the nk_panel_flags section with a number of different group behaviors
  2658. ///
  2659. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2660. */
  2661. NK_API int nk_group_begin_titled(struct nk_context*, const char *name, const char *title, nk_flags);
  2662. /*/// #### nk_group_end
  2663. /// Ends a widget group
  2664. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2665. /// void nk_group_end(struct nk_context*);
  2666. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2667. ///
  2668. /// Parameter | Description
  2669. /// ------------|-----------------------------------------------------------
  2670. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2671. */
  2672. NK_API void nk_group_end(struct nk_context*);
  2673. /*/// #### nk_group_scrolled_offset_begin
  2674. /// starts a new widget group. requires a previous layouting function to specify
  2675. /// a size. Does not keep track of scrollbar.
  2676. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2677. /// int nk_group_scrolled_offset_begin(struct nk_context*, nk_uint *x_offset, nk_uint *y_offset, const char *title, nk_flags flags);
  2678. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2679. ///
  2680. /// Parameter | Description
  2681. /// ------------|-----------------------------------------------------------
  2682. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2683. /// __x_offset__| Scrollbar x-offset to offset all widgets inside the group horizontally.
  2684. /// __y_offset__| Scrollbar y-offset to offset all widgets inside the group vertically
  2685. /// __title__ | Window unique group title used to both identify and display in the group header
  2686. /// __flags__ | Window flags from the nk_panel_flags section
  2687. ///
  2688. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2689. */
  2690. NK_API int nk_group_scrolled_offset_begin(struct nk_context*, nk_uint *x_offset, nk_uint *y_offset, const char *title, nk_flags flags);
  2691. /*/// #### nk_group_scrolled_begin
  2692. /// Starts a new widget group. requires a previous
  2693. /// layouting function to specify a size. Does not keep track of scrollbar.
  2694. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2695. /// int nk_group_scrolled_begin(struct nk_context*, struct nk_scroll *off, const char *title, nk_flags);
  2696. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2697. ///
  2698. /// Parameter | Description
  2699. /// ------------|-----------------------------------------------------------
  2700. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2701. /// __off__ | Both x- and y- scroll offset. Allows for manual scrollbar control
  2702. /// __title__ | Window unique group title used to both identify and display in the group header
  2703. /// __flags__ | Window flags from nk_panel_flags section
  2704. ///
  2705. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2706. */
  2707. NK_API int nk_group_scrolled_begin(struct nk_context*, struct nk_scroll *off, const char *title, nk_flags);
  2708. /*/// #### nk_group_scrolled_end
  2709. /// Ends a widget group after calling nk_group_scrolled_offset_begin or nk_group_scrolled_begin.
  2710. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2711. /// void nk_group_scrolled_end(struct nk_context*);
  2712. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2713. ///
  2714. /// Parameter | Description
  2715. /// ------------|-----------------------------------------------------------
  2716. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2717. */
  2718. NK_API void nk_group_scrolled_end(struct nk_context*);
  2719. /*/// #### nk_group_get_scroll
  2720. /// Gets the scroll position of the given group.
  2721. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2722. /// void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset);
  2723. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2724. ///
  2725. /// Parameter | Description
  2726. /// -------------|-----------------------------------------------------------
  2727. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2728. /// __id__ | The id of the group to get the scroll position of
  2729. /// __x_offset__ | A pointer to the x offset output (or NULL to ignore)
  2730. /// __y_offset__ | A pointer to the y offset output (or NULL to ignore)
  2731. */
  2732. NK_API void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset);
  2733. /*/// #### nk_group_set_scroll
  2734. /// Sets the scroll position of the given group.
  2735. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2736. /// void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset);
  2737. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2738. ///
  2739. /// Parameter | Description
  2740. /// -------------|-----------------------------------------------------------
  2741. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2742. /// __id__ | The id of the group to scroll
  2743. /// __x_offset__ | The x offset to scroll to
  2744. /// __y_offset__ | The y offset to scroll to
  2745. */
  2746. NK_API void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset);
  2747. /* =============================================================================
  2748. *
  2749. * TREE
  2750. *
  2751. * =============================================================================
  2752. /// ### Tree
  2753. /// Trees represent two different concept. First the concept of a collapsable
  2754. /// UI section that can be either in a hidden or visibile state. They allow the UI
  2755. /// user to selectively minimize the current set of visible UI to comprehend.
  2756. /// The second concept are tree widgets for visual UI representation of trees.<br /><br />
  2757. ///
  2758. /// Trees thereby can be nested for tree representations and multiple nested
  2759. /// collapsable UI sections. All trees are started by calling of the
  2760. /// `nk_tree_xxx_push_tree` functions and ended by calling one of the
  2761. /// `nk_tree_xxx_pop_xxx()` functions. Each starting functions takes a title label
  2762. /// and optionally an image to be displayed and the initial collapse state from
  2763. /// the nk_collapse_states section.<br /><br />
  2764. ///
  2765. /// The runtime state of the tree is either stored outside the library by the caller
  2766. /// or inside which requires a unique ID. The unique ID can either be generated
  2767. /// automatically from `__FILE__` and `__LINE__` with function `nk_tree_push`,
  2768. /// by `__FILE__` and a user provided ID generated for example by loop index with
  2769. /// function `nk_tree_push_id` or completely provided from outside by user with
  2770. /// function `nk_tree_push_hashed`.
  2771. ///
  2772. /// #### Usage
  2773. /// To create a tree you have to call one of the seven `nk_tree_xxx_push_xxx`
  2774. /// functions to start a collapsable UI section and `nk_tree_xxx_pop` to mark the
  2775. /// end.
  2776. /// Each starting function will either return `false(0)` if the tree is collapsed
  2777. /// or hidden and therefore does not need to be filled with content or `true(1)`
  2778. /// if visible and required to be filled.
  2779. ///
  2780. /// !!! Note
  2781. /// The tree header does not require and layouting function and instead
  2782. /// calculates a auto height based on the currently used font size
  2783. ///
  2784. /// The tree ending functions only need to be called if the tree content is
  2785. /// actually visible. So make sure the tree push function is guarded by `if`
  2786. /// and the pop call is only taken if the tree is visible.
  2787. ///
  2788. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2789. /// if (nk_tree_push(ctx, NK_TREE_TAB, "Tree", NK_MINIMIZED)) {
  2790. /// nk_layout_row_dynamic(...);
  2791. /// nk_widget(...);
  2792. /// nk_tree_pop(ctx);
  2793. /// }
  2794. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2795. ///
  2796. /// #### Reference
  2797. /// Function | Description
  2798. /// ----------------------------|-------------------------------------------
  2799. /// nk_tree_push | Start a collapsable UI section with internal state management
  2800. /// nk_tree_push_id | Start a collapsable UI section with internal state management callable in a look
  2801. /// nk_tree_push_hashed | Start a collapsable UI section with internal state management with full control over internal unique ID use to store state
  2802. /// nk_tree_image_push | Start a collapsable UI section with image and label header
  2803. /// nk_tree_image_push_id | Start a collapsable UI section with image and label header and internal state management callable in a look
  2804. /// nk_tree_image_push_hashed | Start a collapsable UI section with image and label header and internal state management with full control over internal unique ID use to store state
  2805. /// nk_tree_pop | Ends a collapsable UI section
  2806. //
  2807. /// nk_tree_state_push | Start a collapsable UI section with external state management
  2808. /// nk_tree_state_image_push | Start a collapsable UI section with image and label header and external state management
  2809. /// nk_tree_state_pop | Ends a collapsabale UI section
  2810. ///
  2811. /// #### nk_tree_type
  2812. /// Flag | Description
  2813. /// ----------------|----------------------------------------
  2814. /// NK_TREE_NODE | Highlighted tree header to mark a collapsable UI section
  2815. /// NK_TREE_TAB | Non-highighted tree header closer to tree representations
  2816. */
  2817. /*/// #### nk_tree_push
  2818. /// Starts a collapsable UI section with internal state management
  2819. /// !!! WARNING
  2820. /// To keep track of the runtime tree collapsable state this function uses
  2821. /// defines `__FILE__` and `__LINE__` to generate a unique ID. If you want
  2822. /// to call this function in a loop please use `nk_tree_push_id` or
  2823. /// `nk_tree_push_hashed` instead.
  2824. ///
  2825. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2826. /// #define nk_tree_push(ctx, type, title, state)
  2827. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2828. ///
  2829. /// Parameter | Description
  2830. /// ------------|-----------------------------------------------------------
  2831. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2832. /// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
  2833. /// __title__ | Label printed in the tree header
  2834. /// __state__ | Initial tree state value out of nk_collapse_states
  2835. ///
  2836. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2837. */
  2838. #define nk_tree_push(ctx, type, title, state) nk_tree_push_hashed(ctx, type, title, state, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),__LINE__)
  2839. /*/// #### nk_tree_push_id
  2840. /// Starts a collapsable UI section with internal state management callable in a look
  2841. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2842. /// #define nk_tree_push_id(ctx, type, title, state, id)
  2843. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2844. ///
  2845. /// Parameter | Description
  2846. /// ------------|-----------------------------------------------------------
  2847. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2848. /// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
  2849. /// __title__ | Label printed in the tree header
  2850. /// __state__ | Initial tree state value out of nk_collapse_states
  2851. /// __id__ | Loop counter index if this function is called in a loop
  2852. ///
  2853. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2854. */
  2855. #define nk_tree_push_id(ctx, type, title, state, id) nk_tree_push_hashed(ctx, type, title, state, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),id)
  2856. /*/// #### nk_tree_push_hashed
  2857. /// Start a collapsable UI section with internal state management with full
  2858. /// control over internal unique ID used to store state
  2859. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2860. /// int nk_tree_push_hashed(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states initial_state, const char *hash, int len,int seed);
  2861. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2862. ///
  2863. /// Parameter | Description
  2864. /// ------------|-----------------------------------------------------------
  2865. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2866. /// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
  2867. /// __title__ | Label printed in the tree header
  2868. /// __state__ | Initial tree state value out of nk_collapse_states
  2869. /// __hash__ | Memory block or string to generate the ID from
  2870. /// __len__ | Size of passed memory block or string in __hash__
  2871. /// __seed__ | Seeding value if this function is called in a loop or default to `0`
  2872. ///
  2873. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2874. */
  2875. NK_API int nk_tree_push_hashed(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states initial_state, const char *hash, int len,int seed);
  2876. /*/// #### nk_tree_image_push
  2877. /// Start a collapsable UI section with image and label header
  2878. /// !!! WARNING
  2879. /// To keep track of the runtime tree collapsable state this function uses
  2880. /// defines `__FILE__` and `__LINE__` to generate a unique ID. If you want
  2881. /// to call this function in a loop please use `nk_tree_image_push_id` or
  2882. /// `nk_tree_image_push_hashed` instead.
  2883. ///
  2884. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2885. /// #define nk_tree_image_push(ctx, type, img, title, state)
  2886. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2887. //
  2888. /// Parameter | Description
  2889. /// ------------|-----------------------------------------------------------
  2890. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2891. /// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
  2892. /// __img__ | Image to display inside the header on the left of the label
  2893. /// __title__ | Label printed in the tree header
  2894. /// __state__ | Initial tree state value out of nk_collapse_states
  2895. ///
  2896. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2897. */
  2898. #define nk_tree_image_push(ctx, type, img, title, state) nk_tree_image_push_hashed(ctx, type, img, title, state, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),__LINE__)
  2899. /*/// #### nk_tree_image_push_id
  2900. /// Start a collapsable UI section with image and label header and internal state
  2901. /// management callable in a look
  2902. ///
  2903. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2904. /// #define nk_tree_image_push_id(ctx, type, img, title, state, id)
  2905. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2906. ///
  2907. /// Parameter | Description
  2908. /// ------------|-----------------------------------------------------------
  2909. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2910. /// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
  2911. /// __img__ | Image to display inside the header on the left of the label
  2912. /// __title__ | Label printed in the tree header
  2913. /// __state__ | Initial tree state value out of nk_collapse_states
  2914. /// __id__ | Loop counter index if this function is called in a loop
  2915. ///
  2916. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2917. */
  2918. #define nk_tree_image_push_id(ctx, type, img, title, state, id) nk_tree_image_push_hashed(ctx, type, img, title, state, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),id)
  2919. /*/// #### nk_tree_image_push_hashed
  2920. /// Start a collapsable UI section with internal state management with full
  2921. /// control over internal unique ID used to store state
  2922. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2923. /// int nk_tree_image_push_hashed(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states initial_state, const char *hash, int len,int seed);
  2924. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2925. ///
  2926. /// Parameter | Description
  2927. /// ------------|-----------------------------------------------------------
  2928. /// __ctx__ | Must point to an previously initialized `nk_context` struct
  2929. /// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
  2930. /// __img__ | Image to display inside the header on the left of the label
  2931. /// __title__ | Label printed in the tree header
  2932. /// __state__ | Initial tree state value out of nk_collapse_states
  2933. /// __hash__ | Memory block or string to generate the ID from
  2934. /// __len__ | Size of passed memory block or string in __hash__
  2935. /// __seed__ | Seeding value if this function is called in a loop or default to `0`
  2936. ///
  2937. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2938. */
  2939. NK_API int nk_tree_image_push_hashed(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states initial_state, const char *hash, int len,int seed);
  2940. /*/// #### nk_tree_pop
  2941. /// Ends a collapsabale UI section
  2942. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2943. /// void nk_tree_pop(struct nk_context*);
  2944. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2945. ///
  2946. /// Parameter | Description
  2947. /// ------------|-----------------------------------------------------------
  2948. /// __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx`
  2949. */
  2950. NK_API void nk_tree_pop(struct nk_context*);
  2951. /*/// #### nk_tree_state_push
  2952. /// Start a collapsable UI section with external state management
  2953. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2954. /// int nk_tree_state_push(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states *state);
  2955. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2956. ///
  2957. /// Parameter | Description
  2958. /// ------------|-----------------------------------------------------------
  2959. /// __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx`
  2960. /// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
  2961. /// __title__ | Label printed in the tree header
  2962. /// __state__ | Persistent state to update
  2963. ///
  2964. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2965. */
  2966. NK_API int nk_tree_state_push(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states *state);
  2967. /*/// #### nk_tree_state_image_push
  2968. /// Start a collapsable UI section with image and label header and external state management
  2969. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2970. /// int nk_tree_state_image_push(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states *state);
  2971. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2972. ///
  2973. /// Parameter | Description
  2974. /// ------------|-----------------------------------------------------------
  2975. /// __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx`
  2976. /// __img__ | Image to display inside the header on the left of the label
  2977. /// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
  2978. /// __title__ | Label printed in the tree header
  2979. /// __state__ | Persistent state to update
  2980. ///
  2981. /// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
  2982. */
  2983. NK_API int nk_tree_state_image_push(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states *state);
  2984. /*/// #### nk_tree_state_pop
  2985. /// Ends a collapsabale UI section
  2986. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  2987. /// void nk_tree_state_pop(struct nk_context*);
  2988. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2989. ///
  2990. /// Parameter | Description
  2991. /// ------------|-----------------------------------------------------------
  2992. /// __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx`
  2993. */
  2994. NK_API void nk_tree_state_pop(struct nk_context*);
  2995. #define nk_tree_element_push(ctx, type, title, state, sel) nk_tree_element_push_hashed(ctx, type, title, state, sel, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),__LINE__)
  2996. #define nk_tree_element_push_id(ctx, type, title, state, sel, id) nk_tree_element_push_hashed(ctx, type, title, state, sel, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),id)
  2997. NK_API int nk_tree_element_push_hashed(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states initial_state, int *selected, const char *hash, int len, int seed);
  2998. NK_API int nk_tree_element_image_push_hashed(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states initial_state, int *selected, const char *hash, int len,int seed);
  2999. NK_API void nk_tree_element_pop(struct nk_context*);
  3000. /* =============================================================================
  3001. *
  3002. * LIST VIEW
  3003. *
  3004. * ============================================================================= */
  3005. struct nk_list_view {
  3006. /* public: */
  3007. int begin, end, count;
  3008. /* private: */
  3009. int total_height;
  3010. struct nk_context *ctx;
  3011. nk_uint *scroll_pointer;
  3012. nk_uint scroll_value;
  3013. };
  3014. NK_API int nk_list_view_begin(struct nk_context*, struct nk_list_view *out, const char *id, nk_flags, int row_height, int row_count);
  3015. NK_API void nk_list_view_end(struct nk_list_view*);
  3016. /* =============================================================================
  3017. *
  3018. * WIDGET
  3019. *
  3020. * ============================================================================= */
  3021. enum nk_widget_layout_states {
  3022. NK_WIDGET_INVALID, /* The widget cannot be seen and is completely out of view */
  3023. NK_WIDGET_VALID, /* The widget is completely inside the window and can be updated and drawn */
  3024. NK_WIDGET_ROM /* The widget is partially visible and cannot be updated */
  3025. };
  3026. enum nk_widget_states {
  3027. NK_WIDGET_STATE_MODIFIED = NK_FLAG(1),
  3028. NK_WIDGET_STATE_INACTIVE = NK_FLAG(2), /* widget is neither active nor hovered */
  3029. NK_WIDGET_STATE_ENTERED = NK_FLAG(3), /* widget has been hovered on the current frame */
  3030. NK_WIDGET_STATE_HOVER = NK_FLAG(4), /* widget is being hovered */
  3031. NK_WIDGET_STATE_ACTIVED = NK_FLAG(5),/* widget is currently activated */
  3032. NK_WIDGET_STATE_LEFT = NK_FLAG(6), /* widget is from this frame on not hovered anymore */
  3033. NK_WIDGET_STATE_HOVERED = NK_WIDGET_STATE_HOVER|NK_WIDGET_STATE_MODIFIED, /* widget is being hovered */
  3034. NK_WIDGET_STATE_ACTIVE = NK_WIDGET_STATE_ACTIVED|NK_WIDGET_STATE_MODIFIED /* widget is currently activated */
  3035. };
  3036. NK_API enum nk_widget_layout_states nk_widget(struct nk_rect*, const struct nk_context*);
  3037. NK_API enum nk_widget_layout_states nk_widget_fitting(struct nk_rect*, struct nk_context*, struct nk_vec2);
  3038. NK_API struct nk_rect nk_widget_bounds(struct nk_context*);
  3039. NK_API struct nk_vec2 nk_widget_position(struct nk_context*);
  3040. NK_API struct nk_vec2 nk_widget_size(struct nk_context*);
  3041. NK_API float nk_widget_width(struct nk_context*);
  3042. NK_API float nk_widget_height(struct nk_context*);
  3043. NK_API int nk_widget_is_hovered(struct nk_context*);
  3044. NK_API int nk_widget_is_mouse_clicked(struct nk_context*, enum nk_buttons);
  3045. NK_API int nk_widget_has_mouse_click_down(struct nk_context*, enum nk_buttons, int down);
  3046. NK_API void nk_spacing(struct nk_context*, int cols);
  3047. /* =============================================================================
  3048. *
  3049. * TEXT
  3050. *
  3051. * ============================================================================= */
  3052. enum nk_text_align {
  3053. NK_TEXT_ALIGN_LEFT = 0x01,
  3054. NK_TEXT_ALIGN_CENTERED = 0x02,
  3055. NK_TEXT_ALIGN_RIGHT = 0x04,
  3056. NK_TEXT_ALIGN_TOP = 0x08,
  3057. NK_TEXT_ALIGN_MIDDLE = 0x10,
  3058. NK_TEXT_ALIGN_BOTTOM = 0x20
  3059. };
  3060. enum nk_text_alignment {
  3061. NK_TEXT_LEFT = NK_TEXT_ALIGN_MIDDLE|NK_TEXT_ALIGN_LEFT,
  3062. NK_TEXT_CENTERED = NK_TEXT_ALIGN_MIDDLE|NK_TEXT_ALIGN_CENTERED,
  3063. NK_TEXT_RIGHT = NK_TEXT_ALIGN_MIDDLE|NK_TEXT_ALIGN_RIGHT
  3064. };
  3065. NK_API void nk_text(struct nk_context*, const char*, int, nk_flags);
  3066. NK_API void nk_text_colored(struct nk_context*, const char*, int, nk_flags, struct nk_color);
  3067. NK_API void nk_text_wrap(struct nk_context*, const char*, int);
  3068. NK_API void nk_text_wrap_colored(struct nk_context*, const char*, int, struct nk_color);
  3069. NK_API void nk_label(struct nk_context*, const char*, nk_flags align);
  3070. NK_API void nk_label_colored(struct nk_context*, const char*, nk_flags align, struct nk_color);
  3071. NK_API void nk_label_wrap(struct nk_context*, const char*);
  3072. NK_API void nk_label_colored_wrap(struct nk_context*, const char*, struct nk_color);
  3073. NK_API void nk_image(struct nk_context*, struct nk_image);
  3074. NK_API void nk_image_color(struct nk_context*, struct nk_image, struct nk_color);
  3075. #ifdef NK_INCLUDE_STANDARD_VARARGS
  3076. NK_API void nk_labelf(struct nk_context*, nk_flags, NK_PRINTF_FORMAT_STRING const char*, ...) NK_PRINTF_VARARG_FUNC(3);
  3077. NK_API void nk_labelf_colored(struct nk_context*, nk_flags, struct nk_color, NK_PRINTF_FORMAT_STRING const char*,...) NK_PRINTF_VARARG_FUNC(4);
  3078. NK_API void nk_labelf_wrap(struct nk_context*, NK_PRINTF_FORMAT_STRING const char*,...) NK_PRINTF_VARARG_FUNC(2);
  3079. NK_API void nk_labelf_colored_wrap(struct nk_context*, struct nk_color, NK_PRINTF_FORMAT_STRING const char*,...) NK_PRINTF_VARARG_FUNC(3);
  3080. NK_API void nk_labelfv(struct nk_context*, nk_flags, NK_PRINTF_FORMAT_STRING const char*, va_list) NK_PRINTF_VALIST_FUNC(3);
  3081. NK_API void nk_labelfv_colored(struct nk_context*, nk_flags, struct nk_color, NK_PRINTF_FORMAT_STRING const char*, va_list) NK_PRINTF_VALIST_FUNC(4);
  3082. NK_API void nk_labelfv_wrap(struct nk_context*, NK_PRINTF_FORMAT_STRING const char*, va_list) NK_PRINTF_VALIST_FUNC(2);
  3083. NK_API void nk_labelfv_colored_wrap(struct nk_context*, struct nk_color, NK_PRINTF_FORMAT_STRING const char*, va_list) NK_PRINTF_VALIST_FUNC(3);
  3084. NK_API void nk_value_bool(struct nk_context*, const char *prefix, int);
  3085. NK_API void nk_value_int(struct nk_context*, const char *prefix, int);
  3086. NK_API void nk_value_uint(struct nk_context*, const char *prefix, unsigned int);
  3087. NK_API void nk_value_float(struct nk_context*, const char *prefix, float);
  3088. NK_API void nk_value_color_byte(struct nk_context*, const char *prefix, struct nk_color);
  3089. NK_API void nk_value_color_float(struct nk_context*, const char *prefix, struct nk_color);
  3090. NK_API void nk_value_color_hex(struct nk_context*, const char *prefix, struct nk_color);
  3091. #endif
  3092. /* =============================================================================
  3093. *
  3094. * BUTTON
  3095. *
  3096. * ============================================================================= */
  3097. NK_API int nk_button_text(struct nk_context*, const char *title, int len);
  3098. NK_API int nk_button_label(struct nk_context*, const char *title);
  3099. NK_API int nk_button_color(struct nk_context*, struct nk_color);
  3100. NK_API int nk_button_symbol(struct nk_context*, enum nk_symbol_type);
  3101. NK_API int nk_button_image(struct nk_context*, struct nk_image img);
  3102. NK_API int nk_button_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags text_alignment);
  3103. NK_API int nk_button_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags alignment);
  3104. NK_API int nk_button_image_label(struct nk_context*, struct nk_image img, const char*, nk_flags text_alignment);
  3105. NK_API int nk_button_image_text(struct nk_context*, struct nk_image img, const char*, int, nk_flags alignment);
  3106. NK_API int nk_button_text_styled(struct nk_context*, const struct nk_style_button*, const char *title, int len);
  3107. NK_API int nk_button_label_styled(struct nk_context*, const struct nk_style_button*, const char *title);
  3108. NK_API int nk_button_symbol_styled(struct nk_context*, const struct nk_style_button*, enum nk_symbol_type);
  3109. NK_API int nk_button_image_styled(struct nk_context*, const struct nk_style_button*, struct nk_image img);
  3110. NK_API int nk_button_symbol_text_styled(struct nk_context*,const struct nk_style_button*, enum nk_symbol_type, const char*, int, nk_flags alignment);
  3111. NK_API int nk_button_symbol_label_styled(struct nk_context *ctx, const struct nk_style_button *style, enum nk_symbol_type symbol, const char *title, nk_flags align);
  3112. NK_API int nk_button_image_label_styled(struct nk_context*,const struct nk_style_button*, struct nk_image img, const char*, nk_flags text_alignment);
  3113. NK_API int nk_button_image_text_styled(struct nk_context*,const struct nk_style_button*, struct nk_image img, const char*, int, nk_flags alignment);
  3114. NK_API void nk_button_set_behavior(struct nk_context*, enum nk_button_behavior);
  3115. NK_API int nk_button_push_behavior(struct nk_context*, enum nk_button_behavior);
  3116. NK_API int nk_button_pop_behavior(struct nk_context*);
  3117. /* =============================================================================
  3118. *
  3119. * CHECKBOX
  3120. *
  3121. * ============================================================================= */
  3122. NK_API int nk_check_label(struct nk_context*, const char*, int active);
  3123. NK_API int nk_check_text(struct nk_context*, const char*, int,int active);
  3124. NK_API unsigned nk_check_flags_label(struct nk_context*, const char*, unsigned int flags, unsigned int value);
  3125. NK_API unsigned nk_check_flags_text(struct nk_context*, const char*, int, unsigned int flags, unsigned int value);
  3126. NK_API int nk_checkbox_label(struct nk_context*, const char*, int *active);
  3127. NK_API int nk_checkbox_text(struct nk_context*, const char*, int, int *active);
  3128. NK_API int nk_checkbox_flags_label(struct nk_context*, const char*, unsigned int *flags, unsigned int value);
  3129. NK_API int nk_checkbox_flags_text(struct nk_context*, const char*, int, unsigned int *flags, unsigned int value);
  3130. /* =============================================================================
  3131. *
  3132. * RADIO BUTTON
  3133. *
  3134. * ============================================================================= */
  3135. NK_API int nk_radio_label(struct nk_context*, const char*, int *active);
  3136. NK_API int nk_radio_text(struct nk_context*, const char*, int, int *active);
  3137. NK_API int nk_option_label(struct nk_context*, const char*, int active);
  3138. NK_API int nk_option_text(struct nk_context*, const char*, int, int active);
  3139. /* =============================================================================
  3140. *
  3141. * SELECTABLE
  3142. *
  3143. * ============================================================================= */
  3144. NK_API int nk_selectable_label(struct nk_context*, const char*, nk_flags align, int *value);
  3145. NK_API int nk_selectable_text(struct nk_context*, const char*, int, nk_flags align, int *value);
  3146. NK_API int nk_selectable_image_label(struct nk_context*,struct nk_image, const char*, nk_flags align, int *value);
  3147. NK_API int nk_selectable_image_text(struct nk_context*,struct nk_image, const char*, int, nk_flags align, int *value);
  3148. NK_API int nk_selectable_symbol_label(struct nk_context*,enum nk_symbol_type, const char*, nk_flags align, int *value);
  3149. NK_API int nk_selectable_symbol_text(struct nk_context*,enum nk_symbol_type, const char*, int, nk_flags align, int *value);
  3150. NK_API int nk_select_label(struct nk_context*, const char*, nk_flags align, int value);
  3151. NK_API int nk_select_text(struct nk_context*, const char*, int, nk_flags align, int value);
  3152. NK_API int nk_select_image_label(struct nk_context*, struct nk_image,const char*, nk_flags align, int value);
  3153. NK_API int nk_select_image_text(struct nk_context*, struct nk_image,const char*, int, nk_flags align, int value);
  3154. NK_API int nk_select_symbol_label(struct nk_context*,enum nk_symbol_type, const char*, nk_flags align, int value);
  3155. NK_API int nk_select_symbol_text(struct nk_context*,enum nk_symbol_type, const char*, int, nk_flags align, int value);
  3156. /* =============================================================================
  3157. *
  3158. * SLIDER
  3159. *
  3160. * ============================================================================= */
  3161. NK_API float nk_slide_float(struct nk_context*, float min, float val, float max, float step);
  3162. NK_API int nk_slide_int(struct nk_context*, int min, int val, int max, int step);
  3163. NK_API int nk_slider_float(struct nk_context*, float min, float *val, float max, float step);
  3164. NK_API int nk_slider_int(struct nk_context*, int min, int *val, int max, int step);
  3165. /* =============================================================================
  3166. *
  3167. * PROGRESSBAR
  3168. *
  3169. * ============================================================================= */
  3170. NK_API int nk_progress(struct nk_context*, nk_size *cur, nk_size max, int modifyable);
  3171. NK_API nk_size nk_prog(struct nk_context*, nk_size cur, nk_size max, int modifyable);
  3172. /* =============================================================================
  3173. *
  3174. * COLOR PICKER
  3175. *
  3176. * ============================================================================= */
  3177. NK_API struct nk_colorf nk_color_picker(struct nk_context*, struct nk_colorf, enum nk_color_format);
  3178. NK_API int nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_color_format);
  3179. /* =============================================================================
  3180. *
  3181. * PROPERTIES
  3182. *
  3183. * =============================================================================
  3184. /// ### Properties
  3185. /// Properties are the main value modification widgets in Nuklear. Changing a value
  3186. /// can be achieved by dragging, adding/removing incremental steps on button click
  3187. /// or by directly typing a number.
  3188. ///
  3189. /// #### Usage
  3190. /// Each property requires a unique name for identifaction that is also used for
  3191. /// displaying a label. If you want to use the same name multiple times make sure
  3192. /// add a '#' before your name. The '#' will not be shown but will generate a
  3193. /// unique ID. Each propery also takes in a minimum and maximum value. If you want
  3194. /// to make use of the complete number range of a type just use the provided
  3195. /// type limits from `limits.h`. For example `INT_MIN` and `INT_MAX` for
  3196. /// `nk_property_int` and `nk_propertyi`. In additional each property takes in
  3197. /// a increment value that will be added or subtracted if either the increment
  3198. /// decrement button is clicked. Finally there is a value for increment per pixel
  3199. /// dragged that is added or subtracted from the value.
  3200. ///
  3201. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  3202. /// int value = 0;
  3203. /// struct nk_context ctx;
  3204. /// nk_init_xxx(&ctx, ...);
  3205. /// while (1) {
  3206. /// // Input
  3207. /// Event evt;
  3208. /// nk_input_begin(&ctx);
  3209. /// while (GetEvent(&evt)) {
  3210. /// if (evt.type == MOUSE_MOVE)
  3211. /// nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
  3212. /// else if (evt.type == [...]) {
  3213. /// nk_input_xxx(...);
  3214. /// }
  3215. /// }
  3216. /// nk_input_end(&ctx);
  3217. /// //
  3218. /// // Window
  3219. /// if (nk_begin_xxx(...) {
  3220. /// // Property
  3221. /// nk_layout_row_dynamic(...);
  3222. /// nk_property_int(ctx, "ID", INT_MIN, &value, INT_MAX, 1, 1);
  3223. /// }
  3224. /// nk_end(ctx);
  3225. /// //
  3226. /// // Draw
  3227. /// const struct nk_command *cmd = 0;
  3228. /// nk_foreach(cmd, &ctx) {
  3229. /// switch (cmd->type) {
  3230. /// case NK_COMMAND_LINE:
  3231. /// your_draw_line_function(...)
  3232. /// break;
  3233. /// case NK_COMMAND_RECT
  3234. /// your_draw_rect_function(...)
  3235. /// break;
  3236. /// case ...:
  3237. /// // [...]
  3238. /// }
  3239. /// nk_clear(&ctx);
  3240. /// }
  3241. /// nk_free(&ctx);
  3242. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3243. ///
  3244. /// #### Reference
  3245. /// Function | Description
  3246. /// --------------------|-------------------------------------------
  3247. /// nk_property_int | Integer property directly modifing a passed in value
  3248. /// nk_property_float | Float property directly modifing a passed in value
  3249. /// nk_property_double | Double property directly modifing a passed in value
  3250. /// nk_propertyi | Integer property returning the modified int value
  3251. /// nk_propertyf | Float property returning the modified float value
  3252. /// nk_propertyd | Double property returning the modified double value
  3253. ///
  3254. */
  3255. /*/// #### nk_property_int
  3256. /// Integer property directly modifing a passed in value
  3257. /// !!! WARNING
  3258. /// To generate a unique property ID using the same label make sure to insert
  3259. /// a `#` at the beginning. It will not be shown but guarantees correct behavior.
  3260. ///
  3261. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  3262. /// void nk_property_int(struct nk_context *ctx, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
  3263. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3264. ///
  3265. /// Parameter | Description
  3266. /// --------------------|-----------------------------------------------------------
  3267. /// __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function
  3268. /// __name__ | String used both as a label as well as a unique identifier
  3269. /// __min__ | Minimum value not allowed to be underflown
  3270. /// __val__ | Integer pointer to be modified
  3271. /// __max__ | Maximum value not allowed to be overflown
  3272. /// __step__ | Increment added and subtracted on increment and decrement button
  3273. /// __inc_per_pixel__ | Value per pixel added or subtracted on dragging
  3274. */
  3275. NK_API void nk_property_int(struct nk_context*, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
  3276. /*/// #### nk_property_float
  3277. /// Float property directly modifing a passed in value
  3278. /// !!! WARNING
  3279. /// To generate a unique property ID using the same label make sure to insert
  3280. /// a `#` at the beginning. It will not be shown but guarantees correct behavior.
  3281. ///
  3282. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  3283. /// void nk_property_float(struct nk_context *ctx, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
  3284. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3285. ///
  3286. /// Parameter | Description
  3287. /// --------------------|-----------------------------------------------------------
  3288. /// __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function
  3289. /// __name__ | String used both as a label as well as a unique identifier
  3290. /// __min__ | Minimum value not allowed to be underflown
  3291. /// __val__ | Float pointer to be modified
  3292. /// __max__ | Maximum value not allowed to be overflown
  3293. /// __step__ | Increment added and subtracted on increment and decrement button
  3294. /// __inc_per_pixel__ | Value per pixel added or subtracted on dragging
  3295. */
  3296. NK_API void nk_property_float(struct nk_context*, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
  3297. /*/// #### nk_property_double
  3298. /// Double property directly modifing a passed in value
  3299. /// !!! WARNING
  3300. /// To generate a unique property ID using the same label make sure to insert
  3301. /// a `#` at the beginning. It will not be shown but guarantees correct behavior.
  3302. ///
  3303. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  3304. /// void nk_property_double(struct nk_context *ctx, const char *name, double min, double *val, double max, double step, double inc_per_pixel);
  3305. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3306. ///
  3307. /// Parameter | Description
  3308. /// --------------------|-----------------------------------------------------------
  3309. /// __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function
  3310. /// __name__ | String used both as a label as well as a unique identifier
  3311. /// __min__ | Minimum value not allowed to be underflown
  3312. /// __val__ | Double pointer to be modified
  3313. /// __max__ | Maximum value not allowed to be overflown
  3314. /// __step__ | Increment added and subtracted on increment and decrement button
  3315. /// __inc_per_pixel__ | Value per pixel added or subtracted on dragging
  3316. */
  3317. NK_API void nk_property_double(struct nk_context*, const char *name, double min, double *val, double max, double step, float inc_per_pixel);
  3318. /*/// #### nk_propertyi
  3319. /// Integer property modifing a passed in value and returning the new value
  3320. /// !!! WARNING
  3321. /// To generate a unique property ID using the same label make sure to insert
  3322. /// a `#` at the beginning. It will not be shown but guarantees correct behavior.
  3323. ///
  3324. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
  3325. /// int nk_propertyi(struct nk_context *ctx, const char *name, int min, int val, int max, int step, float inc_per_pixel);
  3326. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3327. ///
  3328. /// Parameter | Description
  3329. /// --------------------|-----------------------------------------------------------
  3330. /// __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function
  3331. /// __name__ | String used both as a label as well as a unique identifier
  3332. /// __min__ | Minimum value not allowed to be underflown
  3333. /// __val__ | Current integer value to be modified and returned
  3334. /// __max__ | Maximum value not allowed to be overflown
  3335. /// __step__