Menus.pas 202 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152
  1. {
  2. File: HIToolbox/Menus.h
  3. Contains: Menu Manager Interfaces.
  4. Version: HIToolbox-219.4.81~2
  5. Copyright: © 1985-2005 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://www.freepascal.org/bugs.html
  9. }
  10. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, August 2005 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit Menus;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,AEDataModel,CFBase,CGContext,ATSTypes,Events,Quickdraw,Fonts,TextCommon,Processes,AppleEvents,Collections,MacErrors,CFString,CFUUID,CarbonEventsCore;
  92. {$ALIGN MAC68K}
  93. {
  94. * Menu Manager
  95. }
  96. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  97. { ¥ Menu Constants }
  98. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  99. {
  100. A Short Course on Menu Definition Functions
  101. A menu definition function is used to implement a custom visual appearance for a menu.
  102. Menu definition functions are still supported in Carbon, but the messages sent to a
  103. menu definition function in Carbon are different than for a non-Carbon application.
  104. In general, Apple recommends using the system menu definition whenever possible.
  105. Menu definition functions will continue to be supported, but it is not easy to write
  106. a correct menu definition, especially one that attempts to imitate the standard system
  107. menu appearance. If you require special features in your menu that the system menu
  108. definition does not support, please mail <[email protected]> and describe your requirements;
  109. we would much rather enhance the system menu definition than have you write a custom one.
  110. Menu definition functions before Carbon used the following messages:
  111. kMenuDrawMsg
  112. kMenuChooseMsg
  113. kMenuSizeMsg
  114. kMenuPopUpMsg
  115. kMenuDrawItemMsg
  116. kMenuCalcItemMsg
  117. kMenuThemeSavvyMsg
  118. kMenuChooseMsg and kMenuDrawItemMsg are not supported in Carbon and are not sent to
  119. Carbon menu definitions. In Carbon, kMenuChooseMsg is replaced by kMenuFindItemMsg and
  120. kMenuHiliteItemMsg. Menu definition functions in Carbon use the following messages:
  121. kMenuInitMsg
  122. kMenuDisposeMsg
  123. kMenuFindItemMsg
  124. kMenuHiliteItemMsg
  125. kMenuDrawItemsMsg
  126. kMenuDrawMsg
  127. kMenuSizeMsg
  128. kMenuPopUpMsg
  129. kMenuCalcItemMsg
  130. kMenuThemeSavvyMsg
  131. The rest of this documentation will focus on Carbon menu definitions only.
  132. Menu Definition Messages
  133. Carbon menu definition functions should support the following messages:
  134. kMenuInitMsg
  135. menuRect unused
  136. hitPt unused
  137. whichItem OSErr*
  138. Sent when a menu is created. This message gives the menu definition an opportunity
  139. to initialize its own state. If the menu definition encounters an error while
  140. initializing, it should set *whichItem to a non-zero error code; this will cause the
  141. Menu Manager to destroy the menu and return an error back from the API that was used
  142. to create the menu.
  143. kMenuDisposeMsg
  144. menuRect unused
  145. hitPt unused
  146. whichItem unused
  147. Sent when a menu is destroyed. This message gives the menu definition an opportunity
  148. to destroy its own data.
  149. kMenuFindItemMsg
  150. menuRect menu bounds
  151. hitPt point to hit-test
  152. whichItem MDEFFindItemData*
  153. Sent when the Menu Manager is displaying a menu and needs to know what item is under
  154. the mouse. The whichItem parameter is actually a pointer to a MenuTrackingData structure.
  155. On entry, the menu, virtualMenuTop, and virtualMenuBottom fields of this structure are
  156. valid. The menu definition should determine which item containst the given point, if any,
  157. and fill in the itemUnderMouse, itemSelected, and itemRect fields. If an item is found,
  158. the menu definition should always fill in the itemUnderMouse and itemRect fields. The
  159. menu definition should only fill in the itemSelected field if the item is available for
  160. selection; if it is unavailable (because it is disabled, or for some other reason), the
  161. menu definition should set the itemSelected field to zero.
  162. The values placed in the itemUnderMouse and itemSelected fields should be less than or
  163. equal to the number of items returned by CountMenuItems on this menu. The values placed
  164. in these two fields should be identical if both are non-zero. itemUnderMouse should always
  165. be non-zero if the mouse is actually over an item.
  166. The menu definition should not hilite the found item during this message. The Menu
  167. Manager will send a separate kMenuHiliteItemMsg to request hiliting of the item.
  168. If the menu definition supports scrolling, it should scroll the menu during this message,
  169. and update the virtualMenuTop and virtualMenuBottom fields of the MenuTrackingData to
  170. indicate the menu's new scrolled position.
  171. If the menu definition uses QuickDraw to draw while scrolling, it should draw into the
  172. current port.
  173. If the menu definition uses CoreGraphics to draw while scrolling, it should use the
  174. CGContextRef passed in the context field of the MDEFHiliteItemData structure.
  175. Menu definitions must use the ScrollMenuImage API, if available, to scroll the menu contents.
  176. This API is available in CarbonLib 1.5 and later, and in Mac OS X 10.1 and later. ScrollMenuImage
  177. properly supports scrolling the alpha channel in the menu's image data. Use of QuickDraw's
  178. ScrollRect API to scroll the menu contents will result in the alpha channel being set to 0xFF
  179. (opaque) and the menu will no longer be transparent.
  180. The menu definition should not modify the menu field of the MenuTrackingData.
  181. kMenuHiliteItemMsg
  182. menuRect menu bounds
  183. hitPt unused
  184. whichItem MDEFHiliteItemData*
  185. Sent when the Menu Manager is displaying a menu and needs to hilite a newly selected
  186. item. The whichItem parameter is actually a pointer to a MDEFHiliteItemData structure.
  187. The menu definition should unhilite the item in the previousItem field, if non-zero,
  188. and hilite the item in the newItem field.
  189. Menu definitions should use the EraseMenuBackground API to erase the old menu contents
  190. before unhiliting a menu item, if the menu definition is using the Appearance Manager's
  191. menu drawing APIs. This is necessary because the background of a menu is transparent on
  192. Aqua, and if the old hilite is not erased first, it will show through the new unhilited
  193. menu background.
  194. If the menu definition uses QuickDraw to draw, it should draw into the current port.
  195. If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
  196. in the context field of the MDEFHiliteItemData structure.
  197. kMenuDrawItemsMsg
  198. menuRect menu bounds
  199. hitPt unused
  200. whichItem MDEFDrawItemsData*
  201. Sent when the Menu Manager is displaying a menu and needs to redraw a portion of the
  202. menu. This message is used by the dynamic menu item support code in the Menu Manager;
  203. for example, if items five and six in a menu are a dynamic group, the Menu Manager will
  204. send a DrawItems message when the group's modifier key is pressed or released to redraw
  205. the appropriate item, but no other items in the menu.
  206. The whichItem parameter for this message is actually a pointer to a MDEFDrawItemsData
  207. structure. The menu definition should redraw the items starting with firstItem and
  208. ending with lastItem, inclusive.
  209. If the menu definition uses QuickDraw to draw, it should draw into the current port.
  210. If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
  211. in the context field of the MDEFDrawItemsData structure.
  212. kMenuDrawMsg
  213. menuRect menu bounds
  214. hitPt unused
  215. whichItem MDEFDrawData*
  216. Sent when the Menu Manager is displaying a menu and needs to redraw the entire menu.
  217. The whichItem parameter is actually a pointer to a MenuTrackingData structure. On entry,
  218. the menu field of this structure is valid. The menu definition should draw the menu and,
  219. if it supports scrolling, should also fill in the virtualMenuTop and virtualMenuBottom
  220. fields of the structure to indicate the menu's initial unscrolled position; typically,
  221. virtualMenuTop would be set to the same value as the top coordinate of the menu rect,
  222. and virtualMenuBottom would be set to virtualMenuTop plus the virtual height of the menu.
  223. If the menu definition uses QuickDraw to draw, it should draw into the current port.
  224. If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
  225. in the context field of the MDEFDrawData structure.
  226. kMenuSizeMsg
  227. menuRect unused
  228. hitPt maximum width and height of the menu
  229. whichItem unused
  230. Sent when the Menu Manager needs to determine the size of a menu. The menu definition
  231. should calculate the width and height of the menu and store the sizes into the menu with
  232. SetMenuWidth and SetMenuHeight.
  233. If the gestaltMenuMgrSendsMenuBoundsToDefProc bit is set in the Menu Manager's Gestalt
  234. value, then the hitPt parameter to this message is the maximum width (hitPt.h) and height
  235. (hitPt.v) of the menu. The menu definition should ensure that the width and height that it
  236. places in the menu do not exceed these values. If the gestalt bit is not set, the menu
  237. definition should just use the main GDevice's width and height as constraints on the menu's
  238. width and height.
  239. kMenuPopUpMsg
  240. menuRect on entry, constraints on the menu's position; on exit, menu bounds
  241. hitPt requested menu location, with swapped coordinates
  242. whichItem on entry, requested initial selection; on exit, virtual menu top
  243. Sent when the Menu Manager is about to display a popup menu. The menu definition should
  244. calculate the appropriate menu bounds to contain the menu based on the requested menu
  245. location and selected item. It should write the menuBounds into the rect given by the
  246. menuRect parameter.
  247. If the gestaltMenuMgrSendsMenuBoundsToDefProc bit is set in the Menu Manager's Gestalt
  248. value, then the menuRect parameter on entry to this message contains a constraint rect,
  249. in global coordinates, outside of which the popup menu should not be positioned. The menu
  250. definition should take this constraint rect into account as it calculates the menu bounds.
  251. If the gestalt bit is not set, the menu definition should use the bounds of the GDevice
  252. containing the menu's top left corner as a constraint on the menu's position.
  253. The hitPt parameter is a requested location for the top left corner of the menu. The
  254. coordinates of this parameter are swapped from their normal order; the h field of the
  255. hitPt parameter contains the vertical coordinate, and the v field of hitPt contains
  256. the horizontal coordinate.
  257. On entry, the whichItem parameter points at a menu item index which is requested to be
  258. the initial selection when the menu is displayed. After calculating the menu's bounds,
  259. the menu definition should write the menu's virtual top coordinate into the location
  260. pointed at by the whichItem parameter. If displaying the menu at the requested location
  261. does not require scrolling, the virtual top will be the same as the menu bounds top;
  262. if the menu must scroll to fit in the requested location, the virtual top may be different.
  263. kMenuCalcItemMsg
  264. menuRect on exit, item bounds
  265. hitPt unused
  266. whichItem the item whose rect to calculate
  267. Sent when the Menu Manager needs to know the bounds of a menu item. The menu definition
  268. should calculate the size of the item specified by the whichItem parameter, and store
  269. the bounds in the rect specified by the menuRect parameter.
  270. Some sample menu definition code provided by Apple has previously shown an implementation
  271. of this message that always sets the top left corner of the item bounds to (0,0), regardless
  272. of the item's actual position in the menu. For best future compatibility, menu definitions
  273. should begin storing an item bounds that gives the item's actual position in the menu based
  274. on the menu's current virtual top. For example, if the virtual menu top starts at 20, then
  275. the menu definition would calculate an item bounds for the first item that starts at (0,20),
  276. an item bounds for the second item that starts at (0,40), and so on. The menu definition
  277. should call GetMenuTrackingData to get the menu's current virtual position, and use zero
  278. for the menu top if GetMenuTrackingData returns an error.
  279. kMenuThemeSavvyMsg
  280. menuRect unused
  281. hitPt unused
  282. whichItem on exit, indicates theme-savvyness of the menu definition
  283. Sent by the Menu Manager to determine whether the MDEF uses the Appearance Manager
  284. menu-drawing functions to draw its menu. If it does, the menu definition should return
  285. kThemeSavvyMenuResponse in the location pointed to by whichItem. If the menu definition
  286. draws its own custom content without using the Appearance Manager menu-drawing functions,
  287. it should ignore this message.
  288. Low-memory Global Replacements
  289. Pre-Carbon menu definitions needed to use several low-memory globals to communicate with the
  290. Menu Manager. These globals have all been replaced or made obsolete in Carbon, as follows:
  291. MenuDisable
  292. MenuDisable is now set automatically by the Menu Manager using the value returned in the
  293. itemUnderMouse field of the MenuTrackingData structure passed to kMenuFindItemMsg.
  294. TopMenuItem
  295. AtMenuBottom
  296. TopMenuItem and AtMenuBottom are now set automatically by the Menu Manager using the
  297. values returned in the virtualMenuTop and virtualMenuBottom fields of the MenuTrackingData
  298. structure passed to kMenuDrawMsg and kMenuFindItemMsg.
  299. mbSaveLoc
  300. This undocumented low-memory global was used by pre-Carbon menu definitions to store
  301. the bounding rect of the currently selected item and to avoid drawing glitches while
  302. the menu definition was scrolling the contents of a menu that had submenus. The Menu
  303. Manager now automatically sets the selected item bounds using the value returned in
  304. the itemRect field of the MenuTrackingData structure passed to kMenuFindItemMsg. In
  305. order to correctly support scrolling of menus with submenus, a menu definition should
  306. verify, before scrolling the menu contents, that no submenus of the scrolling menu are
  307. currently visible. A menu definition can use GetMenuTrackingData to verify this condition,
  308. as follows:
  309. Boolean SafeToScroll( MenuRef menuBeingScrolled )
  310. (
  311. MenuTrackingData lastMenuData;
  312. return GetMenuTrackingData( NULL, &lastMenuData ) == noErr
  313. && lastMenuData.menu == menuBeingScrolled;
  314. )
  315. If SafeToScroll returns false, the menu definition should not scroll the menu.
  316. }
  317. const
  318. { menu defProc messages }
  319. kMenuDrawMsg = 0;
  320. kMenuSizeMsg = 2;
  321. kMenuPopUpMsg = 3; { position the popup menu rect appropriately }
  322. kMenuCalcItemMsg = 5;
  323. kMenuThemeSavvyMsg = 7; { is your MDEF theme-savvy? If so, return kThemeSavvyMenuResponse in the whichItem parameter}
  324. kMenuInitMsg = 8; { Return an error code in *whichItem to indicate success or failure. Only supported in Carbon. }
  325. kMenuDisposeMsg = 9; { The menu is being destroyed. Only supported in Carbon.}
  326. kMenuFindItemMsg = 10; { Determine which item is under the mouse. Only supported in Carbon.}
  327. kMenuHiliteItemMsg = 11; { Hilite the specified item. Only supported in Carbon.}
  328. kMenuDrawItemsMsg = 12; { Draw a range of items. Only supported in Carbon.}
  329. mDrawMsg = kMenuDrawMsg; { obsolete constant name}
  330. mSizeMsg = kMenuSizeMsg; { obsolete constant name}
  331. mPopUpMsg = kMenuPopUpMsg; { obsolete constant name}
  332. mCalcItemMsg = kMenuCalcItemMsg; { obsolete constant name}
  333. const
  334. kThemeSavvyMenuResponse = $7473; { should be returned in *whichItem when handling kMenuThemeSavvyMsg}
  335. const
  336. {
  337. * Proc ID for a normal text menu. This constant is not typically
  338. * used.
  339. }
  340. textMenuProc = 0;
  341. {
  342. * Menu item command ID to indicate a hierarchical menu; the item
  343. * icon ID is the hierarchical menu ID. This constant is deprecated.
  344. * Use SetMenuItemHierarchicalID or SetMenuItemHierarchicalMenu
  345. * instead of using this constant.
  346. }
  347. hMenuCmd = 27;
  348. {
  349. * A menu ID used with InsertMenu to insert a menu into the
  350. * hierarchical portion of the menubar.
  351. }
  352. kInsertHierarchicalMenu = -1;
  353. {
  354. * The old name for kInsertHierarchicalMenu. This constant is
  355. * deprecated.
  356. }
  357. hierMenu = -1;
  358. {
  359. * This value may be passed to InsertMenuItem, InsertMenuItemText,
  360. * and InsertMenuItemTextWithCFString to indicate that the new item
  361. * should be inserted at the end of the menu. Note that you can also
  362. * just call AppendMenu[ItemText][WithCFString].
  363. }
  364. kHIMenuAppendItem = $0000FFFF;
  365. const
  366. noMark = 0; { mark symbol for SetItemMark; other mark symbols are defined in Fonts.h }
  367. { obsolete menu color table constants}
  368. const
  369. mctAllItems = -98; {search for all Items for the given ID}
  370. mctLastIDIndic = -99; {last color table entry has this in ID field}
  371. { Constants for use with MacOS 8.0 (Appearance 1.0) and later}
  372. const
  373. kMenuStdMenuProc = 63;
  374. kMenuStdMenuBarProc = 63;
  375. { For use with Get/SetMenuItemModifiers}
  376. const
  377. kMenuNoModifiers = 0; { Mask for no modifiers}
  378. kMenuShiftModifier = 1 shl 0; { Mask for shift key modifier}
  379. kMenuOptionModifier = 1 shl 1; { Mask for option key modifier}
  380. kMenuControlModifier = 1 shl 2; { Mask for control key modifier}
  381. kMenuNoCommandModifier = 1 shl 3; { Mask for no command key modifier}
  382. { For use with Get/SetMenuItemIconHandle}
  383. const
  384. kMenuNoIcon = 0; { No icon}
  385. kMenuIconType = 1; { Type for ICON}
  386. kMenuShrinkIconType = 2; { Type for ICON plotted 16 x 16}
  387. kMenuSmallIconType = 3; { Type for SICN}
  388. kMenuColorIconType = 4; { Type for cicn}
  389. kMenuIconSuiteType = 5; { Type for Icon Suite}
  390. kMenuIconRefType = 6; { Type for Icon Ref}
  391. kMenuCGImageRefType = 7; { Type for a CGImageRef (Mac OS X only)}
  392. kMenuSystemIconSelectorType = 8; { Type for an OSType identifying an IconRef registered with Icon Services under kSystemIconsCreator (Mac OS X 10.1 and later only)}
  393. kMenuIconResourceType = 9; { Type for a CFStringRef with the full name of a .icns resource in the main bundle of the process (Mac OS X 10.1 and later only)}
  394. { For use with Get/SetMenuItemKeyGlyph}
  395. const
  396. kMenuNullGlyph = $00; { Null (always glyph 1)}
  397. kMenuTabRightGlyph = $02; { Tab to the right key (for left-to-right script systems)}
  398. kMenuTabLeftGlyph = $03; { Tab to the left key (for right-to-left script systems)}
  399. kMenuEnterGlyph = $04; { Enter key}
  400. kMenuShiftGlyph = $05; { Shift key}
  401. kMenuControlGlyph = $06; { Control key}
  402. kMenuOptionGlyph = $07; { Option key}
  403. kMenuSpaceGlyph = $09; { Space (always glyph 3) key}
  404. kMenuDeleteRightGlyph = $0A; { Delete to the right key (for right-to-left script systems)}
  405. kMenuReturnGlyph = $0B; { Return key (for left-to-right script systems)}
  406. kMenuReturnR2LGlyph = $0C; { Return key (for right-to-left script systems)}
  407. kMenuNonmarkingReturnGlyph = $0D; { Nonmarking return key}
  408. kMenuPencilGlyph = $0F; { Pencil key}
  409. kMenuDownwardArrowDashedGlyph = $10; { Downward dashed arrow key}
  410. kMenuCommandGlyph = $11; { Command key}
  411. kMenuCheckmarkGlyph = $12; { Checkmark key}
  412. kMenuDiamondGlyph = $13; { Diamond key}
  413. kMenuAppleLogoFilledGlyph = $14; { Apple logo key (filled)}
  414. kMenuParagraphKoreanGlyph = $15; { Unassigned (paragraph in Korean)}
  415. kMenuDeleteLeftGlyph = $17; { Delete to the left key (for left-to-right script systems)}
  416. kMenuLeftArrowDashedGlyph = $18; { Leftward dashed arrow key}
  417. kMenuUpArrowDashedGlyph = $19; { Upward dashed arrow key}
  418. kMenuRightArrowDashedGlyph = $1A; { Rightward dashed arrow key}
  419. kMenuEscapeGlyph = $1B; { Escape key}
  420. kMenuClearGlyph = $1C; { Clear key}
  421. kMenuLeftDoubleQuotesJapaneseGlyph = $1D; { Unassigned (left double quotes in Japanese)}
  422. kMenuRightDoubleQuotesJapaneseGlyph = $1E; { Unassigned (right double quotes in Japanese)}
  423. kMenuTrademarkJapaneseGlyph = $1F; { Unassigned (trademark in Japanese)}
  424. kMenuBlankGlyph = $61; { Blank key}
  425. kMenuPageUpGlyph = $62; { Page up key}
  426. kMenuCapsLockGlyph = $63; { Caps lock key}
  427. kMenuLeftArrowGlyph = $64; { Left arrow key}
  428. kMenuRightArrowGlyph = $65; { Right arrow key}
  429. kMenuNorthwestArrowGlyph = $66; { Northwest arrow key}
  430. kMenuHelpGlyph = $67; { Help key}
  431. kMenuUpArrowGlyph = $68; { Up arrow key}
  432. kMenuSoutheastArrowGlyph = $69; { Southeast arrow key}
  433. kMenuDownArrowGlyph = $6A; { Down arrow key}
  434. kMenuPageDownGlyph = $6B; { Page down key}
  435. kMenuAppleLogoOutlineGlyph = $6C; { Apple logo key (outline)}
  436. kMenuContextualMenuGlyph = $6D; { Contextual menu key}
  437. kMenuPowerGlyph = $6E; { Power key}
  438. kMenuF1Glyph = $6F; { F1 key}
  439. kMenuF2Glyph = $70; { F2 key}
  440. kMenuF3Glyph = $71; { F3 key}
  441. kMenuF4Glyph = $72; { F4 key}
  442. kMenuF5Glyph = $73; { F5 key}
  443. kMenuF6Glyph = $74; { F6 key}
  444. kMenuF7Glyph = $75; { F7 key}
  445. kMenuF8Glyph = $76; { F8 key}
  446. kMenuF9Glyph = $77; { F9 key}
  447. kMenuF10Glyph = $78; { F10 key}
  448. kMenuF11Glyph = $79; { F11 key}
  449. kMenuF12Glyph = $7A; { F12 key}
  450. kMenuF13Glyph = $87; { F13 key}
  451. kMenuF14Glyph = $88; { F14 key}
  452. kMenuF15Glyph = $89; { F15 key}
  453. kMenuControlISOGlyph = $8A; { Control key (ISO standard)}
  454. kMenuEjectGlyph = $8C; { Eject key (available on Mac OS X 10.2 and later)}
  455. kMenuEisuGlyph = $8D; { Japanese eisu key (available in Mac OS X 10.4 and later)}
  456. kMenuKanaGlyph = $8E; { Japanese kana key (available in Mac OS X 10.4 and later)}
  457. {
  458. * MenuAttributes
  459. *
  460. * Summary:
  461. * Menu attributes control behavior of the entire menu. They are
  462. * used with the Get/ChangeMenuAttributes APIs.
  463. }
  464. type
  465. MenuAttributes = UInt32;
  466. const
  467. {
  468. * No column space is allocated for the mark character when this menu
  469. * is drawn.
  470. }
  471. kMenuAttrExcludesMarkColumn = 1 shl 0;
  472. {
  473. * The menu title is automatically disabled when all items are
  474. * disabled.
  475. }
  476. kMenuAttrAutoDisable = 1 shl 2;
  477. {
  478. * The pencil glyph from the Keyboard font (kMenuPencilGlyph) is used
  479. * to draw the Control modifier key in menu keyboard equivalents.
  480. * This appearance is typically used only by Japanese input method
  481. * menus.
  482. }
  483. kMenuAttrUsePencilGlyph = 1 shl 3;
  484. {
  485. * The menu title is not drawn in the menubar, even when the menu is
  486. * inserted in the menubar. Useful for adding command keys that don't
  487. * correspond to a visible menu item; menu items with the desired
  488. * command keys can be added to the menu and inserted in the menubar
  489. * without making the menu visible. This attribute is available in
  490. * Mac OS X 10.2 and later.
  491. }
  492. kMenuAttrHidden = 1 shl 4;
  493. {
  494. * If menu item separators are present at the beginning or end of the
  495. * menu, or if multiple contiguous separators are present, the extra
  496. * separator items are marked as hidden to avoid extra blank space in
  497. * the menu. The menu is examined for extra separators whenever the
  498. * menu size is recalculated. This attribute is available in Mac OS X
  499. * 10.3 and later.
  500. }
  501. kMenuAttrCondenseSeparators = 1 shl 5;
  502. {
  503. * Disables automatic caching of the menu image by the Menu Manager.
  504. * Automatic caching is provided for all menus that use an HIView to
  505. * draw their content. Setting this attribute will prevent the Menu
  506. * Manager from caching the menu image; instead, the menu will be
  507. * drawn using the standard HIView drawing mechanism each time that
  508. * it is displayed. This attribute is available in Mac OS X 10.3 and
  509. * later.
  510. }
  511. kMenuAttrDoNotCacheImage = 1 shl 6;
  512. {
  513. * Disables substitution of command keys from the
  514. * NSUserKeyEquivalents dictionary. By default, all menu items are
  515. * checked for a match in the dictionary. Note that this attribute,
  516. * to be effective, should be added at the time that the menu is
  517. * created; once the menu has been searched for user command keys
  518. * (which occurs in CalcMenuSize, in GetItemCmd and
  519. * GetMenuItemCommandKey, and before command key matching), the
  520. * original command keys are replaced by the user command keys and
  521. * cannot be retrieved. For this reason, it is also not useful to
  522. * clear this attribute; the original command keys cannot be
  523. * restored. This attribute is available in Mac OS X 10.3 and later.
  524. }
  525. kMenuAttrDoNotUseUserCommandKeys = 1 shl 7;
  526. {
  527. * MenuItemAttributes
  528. *
  529. * Summary:
  530. * Menu item attributes control behavior of individual menu items.
  531. * They are used with the Get/ChangeMenuItemAttributes APIs.
  532. }
  533. type
  534. MenuItemAttributes = UInt32;
  535. const
  536. {
  537. * This item is disabled.
  538. }
  539. kMenuItemAttrDisabled = 1 shl 0;
  540. {
  541. * This item's icon is disabled.
  542. }
  543. kMenuItemAttrIconDisabled = 1 shl 1;
  544. {
  545. * Allows the parent item of a submenu to be selectable.
  546. }
  547. kMenuItemAttrSubmenuParentChoosable = 1 shl 2;
  548. {
  549. * This item changes dynamically based on modifier key state.
  550. }
  551. kMenuItemAttrDynamic = 1 shl 3;
  552. {
  553. * This item is not part of the same dynamic group as the previous
  554. * item.
  555. }
  556. kMenuItemAttrNotPreviousAlternate = 1 shl 4;
  557. {
  558. * This item is not drawn when the menu is displayed. It is also not
  559. * included in command key matching, unless the item also has either
  560. * the Dynamic or IncludeInCmdKeyMatching attributes.
  561. }
  562. kMenuItemAttrHidden = 1 shl 5;
  563. {
  564. * This item is a separator; the text of the item is ignored.
  565. }
  566. kMenuItemAttrSeparator = 1 shl 6;
  567. {
  568. * This item is a menu section header; it is disabled and
  569. * unselectable.
  570. }
  571. kMenuItemAttrSectionHeader = 1 shl 7;
  572. {
  573. * Metacharacters in the text of this item (such as the dash) are
  574. * ignored.
  575. }
  576. kMenuItemAttrIgnoreMeta = 1 shl 8;
  577. {
  578. * This item is recognized by IsMenuKeyEvent when it is passed an
  579. * auto-repeat keyboard event.
  580. }
  581. kMenuItemAttrAutoRepeat = 1 shl 9;
  582. {
  583. * When MenuEvent and IsMenuKeyEvent compare this item's keyboard
  584. * equivalent against a keyboard event, they use the item's virtual
  585. * keycode equivalent rather than its character code equivalent.
  586. }
  587. kMenuItemAttrUseVirtualKey = 1 shl 10;
  588. {
  589. * This item is drawn in a customized fashion by the application.
  590. * Causes custom menu item drawing Carbon events to be sent. This
  591. * attribute is available in CarbonLib 1.4 and Mac OS X 10.1, and
  592. * later.
  593. }
  594. kMenuItemAttrCustomDraw = 1 shl 11;
  595. {
  596. * This item is examined during command key matching by MenuKey,
  597. * MenuEvent, and IsMenuKeyEvent. Normally, visible menu items are
  598. * included in command key matching, but hidden menu items are
  599. * excluded (unless the item also has the Dynamic menu item
  600. * attribute). The IncludeInCmdKeyMatching attribute can be used to
  601. * force a hidden, non-dynamic menu item to be included in command
  602. * key matching when it normally wouldn't. This attribute is
  603. * available in CarbonLib 1.6 and Mac OS X 10.2 and later.
  604. }
  605. kMenuItemAttrIncludeInCmdKeyMatching = 1 shl 12;
  606. {
  607. * This item is automatically disabled if, when
  608. * kEventCommandUpdateStatus is sent for this item, no handler is
  609. * installed or all handlers return eventNotHandledErr. A return
  610. * value from any handler of any value other than eventNotHandledErr
  611. * will prevent automatic disabling. This attribute is useful for
  612. * applications that use kEventCommandUpdateStatus events for all
  613. * menu item enabling; previously, an application would need to
  614. * install UpdateStatus handlers on its application target to disable
  615. * all items in the application that were unnecessary when no
  616. * document windows were open. By setting this attribute, all menu
  617. * items will be disabled automatically unless specifically enabled
  618. * by an UpdateStatus handler on a window, control, or application
  619. * target. This attribute is available in Mac OS X 10.3 and later.
  620. }
  621. kMenuItemAttrAutoDisable = 1 shl 13;
  622. {
  623. * During command key matching, the Menu Manager uses a cache of the
  624. * available command keys to locate the menu item that matches an
  625. * event. Before returning this item, the Menu Manager sends a
  626. * kEventMenuEnableItems event to the menu containing the item, and a
  627. * kEventCommandUpdateStatus event to each item in the menu, so that
  628. * the item can be properly enabled or disabled. For some
  629. * applications, updating the item status for each item in the menu
  630. * is quite expensive, and also unnecessary since only a single item
  631. * actually needs to be updated. Setting this attribute indicates to
  632. * the Menu Manager that it only needs to send a
  633. * kEventCommandUpdateStatus event to this menu item before returning
  634. * it from command key matching; kEventMenuEnableItems will not be
  635. * sent to the menu, and no other menu item will receive
  636. * kEventCommandUpdateStatus.
  637. }
  638. kMenuItemAttrUpdateSingleItem = 1 shl 14;
  639. {
  640. * MenuTrackingMode
  641. *
  642. * Summary:
  643. * A menu tracking mode constant is part of the
  644. * kEventMenuBeginTracking and kEventMenuChangeTrackingMode Carbon
  645. * events. It indicates whether menus are being tracked using the
  646. * mouse or keyboard.
  647. }
  648. type
  649. MenuTrackingMode = UInt32;
  650. const
  651. {
  652. * Menus are being tracked using the mouse.
  653. }
  654. kMenuTrackingModeMouse = 1;
  655. {
  656. * Menus are being tracked using the keyboard.
  657. }
  658. kMenuTrackingModeKeyboard = 2;
  659. {
  660. * MenuEventOptions
  661. *
  662. * Summary:
  663. * Menu event options control how the menus are searched for an item
  664. * matching a particular keyboard event. They are used with the
  665. * IsMenuKeyEvent API.
  666. }
  667. type
  668. MenuEventOptions = UInt32;
  669. const
  670. {
  671. * Disabled items are examined for a match.
  672. }
  673. kMenuEventIncludeDisabledItems = $0001;
  674. {
  675. * Don't hilite the menu title if a match is found.
  676. }
  677. kMenuEventQueryOnly = $0002;
  678. {
  679. * Don't look for a match in submenus of the starting menu.
  680. }
  681. kMenuEventDontCheckSubmenus = $0004;
  682. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  683. { ¥ Menu Types }
  684. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  685. type
  686. MenuID = SInt16;
  687. type
  688. MenuItemIndex = UInt16;
  689. MenuItemIndexPtr = ^MenuItemIndex;
  690. MenuCommand = UInt32;
  691. type
  692. MenuRef = ^SInt32; { an opaque 32-bit type }
  693. MenuRefPtr = ^MenuRef;
  694. { MenuHandle is old name for MenuRef}
  695. type
  696. MenuHandle = MenuRef;
  697. {
  698. A MenuBarHandle is a handle to a MenuBarHeader. An instance of this structure is returned
  699. by the GetMenuBar and GetNewMBar APIs. It is typedef'd to a plain Handle to retain
  700. source compatibility with previous versions of this header file.
  701. }
  702. type
  703. MenuBarHandle = Handle;
  704. {
  705. * MenuBarHeader
  706. *
  707. * Summary:
  708. * This structure is contained in a MenuBarHandle. It contains a
  709. * list of the non-hierarchical menus that have been inserted into
  710. * the menubar.
  711. *
  712. * Discussion:
  713. * The MenuBarHandle is a dynamically sized object which cannot be
  714. * directly expressed as a C or Pascal structure. First is the
  715. * MenuBarHeader structure, followed by a dynamically sized array of
  716. * MenuBarMenus, one for each menu. This array is followed by the
  717. * HMenuBarHeader, followed by another dynamically sized array of
  718. * HMenuBarMenus, one for each hierarchical menu.
  719. }
  720. type
  721. MenuBarHeaderPtr = ^MenuBarHeader;
  722. MenuBarHeader = record
  723. {
  724. * Offset in bytes from the start of the header to the last menu in
  725. * the array of MenuBarMenus.
  726. }
  727. lastMenu: UInt16;
  728. {
  729. * Global coordinate of the right edge of the rightmost menu; unused
  730. * in a MenuBarHandle returned by GetMenuBar or GetNewMBar.
  731. }
  732. lastRight: SInt16;
  733. {
  734. * The MBDF resource ID; unused in a MenuBarHandle returned by
  735. * GetMenuBar or GetNewMBar.
  736. }
  737. mbResID: SInt16;
  738. end;
  739. {
  740. * HMenuBarHeader
  741. *
  742. * Summary:
  743. * This structure is contained in a MenuBarHandle. It contains a
  744. * list of the hierarchical menus that have been inserted into the
  745. * menubar with InsertMenu( menu, -1 ).
  746. *
  747. * Discussion:
  748. * The hierarchical portion of the menubar follows the
  749. * non-hierarchical portion in a menubar handle. The hierarchical
  750. * portion begins with the HMenuBarHeader structure, followed by a
  751. * dynamically sized array of HMenuBarMenus.
  752. }
  753. type
  754. HMenuBarHeaderPtr = ^HMenuBarHeader;
  755. HMenuBarHeader = record
  756. {
  757. * Offset in bytes from the start of the header to the last menu in
  758. * the array of HMenuBarMenus.
  759. }
  760. lastHMenu: UInt16;
  761. {
  762. * Saved bits behind the hilited menu title; unused in a
  763. * MenuBarHandle returned by GetMenuBar or GetNewMBar.
  764. }
  765. menuTitleBits: PixMapHandle;
  766. end;
  767. {
  768. * MenuBarMenu
  769. *
  770. * Summary:
  771. * This structure contains a single menu in the menubar. It is an
  772. * element in an array in the MenuBarHeader data strucuture.
  773. }
  774. type
  775. MenuBarMenuPtr = ^MenuBarMenu;
  776. MenuBarMenu = record
  777. {
  778. * A menu in the menubar.
  779. }
  780. menu: MenuRef;
  781. {
  782. * The global coordinate of the left edge of the menu title; unused
  783. * in a MenuBarHandle returned by GetMenuBar or GetNewMBar.
  784. }
  785. menuLeft: SInt16;
  786. end;
  787. {
  788. * HMenuBarMenu
  789. *
  790. * Summary:
  791. * This structure contains a single hierarchical menu in the
  792. * menubar. It is an element in an array in the HMenuBarHeader data
  793. * strucuture.
  794. }
  795. type
  796. HMenuBarMenuPtr = ^HMenuBarMenu;
  797. HMenuBarMenu = record
  798. {
  799. * An hierarchical menu in the menubar.
  800. }
  801. menu: MenuRef;
  802. {
  803. * This field is currently unused.
  804. }
  805. reserved: SInt16;
  806. end;
  807. type
  808. MCEntry = record
  809. mctID: MenuID; {menu ID. ID = 0 is the menu bar}
  810. mctItem: SInt16; {menu Item. Item = 0 is a title}
  811. mctRGB1: RGBColor; {usage depends on ID and Item}
  812. mctRGB2: RGBColor; {usage depends on ID and Item}
  813. mctRGB3: RGBColor; {usage depends on ID and Item}
  814. mctRGB4: RGBColor; {usage depends on ID and Item}
  815. mctReserved: SInt16; {reserved for internal use}
  816. end;
  817. MCEntryPtr = ^MCEntry;
  818. type
  819. MCTable = array [0..0] of MCEntry; {ARRAY [1..numEntries] of MCEntry}
  820. MCTablePtr = ^MCTable;
  821. MCTableHandle = ^MCTablePtr;
  822. type
  823. MenuCRsrc = record
  824. numEntries: SInt16; {number of entries}
  825. mcEntryRecs: MCTable;
  826. end;
  827. MenuCRsrcPtr = ^MenuCRsrc;
  828. type
  829. MenuCRsrcHandle = ^MenuCRsrcPtr;
  830. {
  831. * MenuTrackingData
  832. *
  833. * Summary:
  834. * The MenuTrackingData structure contains information about a menu
  835. * currently being displayed. It is used with the
  836. * GetMenuTrackingData API.
  837. }
  838. type
  839. MenuTrackingData = record
  840. menu: MenuRef;
  841. itemSelected: MenuItemIndex;
  842. itemUnderMouse: MenuItemIndex;
  843. itemRect: Rect;
  844. virtualMenuTop: SInt32;
  845. virtualMenuBottom: SInt32;
  846. end;
  847. MenuTrackingDataPtr = ^MenuTrackingData;
  848. {
  849. * MDEFHiliteItemData
  850. *
  851. * Summary:
  852. * The MDEFHiliteItemData structure contains information about which
  853. * menu items should be hilited and unhilited as the user moves
  854. * through the menus. It is used by menu definition functions, which
  855. * receive a pointer to an MDEFHiliteItemData structure as the
  856. * whichItem parameter during kMenuHiliteItemMsg.
  857. }
  858. type
  859. MDEFHiliteItemData = record
  860. {
  861. * The item that was previously selected. It should be redrawn in an
  862. * unhilited state. May be zero if no item was previously selected.
  863. }
  864. previousItem: MenuItemIndex;
  865. {
  866. * The item that is now selected. It should be redrawn in a hilited
  867. * state. May be zero if no item is now selected.
  868. }
  869. newItem: MenuItemIndex;
  870. {
  871. * A CoreGraphics context that the MDEF should draw into. The Menu
  872. * Manager will flush the context after the MDEF has returned.
  873. }
  874. context: UnivPtr;
  875. end;
  876. MDEFHiliteItemDataPtr = ^MDEFHiliteItemData;
  877. type
  878. HiliteMenuItemData = MDEFHiliteItemData;
  879. type
  880. HiliteMenuItemDataPtr = MDEFHiliteItemDataPtr;
  881. {
  882. * MDEFDrawData
  883. *
  884. * Summary:
  885. * The MDEFDrawData structure contains information needed to draw a
  886. * menu. It is used by menu definition functions, which receive a
  887. * pointer to an MDEFDrawData structure as the whichItem parameter
  888. * during kMenuDrawMsg.
  889. }
  890. type
  891. MDEFDrawData = record
  892. {
  893. * Information about the menu being drawn. The MDEF should fill in
  894. * the virtualMenuTop and virtualMenuBottom fields of this structure
  895. * while drawing the menu.
  896. }
  897. trackingData: MenuTrackingData;
  898. {
  899. * A CoreGraphics context that the MDEF should draw into. The Menu
  900. * Manager will flush the context after the MDEF has returned.
  901. }
  902. context: UnivPtr;
  903. end;
  904. MDEFDrawDataPtr = ^MDEFDrawData;
  905. {
  906. * MDEFFindItemData
  907. *
  908. * Summary:
  909. * The MDEFFindItemData structure contains information needed to
  910. * determine which item is currently selected by the user. It is
  911. * used by menu definition functions, which receive a pointer to an
  912. * MDEFDrawData structure as the whichItem parameter during
  913. * kMenuFindItemMsg.
  914. }
  915. type
  916. MDEFFindItemData = record
  917. {
  918. * Information about the menu being drawn. The MDEF should fill in
  919. * the itemSelected, itemUnderMouse, and itemRect fields of this
  920. * structure after determining which item is at the specified point.
  921. }
  922. trackingData: MenuTrackingData;
  923. {
  924. * A CoreGraphics context that the MDEF should draw into if it needs
  925. * to scroll the menu during the FindItem message. The Menu Manager
  926. * will flush the context after the MDEF has returned.
  927. }
  928. context: UnivPtr;
  929. end;
  930. MDEFFindItemDataPtr = ^MDEFFindItemData;
  931. {
  932. * MDEFDrawItemsData
  933. *
  934. * Summary:
  935. * The MDEFDrawItemsData structure contains information about which
  936. * menu items to redraw. It is used by menu definition functions,
  937. * which receive a pointer to an MDEFDrawItemsData structure as the
  938. * whichItem parameter during kMenuDrawItemsMsg.
  939. }
  940. type
  941. MDEFDrawItemsData = record
  942. {
  943. * The first item to draw.
  944. }
  945. firstItem: MenuItemIndex;
  946. {
  947. * The last item to draw.
  948. }
  949. lastItem: MenuItemIndex;
  950. {
  951. * Information about the menu's tracking state. The virtualMenuTop
  952. * and virtualMenuBottom fields in this structure will be the most
  953. * useful in handling the DrawItems message.
  954. }
  955. trackingData: MenuTrackingDataPtr;
  956. {
  957. * A CoreGraphics context that the MDEF should draw into. The Menu
  958. * Manager will flush the context after the MDEF returns.
  959. }
  960. context: UnivPtr;
  961. end;
  962. MDEFDrawItemsDataPtr = ^MDEFDrawItemsData;
  963. {
  964. * Summary:
  965. * A MenuItemDataFlags value indicates which fields of a
  966. * MenuItemDataRec structure should be used by the
  967. * Copy/SetMenuItemData APIs. All MenuItemDataFlags may be used when
  968. * getting or setting the contents of a menu item; some may also be
  969. * used when getting or setting information about the menu itself,
  970. * if the item index given to Copy/SetMenuItemData is 0.
  971. }
  972. const
  973. {
  974. * Set or return the Str255 text of a menu using the
  975. * MenuItemDataRec.text field. If getting the text, the text field
  976. * must be initialized with a pointer to a Str255 variable before
  977. * calling CopyMenuItemData. If both kMenuItemDataText and
  978. * kMenuItemCFString are set on entry to CopyMenuItemData, the API
  979. * will determine whether the menu text was most recently set using a
  980. * Str255 or CFString, and return only that text format; the flags
  981. * value for the other format will be cleared. Valid for both menu
  982. * items and the menu title (if item number is 0).
  983. }
  984. kMenuItemDataText = 1 shl 0;
  985. {
  986. * Set or return the mark character of a menu item using the
  987. * MenuItemDataRec.mark field. Valid only for menu items.
  988. }
  989. kMenuItemDataMark = 1 shl 1;
  990. {
  991. * Set or return the command key of a menu item using the
  992. * MenuItemDataRec.cmdKey field. Valid only for menu items.
  993. }
  994. kMenuItemDataCmdKey = 1 shl 2;
  995. {
  996. * Set or return the command key glyph of a menu item using the
  997. * MenuItemDataRec.cmdKeyGlyph field. Valid only for menu items.
  998. }
  999. kMenuItemDataCmdKeyGlyph = 1 shl 3;
  1000. {
  1001. * Set or return the command key modifiers of a menu item using the
  1002. * MenuItemDataRec.cmdKeyModifiers field. Valid only for menu items.
  1003. }
  1004. kMenuItemDataCmdKeyModifiers = 1 shl 4;
  1005. {
  1006. * Set or return the QuickDraw text style of a menu item using the
  1007. * MenuItemDataRec.style field. Valid only for menu items.
  1008. }
  1009. kMenuItemDataStyle = 1 shl 5;
  1010. {
  1011. * Set or return the enable state of a menu using the
  1012. * MenuItemDataRec.enabled field. Valid for both menu items and the
  1013. * menu itself (if item number is 0).
  1014. }
  1015. kMenuItemDataEnabled = 1 shl 6;
  1016. {
  1017. * Set or return the enable state of a menu item icon using the
  1018. * MenuItemDataRec.iconEnabled field. Valid only for menu items.
  1019. }
  1020. kMenuItemDataIconEnabled = 1 shl 7;
  1021. {
  1022. * Set or return the icon resource ID of a menu item using the
  1023. * MenuItemDataRec.iconID field. Valid only for menu items.
  1024. }
  1025. kMenuItemDataIconID = 1 shl 8;
  1026. {
  1027. * Set or return the icon handle of a menu item using the
  1028. * MenuItemDataRec.iconType and MenuItemDataRec.iconHandle fields.
  1029. * Both fields must be initialized if setting the icon handle; both
  1030. * fields will be returned when getting the handle. The iconType
  1031. * field should contain one of the constants kMenuIconType,
  1032. * kMenuShrinkIconType, kMenuSmallIconType, kMenuColorIconType,
  1033. * kMenuIconSuiteType, kMenuIconRefType, kMenuCGImageRefType,
  1034. * kMenuSystemIconSelectorType, or kMenuIconResourceType. An icon
  1035. * handle may be a handle to an ICON resource, a SICN resource, a
  1036. * cicn resource, an IconSuite, an IconRef, a CGImageRef, an OSType,
  1037. * or a CFStringRef. Valid only for menu items.
  1038. }
  1039. kMenuItemDataIconHandle = 1 shl 9;
  1040. {
  1041. * Set or return the command ID of a menu item using the
  1042. * MenuItemDataRec.cmdID field. Valid only for menu items.
  1043. }
  1044. kMenuItemDataCommandID = 1 shl 10;
  1045. {
  1046. * Set or return the text encoding of a menu item using the
  1047. * MenuItemDataRec.encoding field. Valid only for menu items.
  1048. }
  1049. kMenuItemDataTextEncoding = 1 shl 11;
  1050. kMenuItemDataSubmenuID = 1 shl 12;
  1051. kMenuItemDataSubmenuHandle = 1 shl 13;
  1052. kMenuItemDataFontID = 1 shl 14;
  1053. kMenuItemDataRefcon = 1 shl 15;
  1054. kMenuItemDataAttributes = 1 shl 16;
  1055. kMenuItemDataCFString = 1 shl 17;
  1056. {
  1057. * Set or return the properties of a menu using the
  1058. * MenuItemDataRec.properties field. If setting the properties, the
  1059. * properties field should contain a collection with the new
  1060. * properties; existing menu properties with the same collection
  1061. * creator and tag will be replaced by the new properties. If getting
  1062. * the properties, the properties field should either be set to NULL
  1063. * or to a valid Collection. If NULL, a new collection is allocated
  1064. * by the CopyMenuItemData and returned in the properties field. If
  1065. * not NULL, the entire contents of the collection are replaced by
  1066. * the properties of the menu. Valid for both menu items and the menu
  1067. * itself (if item number is 0).
  1068. }
  1069. kMenuItemDataProperties = 1 shl 18;
  1070. {
  1071. * Set or return the item indent level of a menu item using the
  1072. * MenuItemDataRec.indent field. Valid only for menu items.
  1073. }
  1074. kMenuItemDataIndent = 1 shl 19;
  1075. {
  1076. * Set or return the virtual key code keyboard equivalent of a menu
  1077. * item using the MenuItemDataRec.cmdVirtualKey field. Valid only for
  1078. * menu items. On output, only valid if the item has the
  1079. * kMenuItemAttrUseVirtualKeyCode attribute.
  1080. }
  1081. kMenuItemDataCmdVirtualKey = 1 shl 20;
  1082. kMenuItemDataAllDataVersionOne = $000FFFFF;
  1083. kMenuItemDataAllDataVersionTwo = kMenuItemDataAllDataVersionOne or kMenuItemDataCmdVirtualKey;
  1084. type
  1085. MenuItemDataFlags = UInt64;
  1086. {
  1087. * MenuItemDataRec
  1088. *
  1089. * Summary:
  1090. * The MenuItemDataRec structure is used to get and change aspects
  1091. * of a menu item. It is used with the Copy/SetMenuItemData APIs.
  1092. *
  1093. * Discussion:
  1094. * When using this structure with Copy/SetMenuItemData, the caller
  1095. * must first set the whichData field to a combination of
  1096. * MenuItemDataFlags indicating which specific data should be
  1097. * retrieved or set. Some fields also require initialization before
  1098. * calling CopyMenuItemData; see the individual MenuItemDataFlags
  1099. * documentation for details.
  1100. }
  1101. type
  1102. MenuItemDataRecPtr = ^MenuItemDataRec;
  1103. MenuItemDataRec = record
  1104. whichData: MenuItemDataFlags;
  1105. text: StringPtr;
  1106. mark: UniChar;
  1107. cmdKey: UniChar;
  1108. cmdKeyGlyph: UInt32;
  1109. cmdKeyModifiers: UInt32;
  1110. style: Style;
  1111. enabled: Boolean;
  1112. iconEnabled: Boolean;
  1113. filler1: SInt8;
  1114. iconID: SInt32;
  1115. iconType: UInt32;
  1116. iconHandle: Handle;
  1117. cmdID: MenuCommand;
  1118. encoding: TextEncoding;
  1119. submenuID: MenuID;
  1120. submenuHandle: MenuRef;
  1121. fontID: SInt32;
  1122. refcon: UInt32;
  1123. attr: OptionBits;
  1124. cfText: CFStringRef;
  1125. properties: Collection;
  1126. indent: UInt32;
  1127. cmdVirtualKey: UInt16;
  1128. end;
  1129. type
  1130. MenuItemDataPtr = MenuItemDataRecPtr;
  1131. type
  1132. MenuItemID = UInt32;
  1133. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  1134. { ¥ Menu ProcPtrs }
  1135. { All of these procs are considered deprecated. Developers interested in portability }
  1136. { to Carbon should avoid them entirely, if at all possible. }
  1137. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  1138. type
  1139. MenuDefProcPtr = procedure( message: SInt16; theMenu: MenuRef; var menuRect: Rect; hitPt: Point; var whichItem: SInt16 );
  1140. type
  1141. MenuDefUPP = MenuDefProcPtr;
  1142. {
  1143. * NewMenuDefUPP()
  1144. *
  1145. * Availability:
  1146. * Mac OS X: in version 10.0 and later in Carbon.framework
  1147. * CarbonLib: in CarbonLib 1.0 and later
  1148. * Non-Carbon CFM: available as macro/inline
  1149. }
  1150. function NewMenuDefUPP( userRoutine: MenuDefProcPtr ): MenuDefUPP; external name '_NewMenuDefUPP';
  1151. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1152. {
  1153. * DisposeMenuDefUPP()
  1154. *
  1155. * Availability:
  1156. * Mac OS X: in version 10.0 and later in Carbon.framework
  1157. * CarbonLib: in CarbonLib 1.0 and later
  1158. * Non-Carbon CFM: available as macro/inline
  1159. }
  1160. procedure DisposeMenuDefUPP( userUPP: MenuDefUPP ); external name '_DisposeMenuDefUPP';
  1161. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1162. {
  1163. * InvokeMenuDefUPP()
  1164. *
  1165. * Availability:
  1166. * Mac OS X: in version 10.0 and later in Carbon.framework
  1167. * CarbonLib: in CarbonLib 1.0 and later
  1168. * Non-Carbon CFM: available as macro/inline
  1169. }
  1170. procedure InvokeMenuDefUPP( message: SInt16; theMenu: MenuRef; var menuRect: Rect; hitPt: Point; var whichItem: SInt16; userUPP: MenuDefUPP ); external name '_InvokeMenuDefUPP';
  1171. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1172. type
  1173. MenuBarDefProcPtr = function( selector: SInt16; message: SInt16; parameter1: SInt16; parameter2: SInt32 ): SInt32;
  1174. type
  1175. MenuHookProcPtr = procedure;
  1176. type
  1177. MBarHookProcPtr = function( var menuRect: Rect ): SInt16;
  1178. type
  1179. MenuBarDefUPP = MenuBarDefProcPtr;
  1180. type
  1181. MenuHookUPP = MenuHookProcPtr;
  1182. type
  1183. MBarHookUPP = MBarHookProcPtr;
  1184. {
  1185. * NewMenuBarDefUPP()
  1186. *
  1187. * Availability:
  1188. * Mac OS X: not available
  1189. * CarbonLib: not available
  1190. * Non-Carbon CFM: available as macro/inline
  1191. }
  1192. {
  1193. * NewMenuHookUPP()
  1194. *
  1195. * Availability:
  1196. * Mac OS X: not available
  1197. * CarbonLib: not available
  1198. * Non-Carbon CFM: available as macro/inline
  1199. }
  1200. {
  1201. * NewMBarHookUPP()
  1202. *
  1203. * Availability:
  1204. * Mac OS X: not available
  1205. * CarbonLib: not available
  1206. * Non-Carbon CFM: available as macro/inline
  1207. }
  1208. {
  1209. * DisposeMenuBarDefUPP()
  1210. *
  1211. * Availability:
  1212. * Mac OS X: not available
  1213. * CarbonLib: not available
  1214. * Non-Carbon CFM: available as macro/inline
  1215. }
  1216. {
  1217. * DisposeMenuHookUPP()
  1218. *
  1219. * Availability:
  1220. * Mac OS X: not available
  1221. * CarbonLib: not available
  1222. * Non-Carbon CFM: available as macro/inline
  1223. }
  1224. {
  1225. * DisposeMBarHookUPP()
  1226. *
  1227. * Availability:
  1228. * Mac OS X: not available
  1229. * CarbonLib: not available
  1230. * Non-Carbon CFM: available as macro/inline
  1231. }
  1232. {
  1233. * InvokeMenuBarDefUPP()
  1234. *
  1235. * Availability:
  1236. * Mac OS X: not available
  1237. * CarbonLib: not available
  1238. * Non-Carbon CFM: available as macro/inline
  1239. }
  1240. {
  1241. * InvokeMenuHookUPP()
  1242. *
  1243. * Availability:
  1244. * Mac OS X: not available
  1245. * CarbonLib: not available
  1246. * Non-Carbon CFM: available as macro/inline
  1247. }
  1248. {
  1249. * InvokeMBarHookUPP()
  1250. *
  1251. * Availability:
  1252. * Mac OS X: not available
  1253. * CarbonLib: not available
  1254. * Non-Carbon CFM: available as macro/inline
  1255. }
  1256. {
  1257. * Summary:
  1258. * Types of custom menu definitions.
  1259. }
  1260. const
  1261. {
  1262. * A custom menu definition using a function pointer based on the
  1263. * pre-Carbon MDEF model.
  1264. }
  1265. kMenuDefProcPtr = 0;
  1266. {
  1267. * A custom menu definition using an HIView subclass. Available in
  1268. * Mac OS X 10.3 and later.
  1269. }
  1270. kMenuDefClassID = 1;
  1271. type
  1272. MenuDefType = UInt32;
  1273. {
  1274. * MenuDefSpec
  1275. *
  1276. * Summary:
  1277. * Specifies a custom menu definition.
  1278. }
  1279. type
  1280. MenuDefSpec = record
  1281. {
  1282. * The type of menu definition: either kMenuDefProcPtr or
  1283. * kMenuDefClassID. kMenuDefClassID may only be used in Mac OS X 10.3
  1284. * and later.
  1285. }
  1286. defType: MenuDefType;
  1287. case SInt16 of
  1288. 0: (
  1289. defProc: MenuDefUPP;
  1290. );
  1291. 1: (
  1292. classID: CFStringRef;
  1293. initEvent: EventRef;
  1294. );
  1295. end;
  1296. MenuDefSpecPtr = ^MenuDefSpec;
  1297. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  1298. { ¥ Menu Manager Initialization }
  1299. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  1300. {
  1301. * InitProcMenu()
  1302. *
  1303. * Availability:
  1304. * Mac OS X: not available
  1305. * CarbonLib: not available
  1306. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1307. }
  1308. {
  1309. * InitMenus()
  1310. *
  1311. * Availability:
  1312. * Mac OS X: not available
  1313. * CarbonLib: not available
  1314. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1315. }
  1316. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  1317. { ¥ Menu Manipulation }
  1318. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  1319. {
  1320. * NewMenu()
  1321. *
  1322. * Mac OS X threading:
  1323. * Not thread safe
  1324. *
  1325. * Availability:
  1326. * Mac OS X: in version 10.0 and later in Carbon.framework
  1327. * CarbonLib: in CarbonLib 1.0 and later
  1328. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1329. }
  1330. function NewMenu( menuID_: MenuID; const (*var*) menuTitle: Str255 ): MenuRef; external name '_NewMenu';
  1331. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1332. {
  1333. * [Mac]GetMenu()
  1334. *
  1335. * Mac OS X threading:
  1336. * Not thread safe
  1337. *
  1338. * Availability:
  1339. * Mac OS X: in version 10.0 and later in Carbon.framework
  1340. * CarbonLib: in CarbonLib 1.0 and later
  1341. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1342. }
  1343. function GetMenu( resourceID: SInt16 ): MenuRef; external name '_GetMenu';
  1344. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1345. function MacGetMenu( resourceID: SInt16 ): MenuRef; external name '_GetMenu';
  1346. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1347. {
  1348. * DisposeMenu()
  1349. *
  1350. * Mac OS X threading:
  1351. * Not thread safe
  1352. *
  1353. * Availability:
  1354. * Mac OS X: in version 10.0 and later in Carbon.framework
  1355. * CarbonLib: in CarbonLib 1.0 and later
  1356. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1357. }
  1358. procedure DisposeMenu( theMenu: MenuRef ); external name '_DisposeMenu';
  1359. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1360. {
  1361. * CalcMenuSize()
  1362. *
  1363. * Mac OS X threading:
  1364. * Not thread safe
  1365. *
  1366. * Availability:
  1367. * Mac OS X: in version 10.0 and later in Carbon.framework
  1368. * CarbonLib: in CarbonLib 1.0 and later
  1369. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1370. }
  1371. procedure CalcMenuSize( theMenu: MenuRef ); external name '_CalcMenuSize';
  1372. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1373. {
  1374. * CountMItems()
  1375. *
  1376. * Summary:
  1377. * Renamed to CountMenuItems in Carbon
  1378. *
  1379. * Availability:
  1380. * Mac OS X: not available
  1381. * CarbonLib: not available
  1382. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1383. }
  1384. {
  1385. * CountMenuItems()
  1386. *
  1387. * Mac OS X threading:
  1388. * Not thread safe
  1389. *
  1390. * Availability:
  1391. * Mac OS X: in version 10.0 and later in Carbon.framework
  1392. * CarbonLib: in CarbonLib 1.0 and later
  1393. * Non-Carbon CFM: in CarbonAccessors.o 1.3 and later or as macro/inline
  1394. }
  1395. function CountMenuItems( theMenu: MenuRef ): UInt16; external name '_CountMenuItems';
  1396. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1397. { Routines available in Mac OS 8.5 and later, and on Mac OS 8.1 and later using CarbonLib 1.1 and later}
  1398. {
  1399. * GetMenuFont()
  1400. *
  1401. * Mac OS X threading:
  1402. * Not thread safe
  1403. *
  1404. * Availability:
  1405. * Mac OS X: in version 10.0 and later in Carbon.framework
  1406. * CarbonLib: in CarbonLib 1.0 and later
  1407. * Non-Carbon CFM: in MenusLib 8.5 and later
  1408. }
  1409. function GetMenuFont( menu: MenuRef; var outFontID: SInt16; var outFontSize: UInt16 ): OSStatus; external name '_GetMenuFont';
  1410. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1411. {
  1412. * SetMenuFont()
  1413. *
  1414. * Mac OS X threading:
  1415. * Not thread safe
  1416. *
  1417. * Availability:
  1418. * Mac OS X: in version 10.0 and later in Carbon.framework
  1419. * CarbonLib: in CarbonLib 1.0 and later
  1420. * Non-Carbon CFM: in MenusLib 8.5 and later
  1421. }
  1422. function SetMenuFont( menu: MenuRef; inFontID: SInt16; inFontSize: UInt16 ): OSStatus; external name '_SetMenuFont';
  1423. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1424. {
  1425. * GetMenuExcludesMarkColumn()
  1426. *
  1427. * Mac OS X threading:
  1428. * Not thread safe
  1429. *
  1430. * Availability:
  1431. * Mac OS X: in version 10.0 and later in Carbon.framework
  1432. * CarbonLib: in CarbonLib 1.0 and later
  1433. * Non-Carbon CFM: in MenusLib 8.5 and later
  1434. }
  1435. function GetMenuExcludesMarkColumn( menu: MenuRef ): Boolean; external name '_GetMenuExcludesMarkColumn';
  1436. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1437. {
  1438. * SetMenuExcludesMarkColumn()
  1439. *
  1440. * Mac OS X threading:
  1441. * Not thread safe
  1442. *
  1443. * Availability:
  1444. * Mac OS X: in version 10.0 and later in Carbon.framework
  1445. * CarbonLib: in CarbonLib 1.0 and later
  1446. * Non-Carbon CFM: in MenusLib 8.5 and later
  1447. }
  1448. function SetMenuExcludesMarkColumn( menu: MenuRef; excludesMark: Boolean ): OSStatus; external name '_SetMenuExcludesMarkColumn';
  1449. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1450. {
  1451. * RegisterMenuDefinition()
  1452. *
  1453. * Summary:
  1454. * Registers or unregisters a binding between a resource ID and a
  1455. * menu definition function.
  1456. *
  1457. * Discussion:
  1458. * In the classic Mac OS Menu Manager, a 'MENU' resource can contain
  1459. * an embedded MDEF procID that is used by the Menu Manager as the
  1460. * resource ID of an 'MDEF' resource to measure and draw the menu.
  1461. * The 'MDEF' resource is loaded by the Menu Manager when you load
  1462. * the menu with GetMenu. Since MDEFs can no longer be packaged as
  1463. * code resources on Carbon, the procID can no longer refer directly
  1464. * to an MDEF resource. However, using RegisterMenuDefinition you
  1465. * can instead specify a UniversalProcPtr pointing to code in your
  1466. * application code fragment.
  1467. *
  1468. * Mac OS X threading:
  1469. * Not thread safe
  1470. *
  1471. * Parameters:
  1472. *
  1473. * inResID:
  1474. * An MDEF proc ID, as used in a 'MENU' resource.
  1475. *
  1476. * inDefSpec:
  1477. * Specifies the MenuDefUPP that should be used for menus with the
  1478. * given MDEF proc ID. Passing NULL allows you to unregister the
  1479. * menu definition that had been associated with the given MDEF
  1480. * proc ID.
  1481. *
  1482. * Availability:
  1483. * Mac OS X: in version 10.0 and later in Carbon.framework
  1484. * CarbonLib: in CarbonLib 1.0 and later
  1485. * Non-Carbon CFM: not available
  1486. }
  1487. function RegisterMenuDefinition( inResID: SInt16; inDefSpec: MenuDefSpecPtr ): OSStatus; external name '_RegisterMenuDefinition';
  1488. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1489. {
  1490. * CreateNewMenu()
  1491. *
  1492. * Summary:
  1493. * Creates a new, untitled, empty menu.
  1494. *
  1495. * Discussion:
  1496. * CreateNewMenu is preferred over NewMenu because it allows you to
  1497. * specify the menu's attributes and it does not require you to
  1498. * specify a Str255-based menu title. To set the menu title, you can
  1499. * use either SetMenuTitle or SetMenuTitleWithCFString.
  1500. *
  1501. * Mac OS X threading:
  1502. * Not thread safe
  1503. *
  1504. * Parameters:
  1505. *
  1506. * inMenuID:
  1507. * The menu ID to use for the new menu. Zero is a valid menu ID in
  1508. * Carbon.
  1509. *
  1510. * inMenuAttributes:
  1511. * The menu attributes to use for the new menu.
  1512. *
  1513. * outMenuRef:
  1514. * On exit, contains the new menu.
  1515. *
  1516. * Availability:
  1517. * Mac OS X: in version 10.0 and later in Carbon.framework
  1518. * CarbonLib: in CarbonLib 1.0 and later
  1519. * Non-Carbon CFM: not available
  1520. }
  1521. function CreateNewMenu( inMenuID: MenuID; inMenuAttributes: MenuAttributes; var outMenuRef: MenuRef ): OSStatus; external name '_CreateNewMenu';
  1522. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1523. {
  1524. * CreateCustomMenu()
  1525. *
  1526. * Summary:
  1527. * Creates a new, untitled, empty menu using a custom menu
  1528. * definition function.
  1529. *
  1530. * Discussion:
  1531. * Similar to CreateNewMenu, but also allows you to specify a custom
  1532. * menu definition function.
  1533. *
  1534. * Mac OS X threading:
  1535. * Not thread safe
  1536. *
  1537. * Parameters:
  1538. *
  1539. * inDefSpec:
  1540. * Specifies a custom menu definition function. defSpec->defType
  1541. * must be kMenuDefProcPtr or, on Mac OS X 10.3 and later,
  1542. * kMenuDefClassID.
  1543. *
  1544. * inMenuID:
  1545. * The menu ID to use for the new menu.
  1546. *
  1547. * inMenuAttributes:
  1548. * The menu attributes to use for the new menu.
  1549. *
  1550. * outMenuRef:
  1551. * On exit, contains the new menu.
  1552. *
  1553. * Availability:
  1554. * Mac OS X: in version 10.0 and later in Carbon.framework
  1555. * CarbonLib: in CarbonLib 1.0 and later
  1556. * Non-Carbon CFM: not available
  1557. }
  1558. function CreateCustomMenu( const (*var*) inDefSpec: MenuDefSpec; inMenuID: MenuID; inMenuAttributes: MenuAttributes; var outMenuRef: MenuRef ): OSStatus; external name '_CreateCustomMenu';
  1559. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1560. {
  1561. * IsValidMenu()
  1562. *
  1563. * Summary:
  1564. * Determines if a menu is valid.
  1565. *
  1566. * Mac OS X threading:
  1567. * Not thread safe
  1568. *
  1569. * Parameters:
  1570. *
  1571. * inMenu:
  1572. * The menu to check for validity.
  1573. *
  1574. * Result:
  1575. * Indicates whether the menu is valid.
  1576. *
  1577. * Availability:
  1578. * Mac OS X: in version 10.0 and later in Carbon.framework
  1579. * CarbonLib: in CarbonLib 1.1 and later
  1580. * Non-Carbon CFM: not available
  1581. }
  1582. function IsValidMenu( inMenu: MenuRef ): Boolean; external name '_IsValidMenu';
  1583. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1584. {
  1585. * GetMenuRetainCount()
  1586. *
  1587. * Summary:
  1588. * Returns the retain count of this menu.
  1589. *
  1590. * Discussion:
  1591. * In Mac OS X 10.2 and later, you can use CFGetRetainCount instead
  1592. * of GetMenuRetainCount.
  1593. *
  1594. * Mac OS X threading:
  1595. * Not thread safe
  1596. *
  1597. * Parameters:
  1598. *
  1599. * inMenu:
  1600. * The menu whose retain count to return.
  1601. *
  1602. * Availability:
  1603. * Mac OS X: in version 10.0 and later in Carbon.framework
  1604. * CarbonLib: in CarbonLib 1.1 and later
  1605. * Non-Carbon CFM: not available
  1606. }
  1607. function GetMenuRetainCount( inMenu: MenuRef ): ItemCount; external name '_GetMenuRetainCount';
  1608. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1609. {
  1610. * RetainMenu()
  1611. *
  1612. * Summary:
  1613. * Increments the retain count of a menu.
  1614. *
  1615. * Discussion:
  1616. * In Mac OS X 10.2 and later, you can use CFRetain instead of
  1617. * RetainMenu.
  1618. *
  1619. * RetainMenu does not create a new menu. It simply adds one to the
  1620. * retain count. If called on a menu that was not created by
  1621. * CarbonLib, it will not affect the menu's retain count.
  1622. *
  1623. * Mac OS X threading:
  1624. * Not thread safe
  1625. *
  1626. * Parameters:
  1627. *
  1628. * inMenu:
  1629. * The menu whose retain count to increment.
  1630. *
  1631. * Availability:
  1632. * Mac OS X: in version 10.0 and later in Carbon.framework
  1633. * CarbonLib: in CarbonLib 1.1 and later
  1634. * Non-Carbon CFM: not available
  1635. }
  1636. function RetainMenu( inMenu: MenuRef ): OSStatus; external name '_RetainMenu';
  1637. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1638. {
  1639. * ReleaseMenu()
  1640. *
  1641. * Summary:
  1642. * Decrements the retain count of a menu.
  1643. *
  1644. * Discussion:
  1645. * In Mac OS X 10.2 and later, you can use CFRelease instead of
  1646. * ReleaseMenu.
  1647. *
  1648. * If called on a menu that was not created by CarbonLib, it will
  1649. * not affect the menu's retain count.
  1650. *
  1651. * Mac OS X threading:
  1652. * Not thread safe
  1653. *
  1654. * Parameters:
  1655. *
  1656. * inMenu:
  1657. * The menu whose retain count to decrement. If the retain count
  1658. * falls to zero, the menu is destroyed.
  1659. *
  1660. * Availability:
  1661. * Mac OS X: in version 10.0 and later in Carbon.framework
  1662. * CarbonLib: in CarbonLib 1.1 and later
  1663. * Non-Carbon CFM: not available
  1664. }
  1665. function ReleaseMenu( inMenu: MenuRef ): OSStatus; external name '_ReleaseMenu';
  1666. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1667. {
  1668. * DuplicateMenu()
  1669. *
  1670. * Summary:
  1671. * Creates a new menu that is a copy of another menu.
  1672. *
  1673. * Discussion:
  1674. * Unlike RetainMenu, DuplicateMenu creates an entirely new menu
  1675. * that is an exact copy of the original menu. The MDEF for the new
  1676. * menu will receive an init message after the menu has been fully
  1677. * created.
  1678. *
  1679. * Mac OS X threading:
  1680. * Not thread safe
  1681. *
  1682. * Parameters:
  1683. *
  1684. * inSourceMenu:
  1685. * The menu to duplicate.
  1686. *
  1687. * outMenu:
  1688. * On exit, a copy of the source menu.
  1689. *
  1690. * Availability:
  1691. * Mac OS X: in version 10.0 and later in Carbon.framework
  1692. * CarbonLib: in CarbonLib 1.1 and later
  1693. * Non-Carbon CFM: not available
  1694. }
  1695. function DuplicateMenu( inSourceMenu: MenuRef; var outMenu: MenuRef ): OSStatus; external name '_DuplicateMenu';
  1696. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1697. {
  1698. * CopyMenuTitleAsCFString()
  1699. *
  1700. * Summary:
  1701. * Returns a CFString containing the title of a menu.
  1702. *
  1703. * Mac OS X threading:
  1704. * Not thread safe
  1705. *
  1706. * Parameters:
  1707. *
  1708. * inMenu:
  1709. * The menu whose title to return.
  1710. *
  1711. * outString:
  1712. * On exit, a CFString containing the menu's title. This string
  1713. * must be released by the caller.
  1714. *
  1715. * Availability:
  1716. * Mac OS X: in version 10.0 and later in Carbon.framework
  1717. * CarbonLib: in CarbonLib 1.1 and later
  1718. * Non-Carbon CFM: not available
  1719. }
  1720. function CopyMenuTitleAsCFString( inMenu: MenuRef; var outString: CFStringRef ): OSStatus; external name '_CopyMenuTitleAsCFString';
  1721. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1722. {
  1723. * SetMenuTitleWithCFString()
  1724. *
  1725. * Summary:
  1726. * Sets the title of a menu to the text contained in a CFString.
  1727. *
  1728. * Discussion:
  1729. * The Menu Manager will either make its own copy or just increment
  1730. * the refcount of the CFString before returning from
  1731. * SetMenuTitleWithCFString, depending on whether the string is
  1732. * mutable or immutable. If the string is mutable, modifying the
  1733. * string after calling SetMenuTitleWithCFString will have no effect
  1734. * on the menu's actual title. The caller may release the string
  1735. * after calling SetMenuTitleWithCFString.
  1736. *
  1737. * Mac OS X threading:
  1738. * Not thread safe
  1739. *
  1740. * Parameters:
  1741. *
  1742. * inMenu:
  1743. * The menu whose title to set.
  1744. *
  1745. * inString:
  1746. * The string containing the new menu title text.
  1747. *
  1748. * Availability:
  1749. * Mac OS X: in version 10.0 and later in Carbon.framework
  1750. * CarbonLib: in CarbonLib 1.1 and later
  1751. * Non-Carbon CFM: not available
  1752. }
  1753. function SetMenuTitleWithCFString( inMenu: MenuRef; inString: CFStringRef ): OSStatus; external name '_SetMenuTitleWithCFString';
  1754. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1755. {
  1756. * SetMenuTitleIcon()
  1757. *
  1758. * Summary:
  1759. * Sets the title of a menu to be an icon.
  1760. *
  1761. * Discussion:
  1762. * The Menu Manager takes ownership of the supplied icon after this
  1763. * call. When a menu with an title icon is disposed, the Menu
  1764. * Manager will dispose the icon also; the Menu Manager will also
  1765. * dispose of the current title icon when a new text or icon title
  1766. * is supplied for a menu. If an IconRef or CGImageRef is specified,
  1767. * the Menu Manager will increment its refcount, so you may freely
  1768. * release your reference to the icon or image without invalidating
  1769. * the Menu Manager's copy. The menubar will be invalidated by this
  1770. * call, and redrawn at the next opportunity.
  1771. *
  1772. * Mac OS X threading:
  1773. * Not thread safe
  1774. *
  1775. * Parameters:
  1776. *
  1777. * inMenu:
  1778. * The menu whose title to set.
  1779. *
  1780. * inType:
  1781. * The type of icon being used to specify the icon title; use
  1782. * kMenuNoIcon to remove the icon from the menu title. In Mac OS X
  1783. * 10.2 and earlier, the supported types are kMenuIconSuiteType
  1784. * and kMenuIconRefType; Mac OS X 10.3 also supports
  1785. * kMenuCGImageRefType.
  1786. *
  1787. * inIcon:
  1788. * The icon; must be NULL if inType is kMenuNoIcon. The supported
  1789. * icon formats are IconSuiteRef, IconRef, and in Mac OS X 10.3
  1790. * and later, CGImageRef.
  1791. *
  1792. * Availability:
  1793. * Mac OS X: in version 10.0 and later in Carbon.framework
  1794. * CarbonLib: in CarbonLib 1.1 and later
  1795. * Non-Carbon CFM: not available
  1796. }
  1797. function SetMenuTitleIcon( inMenu: MenuRef; inType: UInt32; inIcon: UnivPtr ): OSStatus; external name '_SetMenuTitleIcon';
  1798. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1799. {
  1800. * GetMenuTitleIcon()
  1801. *
  1802. * Summary:
  1803. * Retrieves the icon, if any, being used as the title of a menu.
  1804. *
  1805. * Discussion:
  1806. * This API does not increment a refcount on the returned icon. The
  1807. * caller should not release the icon.
  1808. *
  1809. * Mac OS X threading:
  1810. * Not thread safe
  1811. *
  1812. * Parameters:
  1813. *
  1814. * inMenu:
  1815. * The menu whose icon title to retrieve.
  1816. *
  1817. * outType:
  1818. * On exit, contains the type of icon being used as the title of
  1819. * the menu. Contains kMenuNoIcon if the menu does not have an
  1820. * icon title.
  1821. *
  1822. * outIcon:
  1823. * On exit, contains the IconSuiteRef, IconRef, or CGImageRef
  1824. * being used as the title of the menu, or NULL if the menu does
  1825. * not have an icon title. May be NULL.
  1826. *
  1827. * Availability:
  1828. * Mac OS X: in version 10.0 and later in Carbon.framework
  1829. * CarbonLib: in CarbonLib 1.1 and later
  1830. * Non-Carbon CFM: not available
  1831. }
  1832. function GetMenuTitleIcon( inMenu: MenuRef; outType: UInt32Ptr { can be NULL }; outIcon: UnivPtrPtr { can be NULL } ): OSStatus; external name '_GetMenuTitleIcon';
  1833. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1834. {
  1835. * InvalidateMenuSize()
  1836. *
  1837. * Summary:
  1838. * Invalidates the menu size so that it will be recalculated when
  1839. * next displayed.
  1840. *
  1841. * Discussion:
  1842. * The pre-Carbon technique for invalidating the menu size was to
  1843. * set the width and height to -1. Although this technique still
  1844. * works, for best compatibility it's preferable to use the
  1845. * InvalidateMenuSize API so that the Menu Manager has explicit
  1846. * notification that the menu is invalid.
  1847. *
  1848. * Mac OS X threading:
  1849. * Not thread safe
  1850. *
  1851. * Parameters:
  1852. *
  1853. * inMenu:
  1854. * The menu whose size to invalidate.
  1855. *
  1856. * Availability:
  1857. * Mac OS X: in version 10.0 and later in Carbon.framework
  1858. * CarbonLib: in CarbonLib 1.1 and later
  1859. * Non-Carbon CFM: not available
  1860. }
  1861. function InvalidateMenuSize( inMenu: MenuRef ): OSStatus; external name '_InvalidateMenuSize';
  1862. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1863. {
  1864. * IsMenuSizeInvalid()
  1865. *
  1866. * Summary:
  1867. * Determines if a menu's size is invalid and should be recalculated.
  1868. *
  1869. * Discussion:
  1870. * The pre-Carbon technique for determining if a menu's size is
  1871. * invalid was to check if the width or height was -1. This
  1872. * technique is not always reliable on Carbon due to implementation
  1873. * changes in the Menu Manager. You should now use IsMenuSizeInvalid
  1874. * instead.
  1875. *
  1876. * Mac OS X threading:
  1877. * Not thread safe
  1878. *
  1879. * Parameters:
  1880. *
  1881. * inMenu:
  1882. * The menu whose size to examine.
  1883. *
  1884. * Availability:
  1885. * Mac OS X: in version 10.0 and later in Carbon.framework
  1886. * CarbonLib: in CarbonLib 1.1 and later
  1887. * Non-Carbon CFM: not available
  1888. }
  1889. function IsMenuSizeInvalid( inMenu: MenuRef ): Boolean; external name '_IsMenuSizeInvalid';
  1890. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1891. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  1892. { ¥ÊMDEF support }
  1893. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  1894. {
  1895. * EraseMenuBackground()
  1896. *
  1897. * Summary:
  1898. * Erases a portion of a menu background in preparation for further
  1899. * drawing.
  1900. *
  1901. * Discussion:
  1902. * It is necessary to erase the menu background before calling
  1903. * DrawThemeMenuBackground because some themes (such as Aqua on Mac
  1904. * OS X) draw the menu background using the alpha channel, and if
  1905. * the area underneath the menu background is not erased, portions
  1906. * of the old image will show through the menu background.
  1907. *
  1908. * Mac OS X threading:
  1909. * Not thread safe
  1910. *
  1911. * Parameters:
  1912. *
  1913. * inMenu:
  1914. * The menu whose background to erase.
  1915. *
  1916. * inEraseRect:
  1917. * The bounds of the area to erase, in local coordinates to the
  1918. * current port.
  1919. *
  1920. * inContext:
  1921. * The CG context to erase. If NULL, EraseMenuBackground will
  1922. * create a context based on the current port.
  1923. *
  1924. * Availability:
  1925. * Mac OS X: in version 10.1 and later in Carbon.framework
  1926. * CarbonLib: in CarbonLib 1.5 and later
  1927. * Non-Carbon CFM: not available
  1928. }
  1929. function EraseMenuBackground( inMenu: MenuRef; const (*var*) inEraseRect: Rect; inContext: CGContextRef { can be NULL } ): OSStatus; external name '_EraseMenuBackground';
  1930. (* AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER *)
  1931. {
  1932. * ScrollMenuImage()
  1933. *
  1934. * Summary:
  1935. * Scrolls a portion of the menu image.
  1936. *
  1937. * Discussion:
  1938. * Menus on Mac OS X use an alpha channel, and QuickDraw does not
  1939. * support alpha channels. Therefore, scrolling a menu image with
  1940. * ScrollRect or other QuickDraw APIs does not work correctly; it
  1941. * results in the destruction of the alpha channel data. The
  1942. * ScrollMenuImage API uses CoreGraphics to move the menu image,
  1943. * preserving the alpha channel.
  1944. *
  1945. * Mac OS X threading:
  1946. * Not thread safe
  1947. *
  1948. * Parameters:
  1949. *
  1950. * inMenu:
  1951. * The menu whose image to scroll.
  1952. *
  1953. * inScrollRect:
  1954. * The bounds of the rect to scroll.
  1955. *
  1956. * inHScroll:
  1957. * The distance to scroll horizontally.
  1958. *
  1959. * inVScroll:
  1960. * The distance to scroll vertically.
  1961. *
  1962. * inContext:
  1963. * The CG context to erase. If NULL, ScrollMenuImage will create a
  1964. * context based on the current port.
  1965. *
  1966. * Availability:
  1967. * Mac OS X: in version 10.1 and later in Carbon.framework
  1968. * CarbonLib: in CarbonLib 1.5 and later
  1969. * Non-Carbon CFM: not available
  1970. }
  1971. function ScrollMenuImage( inMenu: MenuRef; const (*var*) inScrollRect: Rect; inHScroll: SInt32; inVScroll: SInt32; inContext: CGContextRef { can be NULL } ): OSStatus; external name '_ScrollMenuImage';
  1972. (* AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER *)
  1973. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  1974. { ¥ Menu Item Insertion }
  1975. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  1976. {
  1977. * [Mac]AppendMenu()
  1978. *
  1979. * Mac OS X threading:
  1980. * Not thread safe
  1981. *
  1982. * Availability:
  1983. * Mac OS X: in version 10.0 and later in Carbon.framework
  1984. * CarbonLib: in CarbonLib 1.0 and later
  1985. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1986. }
  1987. procedure AppendMenu( menu: MenuRef; const (*var*) data: Str255 ); external name '_AppendMenu';
  1988. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1989. procedure MacAppendMenu( menu: MenuRef; const (*var*) data: Str255 ); external name '_AppendMenu';
  1990. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1991. {
  1992. * InsertResMenu()
  1993. *
  1994. * Mac OS X threading:
  1995. * Not thread safe
  1996. *
  1997. * Availability:
  1998. * Mac OS X: in version 10.0 and later in Carbon.framework
  1999. * CarbonLib: in CarbonLib 1.0 and later
  2000. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2001. }
  2002. procedure InsertResMenu( theMenu: MenuRef; theType: ResType; afterItem: MenuItemIndex ); external name '_InsertResMenu';
  2003. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2004. {
  2005. * AppendResMenu()
  2006. *
  2007. * Mac OS X threading:
  2008. * Not thread safe
  2009. *
  2010. * Availability:
  2011. * Mac OS X: in version 10.0 and later in Carbon.framework
  2012. * CarbonLib: in CarbonLib 1.0 and later
  2013. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2014. }
  2015. procedure AppendResMenu( theMenu: MenuRef; theType: ResType ); external name '_AppendResMenu';
  2016. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2017. {
  2018. * [Mac]InsertMenuItem()
  2019. *
  2020. * Summary:
  2021. * Inserts a new menu item into a menu, using a Str255 for the item
  2022. * text.
  2023. *
  2024. * Mac OS X threading:
  2025. * Not thread safe
  2026. *
  2027. * Parameters:
  2028. *
  2029. * theMenu:
  2030. * The menu into which to insert the item.
  2031. *
  2032. * itemString:
  2033. * The text of the new item. This string is parsed for the
  2034. * meta-characters documented in the Menu Manager chapter of
  2035. * Inside Macintosh.
  2036. *
  2037. * afterItem:
  2038. * The menu item after which to insert the item. Pass 0 to insert
  2039. * the item at the beginning of the menu. If afterItem is greater
  2040. * than the number of items in the menu, the item is inserted at
  2041. * the end of the menu.
  2042. *
  2043. * Availability:
  2044. * Mac OS X: in version 10.0 and later in Carbon.framework
  2045. * CarbonLib: in CarbonLib 1.0 and later
  2046. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2047. }
  2048. procedure InsertMenuItem( theMenu: MenuRef; const (*var*) itemString: Str255; afterItem: MenuItemIndex ); external name '_InsertMenuItem';
  2049. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2050. procedure MacInsertMenuItem( theMenu: MenuRef; const (*var*) itemString: Str255; afterItem: MenuItemIndex ); external name '_InsertMenuItem';
  2051. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2052. {
  2053. * DeleteMenuItem()
  2054. *
  2055. * Mac OS X threading:
  2056. * Not thread safe
  2057. *
  2058. * Availability:
  2059. * Mac OS X: in version 10.0 and later in Carbon.framework
  2060. * CarbonLib: in CarbonLib 1.0 and later
  2061. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2062. }
  2063. procedure DeleteMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_DeleteMenuItem';
  2064. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2065. {
  2066. * InsertFontResMenu()
  2067. *
  2068. * Mac OS X threading:
  2069. * Not thread safe
  2070. *
  2071. * Availability:
  2072. * Mac OS X: in version 10.0 and later in Carbon.framework
  2073. * CarbonLib: in CarbonLib 1.0 and later
  2074. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2075. }
  2076. procedure InsertFontResMenu( theMenu: MenuRef; afterItem: MenuItemIndex; scriptFilter: SInt16 ); external name '_InsertFontResMenu';
  2077. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2078. {
  2079. * InsertIntlResMenu()
  2080. *
  2081. * Mac OS X threading:
  2082. * Not thread safe
  2083. *
  2084. * Availability:
  2085. * Mac OS X: in version 10.0 and later in Carbon.framework
  2086. * CarbonLib: in CarbonLib 1.0 and later
  2087. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2088. }
  2089. procedure InsertIntlResMenu( theMenu: MenuRef; theType: ResType; afterItem: MenuItemIndex; scriptFilter: SInt16 ); external name '_InsertIntlResMenu';
  2090. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2091. {
  2092. * AppendMenuItemText()
  2093. *
  2094. * Mac OS X threading:
  2095. * Not thread safe
  2096. *
  2097. * Availability:
  2098. * Mac OS X: in version 10.0 and later in Carbon.framework
  2099. * CarbonLib: in CarbonLib 1.0 and later
  2100. * Non-Carbon CFM: in MenusLib 8.5 and later
  2101. }
  2102. function AppendMenuItemText( menu: MenuRef; const (*var*) inString: Str255 ): OSStatus; external name '_AppendMenuItemText';
  2103. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2104. {
  2105. * InsertMenuItemText()
  2106. *
  2107. * Summary:
  2108. * Inserts a new menu item into a menu, using a Str255 for the item
  2109. * text.
  2110. *
  2111. * Mac OS X threading:
  2112. * Not thread safe
  2113. *
  2114. * Parameters:
  2115. *
  2116. * menu:
  2117. * The menu into which to insert the item.
  2118. *
  2119. * inString:
  2120. * The text of the new item. This string is not parsed for the
  2121. * meta-characters documented in the Menu Manager chapter of
  2122. * Inside Macintosh; the new item's text becomes exactly the
  2123. * specified text.
  2124. *
  2125. * afterItem:
  2126. * The menu item after which to insert the item. Pass 0 to insert
  2127. * the item at the beginning of the menu. If afterItem is greater
  2128. * than the number of items in the menu, the item is inserted at
  2129. * the end of the menu.
  2130. *
  2131. * Availability:
  2132. * Mac OS X: in version 10.0 and later in Carbon.framework
  2133. * CarbonLib: in CarbonLib 1.0 and later
  2134. * Non-Carbon CFM: in MenusLib 8.5 and later
  2135. }
  2136. function InsertMenuItemText( menu: MenuRef; const (*var*) inString: Str255; afterItem: MenuItemIndex ): OSStatus; external name '_InsertMenuItemText';
  2137. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2138. {
  2139. * CopyMenuItems()
  2140. *
  2141. * Summary:
  2142. * Copies menu items from one menu to another.
  2143. *
  2144. * Mac OS X threading:
  2145. * Not thread safe
  2146. *
  2147. * Parameters:
  2148. *
  2149. * inSourceMenu:
  2150. * The menu from which to copy items.
  2151. *
  2152. * inFirstItem:
  2153. * The first item to copy.
  2154. *
  2155. * inNumItems:
  2156. * The number of items to copy.
  2157. *
  2158. * inDestMenu:
  2159. * The menu to which to copy items.
  2160. *
  2161. * inInsertAfter:
  2162. * The menu item in the destination menu after which to insert the
  2163. * copied items. Pass 0 to insert the items at the beginning of
  2164. * the menu. This value of this parameter must not exceed the
  2165. * number of items in the destination menu.
  2166. *
  2167. * Availability:
  2168. * Mac OS X: in version 10.0 and later in Carbon.framework
  2169. * CarbonLib: in CarbonLib 1.1 and later
  2170. * Non-Carbon CFM: not available
  2171. }
  2172. function CopyMenuItems( inSourceMenu: MenuRef; inFirstItem: MenuItemIndex; inNumItems: ItemCount; inDestMenu: MenuRef; inInsertAfter: MenuItemIndex ): OSStatus; external name '_CopyMenuItems';
  2173. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2174. {
  2175. * DeleteMenuItems()
  2176. *
  2177. * Summary:
  2178. * Deletes multiple menu items.
  2179. *
  2180. * Discussion:
  2181. * This API is more efficient than calling DeleteMenuItem multiple
  2182. * times.
  2183. *
  2184. * Mac OS X threading:
  2185. * Not thread safe
  2186. *
  2187. * Parameters:
  2188. *
  2189. * inMenu:
  2190. * The menu from which to delete items.
  2191. *
  2192. * inFirstItem:
  2193. * The first item to delete.
  2194. *
  2195. * inNumItems:
  2196. * The number of items to delete.
  2197. *
  2198. * Availability:
  2199. * Mac OS X: in version 10.0 and later in Carbon.framework
  2200. * CarbonLib: in CarbonLib 1.1 and later
  2201. * Non-Carbon CFM: not available
  2202. }
  2203. function DeleteMenuItems( inMenu: MenuRef; inFirstItem: MenuItemIndex; inNumItems: ItemCount ): OSStatus; external name '_DeleteMenuItems';
  2204. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2205. {
  2206. * AppendMenuItemTextWithCFString()
  2207. *
  2208. * Summary:
  2209. * Appends a new menu item with text from a CFString.
  2210. *
  2211. * Discussion:
  2212. * The Menu Manager will either make its own copy or just increment
  2213. * the refcount of the CFString before returning from
  2214. * AppendMenuItemWithTextCFString, depending on whether the string
  2215. * is mutable or immutable. If the string is mutable, modifying the
  2216. * string after calling AppendMenuItemTextWithCFString will have no
  2217. * effect on the menu item's actual text. The caller may release the
  2218. * string after calling AppendMenuItemTextWithCFString.
  2219. *
  2220. * Mac OS X threading:
  2221. * Not thread safe
  2222. *
  2223. * Parameters:
  2224. *
  2225. * inMenu:
  2226. * The menu to which to append the new item.
  2227. *
  2228. * inString:
  2229. * The text of the new item.
  2230. *
  2231. * inAttributes:
  2232. * The attributes of the new item.
  2233. *
  2234. * inCommandID:
  2235. * The command ID of the new item.
  2236. *
  2237. * outNewItem:
  2238. * On exit, the index of the new item. May be NULL if the caller
  2239. * does not need this information.
  2240. *
  2241. * Availability:
  2242. * Mac OS X: in version 10.0 and later in Carbon.framework
  2243. * CarbonLib: in CarbonLib 1.1 and later
  2244. * Non-Carbon CFM: not available
  2245. }
  2246. function AppendMenuItemTextWithCFString( inMenu: MenuRef; inString: CFStringRef; inAttributes: MenuItemAttributes; inCommandID: MenuCommand; outNewItem: MenuItemIndexPtr { can be NULL } ): OSStatus; external name '_AppendMenuItemTextWithCFString';
  2247. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2248. {
  2249. * InsertMenuItemTextWithCFString()
  2250. *
  2251. * Summary:
  2252. * Inserts a new menu item with text from a CFString.
  2253. *
  2254. * Discussion:
  2255. * The Menu Manager will either make its own copy or just increment
  2256. * the refcount of the CFString before returning from
  2257. * InsertMenuItemWithCFString, depending on whether the string is
  2258. * mutable or immutable. If the string is mutable, modifying the
  2259. * string after calling InsertMenuItemWithCFString will have no
  2260. * effect on the menu item's actual text. The caller may release the
  2261. * string after calling InsertMenuItemWithCFString.
  2262. *
  2263. * Mac OS X threading:
  2264. * Not thread safe
  2265. *
  2266. * Parameters:
  2267. *
  2268. * inMenu:
  2269. * The menu in which to insert the new item.
  2270. *
  2271. * inString:
  2272. * The text of the new item.
  2273. *
  2274. * inAfterItem:
  2275. * The item after which to insert the new item. Pass 0 to insert
  2276. * the item at the beginning of the menu. If inAfterItem is
  2277. * greater than the number of items in the menu, the item is
  2278. * inserted at the end of the menu.
  2279. *
  2280. * inAttributes:
  2281. * The attributes of the new item.
  2282. *
  2283. * inCommandID:
  2284. * The command ID of the new item.
  2285. *
  2286. * Availability:
  2287. * Mac OS X: in version 10.0 and later in Carbon.framework
  2288. * CarbonLib: in CarbonLib 1.1 and later
  2289. * Non-Carbon CFM: not available
  2290. }
  2291. function InsertMenuItemTextWithCFString( inMenu: MenuRef; inString: CFStringRef; inAfterItem: MenuItemIndex; inAttributes: MenuItemAttributes; inCommandID: MenuCommand ): OSStatus; external name '_InsertMenuItemTextWithCFString';
  2292. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2293. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  2294. { ¥ Menu Events }
  2295. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  2296. {
  2297. * MenuKey()
  2298. *
  2299. * Mac OS X threading:
  2300. * Not thread safe
  2301. *
  2302. * Availability:
  2303. * Mac OS X: in version 10.0 and later in Carbon.framework
  2304. * CarbonLib: in CarbonLib 1.0 and later
  2305. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2306. }
  2307. function MenuKey( ch: CharParameter ): SInt32; external name '_MenuKey';
  2308. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2309. {
  2310. * MenuSelect()
  2311. *
  2312. * Mac OS X threading:
  2313. * Not thread safe
  2314. *
  2315. * Availability:
  2316. * Mac OS X: in version 10.0 and later in Carbon.framework
  2317. * CarbonLib: in CarbonLib 1.0 and later
  2318. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2319. }
  2320. function MenuSelect( startPt: Point ): SInt32; external name '_MenuSelect';
  2321. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2322. {
  2323. * PopUpMenuSelect()
  2324. *
  2325. * Summary:
  2326. * Displays a pop-up menu at a specified location.
  2327. *
  2328. * Discussion:
  2329. * In Mac OS 9 and earlier, PopUpMenuSelect requires that the menu
  2330. * be inserted into the menubar using InsertMenu( menuRef,
  2331. * kInsertHierarchicalMenu ). CarbonLib 1.1 and later, and Mac OS X,
  2332. * do not have this requirement; a menu can be displayed by
  2333. * PopUpMenuSelect even if it is not inserted in the menubar.
  2334. *
  2335. * Mac OS X threading:
  2336. * Not thread safe
  2337. *
  2338. * Parameters:
  2339. *
  2340. * menu:
  2341. * The menu to display.
  2342. *
  2343. * top:
  2344. * The vertical position, in global coordinates, of the top left
  2345. * corner of the selected item when the menu is opened.
  2346. *
  2347. * left:
  2348. * The horizontal position, in global coordinates, of the top left
  2349. * corner of the selected item when the menu is opened.
  2350. *
  2351. * popUpItem:
  2352. * The item that should be positioned at the global point
  2353. * specified by the top and left parameters. May be zero, in which
  2354. * case item one is positioned at the specified global point.
  2355. *
  2356. * Result:
  2357. * A 32-value whose high 16-bit word is the menu ID and whose low
  2358. * 16-bit word is the index of the menu item that was selected, or
  2359. * zero if no item was selected.
  2360. *
  2361. * Availability:
  2362. * Mac OS X: in version 10.0 and later in Carbon.framework
  2363. * CarbonLib: in CarbonLib 1.0 and later
  2364. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2365. }
  2366. function PopUpMenuSelect( menu: MenuRef; top: SInt16; left: SInt16; popUpItem: MenuItemIndex ): SInt32; external name '_PopUpMenuSelect';
  2367. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2368. {
  2369. * MenuChoice()
  2370. *
  2371. * Mac OS X threading:
  2372. * Not thread safe
  2373. *
  2374. * Availability:
  2375. * Mac OS X: in version 10.0 and later in Carbon.framework
  2376. * CarbonLib: in CarbonLib 1.0 and later
  2377. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2378. }
  2379. function MenuChoice: SInt32; external name '_MenuChoice';
  2380. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2381. {
  2382. * MenuEvent()
  2383. *
  2384. * Mac OS X threading:
  2385. * Not thread safe
  2386. *
  2387. * Availability:
  2388. * Mac OS X: in version 10.0 and later in Carbon.framework
  2389. * CarbonLib: in CarbonLib 1.0 and later
  2390. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  2391. }
  2392. function MenuEvent( const (*var*) inEvent: EventRecord ): UInt32; external name '_MenuEvent';
  2393. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2394. {
  2395. * IsMenuKeyEvent()
  2396. *
  2397. * Summary:
  2398. * Determines if an event corresponds to a menu command key.
  2399. *
  2400. * Discussion:
  2401. * By default, IsMenuKeyEvent searches the menus in the current menu
  2402. * bar and hilites the menu title of the menu containing the
  2403. * selected item.
  2404. *
  2405. * Mac OS X threading:
  2406. * Not thread safe
  2407. *
  2408. * Parameters:
  2409. *
  2410. * inStartMenu:
  2411. * IsMenuKeyEvent searches for matching menu items in this menu
  2412. * and all of its submenus. May be NULL to search the current menu
  2413. * bar contents.
  2414. *
  2415. * inEvent:
  2416. * The event to match against. Non-keyboard events are ignored.
  2417. *
  2418. * inOptions:
  2419. * Options controlling how to search. Pass kNilOptions for the
  2420. * default behavior.
  2421. *
  2422. * outMenu:
  2423. * On exit, the menu containing the matching item. May be NULL.
  2424. *
  2425. * outMenuItem:
  2426. * On exit, the menu item that matched. May be NULL.
  2427. *
  2428. * Availability:
  2429. * Mac OS X: in version 10.0 and later in Carbon.framework
  2430. * CarbonLib: in CarbonLib 1.1 and later
  2431. * Non-Carbon CFM: not available
  2432. }
  2433. function IsMenuKeyEvent( inStartMenu: MenuRef; inEvent: EventRef; inOptions: MenuEventOptions; outMenu: MenuRefPtr { can be NULL }; outMenuItem: MenuItemIndexPtr { can be NULL } ): Boolean; external name '_IsMenuKeyEvent';
  2434. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2435. {
  2436. * InvalidateMenuEnabling()
  2437. *
  2438. * Summary:
  2439. * Causes the menu enable state to be recalculated at the next
  2440. * convenient opportunity.
  2441. *
  2442. * Discussion:
  2443. * It is common for state changes in an application (for example,
  2444. * selection of text) to cause a change in the enabling of items in
  2445. * the application's menu (for example, the Copy menu item might
  2446. * become enabled). In a Carbon-event-savvy application, menu items
  2447. * are enabled or disabled in response to an
  2448. * kEventCommandUpdateStatus event; however, this event is normally
  2449. * only sent before a command key press or a click in the menubar.
  2450. * You can request an explicit recalculation of a menu's enable
  2451. * state with the InvalidateMenuEnabling API. The Carbon Event
  2452. * Manager will automatically invalidate the enable state of all
  2453. * top-level menus when a user event is dispatched, the user focus
  2454. * changes, or the active window changes, so in many cases you will
  2455. * not need to explicitly invalidate the menu enabling state.
  2456. *
  2457. * Mac OS X threading:
  2458. * Not thread safe
  2459. *
  2460. * Parameters:
  2461. *
  2462. * inMenu:
  2463. * A menu to re-enable, or NULL if all menus in the root menu
  2464. * should be re-enabled.
  2465. *
  2466. * Availability:
  2467. * Mac OS X: in version 10.0 and later in Carbon.framework
  2468. * CarbonLib: in CarbonLib 1.3 and later
  2469. * Non-Carbon CFM: not available
  2470. }
  2471. function InvalidateMenuEnabling( inMenu: MenuRef ): OSStatus; external name '_InvalidateMenuEnabling';
  2472. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2473. {
  2474. * Summary:
  2475. * Menu dismissal causation constants
  2476. }
  2477. const
  2478. {
  2479. * The menu was dismissed by the selection of a menu item.
  2480. }
  2481. kHIMenuDismissedBySelection = 1;
  2482. {
  2483. * The menu was dismissed because the user canceled menu tracking.
  2484. }
  2485. kHIMenuDismissedByUserCancel = 2;
  2486. {
  2487. * The menu was dismissed by a mouse-down somewhere that did not
  2488. * result in menu item selection.
  2489. }
  2490. kHIMenuDismissedByMouseDown = 3;
  2491. {
  2492. * The menu was dismissed by a mouse-up.
  2493. }
  2494. kHIMenuDismissedByMouseUp = 4;
  2495. {
  2496. * The menu was dismissed by a keyboard event.
  2497. }
  2498. kHIMenuDismissedByKeyEvent = 5;
  2499. {
  2500. * The menu was dismissed because the current application was no
  2501. * longer frontmost.
  2502. }
  2503. kHIMenuDismissedByAppSwitch = 6;
  2504. {
  2505. * The menu was dismissed because menu tracking mode timed out.
  2506. }
  2507. kHIMenuDismissedByTimeout = 7;
  2508. {
  2509. * The menu was dismissed by the CancelMenuTracking API.
  2510. }
  2511. kHIMenuDismissedByCancelMenuTracking = 8;
  2512. {
  2513. * The menu was dismissed because the active window changed.
  2514. }
  2515. kHIMenuDismissedByActivationChange = 9;
  2516. {
  2517. * The menu was dismissed bcause the user focus window changed, or
  2518. * because keyboard focus was removed from the current process.
  2519. }
  2520. kHIMenuDismissedByFocusChange = 10;
  2521. {
  2522. * CancelMenuTracking()
  2523. *
  2524. * Summary:
  2525. * Cancels a menu tracking session.
  2526. *
  2527. * Mac OS X threading:
  2528. * Not thread safe
  2529. *
  2530. * Parameters:
  2531. *
  2532. * inRootMenu:
  2533. * The root menu of the menu tracking session that should be
  2534. * dismissed. For menubar tracking, use the result of AcquireRoot
  2535. * menu; for popup menu tracking, use the menu that was passed to
  2536. * PopUpMenuSelect.
  2537. *
  2538. * inImmediate:
  2539. * Whether the open menus should disappear immediately or fade out.
  2540. *
  2541. * inDismissalReason:
  2542. * Why the menu is being dismissed; this value will be added to
  2543. * the kEventMenuEndTracking event. If zero,
  2544. * kHIMenuDismissedByCancelMenuTracking is added to the
  2545. * EndTracking event.
  2546. *
  2547. * Availability:
  2548. * Mac OS X: in version 10.3 and later in Carbon.framework
  2549. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  2550. * Non-Carbon CFM: not available
  2551. }
  2552. function CancelMenuTracking( inRootMenu: MenuRef; inImmediate: Boolean; inDismissalReason: UInt32 ): OSStatus; external name '_CancelMenuTracking';
  2553. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  2554. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  2555. { ¥ Menu Bar }
  2556. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  2557. {
  2558. * GetMBarHeight()
  2559. *
  2560. * Mac OS X threading:
  2561. * Not thread safe
  2562. *
  2563. * Availability:
  2564. * Mac OS X: in version 10.0 and later in Carbon.framework
  2565. * CarbonLib: in CarbonLib 1.0 and later
  2566. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2567. }
  2568. function GetMBarHeight: SInt16; external name '_GetMBarHeight';
  2569. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2570. {
  2571. * [Mac]DrawMenuBar()
  2572. *
  2573. * Mac OS X threading:
  2574. * Not thread safe
  2575. *
  2576. * Availability:
  2577. * Mac OS X: in version 10.0 and later in Carbon.framework
  2578. * CarbonLib: in CarbonLib 1.0 and later
  2579. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2580. }
  2581. procedure DrawMenuBar; external name '_DrawMenuBar';
  2582. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2583. procedure MacDrawMenuBar; external name '_DrawMenuBar';
  2584. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2585. {
  2586. * InvalMenuBar()
  2587. *
  2588. * Mac OS X threading:
  2589. * Not thread safe
  2590. *
  2591. * Availability:
  2592. * Mac OS X: in version 10.0 and later in Carbon.framework
  2593. * CarbonLib: in CarbonLib 1.0 and later
  2594. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2595. }
  2596. procedure InvalMenuBar; external name '_InvalMenuBar';
  2597. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2598. {
  2599. * IsMenuBarInvalid()
  2600. *
  2601. * Summary:
  2602. * Determines if the menubar is invalid and should be redrawn.
  2603. *
  2604. * Mac OS X threading:
  2605. * Not thread safe
  2606. *
  2607. * Parameters:
  2608. *
  2609. * rootMenu:
  2610. * The root menu for the menubar to be examined. Pass NULL to
  2611. * check the state of the current menubar.
  2612. *
  2613. * Availability:
  2614. * Mac OS X: in version 10.0 and later in Carbon.framework
  2615. * CarbonLib: in CarbonLib 1.1 and later
  2616. * Non-Carbon CFM: not available
  2617. }
  2618. function IsMenuBarInvalid( rootMenu: MenuRef ): Boolean; external name '_IsMenuBarInvalid';
  2619. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2620. {
  2621. * HiliteMenu()
  2622. *
  2623. * Mac OS X threading:
  2624. * Not thread safe
  2625. *
  2626. * Availability:
  2627. * Mac OS X: in version 10.0 and later in Carbon.framework
  2628. * CarbonLib: in CarbonLib 1.0 and later
  2629. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2630. }
  2631. procedure HiliteMenu( menuID_: MenuID ); external name '_HiliteMenu';
  2632. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2633. {
  2634. * GetNewMBar()
  2635. *
  2636. * Mac OS X threading:
  2637. * Not thread safe
  2638. *
  2639. * Availability:
  2640. * Mac OS X: in version 10.0 and later in Carbon.framework
  2641. * CarbonLib: in CarbonLib 1.0 and later
  2642. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2643. }
  2644. function GetNewMBar( menuBarID: SInt16 ): MenuBarHandle; external name '_GetNewMBar';
  2645. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2646. {
  2647. * GetMenuBar()
  2648. *
  2649. * Mac OS X threading:
  2650. * Not thread safe
  2651. *
  2652. * Availability:
  2653. * Mac OS X: in version 10.0 and later in Carbon.framework
  2654. * CarbonLib: in CarbonLib 1.0 and later
  2655. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2656. }
  2657. function GetMenuBar: MenuBarHandle; external name '_GetMenuBar';
  2658. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2659. {
  2660. * SetMenuBar()
  2661. *
  2662. * Mac OS X threading:
  2663. * Not thread safe
  2664. *
  2665. * Availability:
  2666. * Mac OS X: in version 10.0 and later in Carbon.framework
  2667. * CarbonLib: in CarbonLib 1.0 and later
  2668. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2669. }
  2670. procedure SetMenuBar( mbar: MenuBarHandle ); external name '_SetMenuBar';
  2671. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2672. {
  2673. * DuplicateMenuBar()
  2674. *
  2675. * Summary:
  2676. * Duplicates a menubar handle.
  2677. *
  2678. * Discussion:
  2679. * This API should be used in Carbon applications when duplicating a
  2680. * handle returned from GetMenuBar or GetNewMBar. You should not use
  2681. * Memory Manager APIs (HandToHand, NewHandle, etc) to duplicate
  2682. * such a handle. This is necessary in Carbon so that the refcounts
  2683. * of the menus in the menubar handle can be incremented when the
  2684. * handle is duplicated.
  2685. *
  2686. * Mac OS X threading:
  2687. * Not thread safe
  2688. *
  2689. * Parameters:
  2690. *
  2691. * inMbar:
  2692. * The menubar handle to duplicate.
  2693. *
  2694. * outMbar:
  2695. * On exit, contains the new menubar handle.
  2696. *
  2697. * Availability:
  2698. * Mac OS X: in version 10.0 and later in Carbon.framework
  2699. * CarbonLib: in CarbonLib 1.0.2 and later
  2700. * Non-Carbon CFM: not available
  2701. }
  2702. function DuplicateMenuBar( inMbar: MenuBarHandle; var outMbar: MenuBarHandle ): OSStatus; external name '_DuplicateMenuBar';
  2703. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2704. {
  2705. * DisposeMenuBar()
  2706. *
  2707. * Summary:
  2708. * Releases a menubar handle.
  2709. *
  2710. * Discussion:
  2711. * This API should be used in Carbon applications when releasing a
  2712. * handle returned from GetMenuBar or GetNewMBar. You should not use
  2713. * DisposeHandle to release such a handle. This is necessary in
  2714. * Carbon so that the refcounts of the menus in the menubar handle
  2715. * can be decremented when the handle is released.
  2716. *
  2717. * Mac OS X threading:
  2718. * Not thread safe
  2719. *
  2720. * Parameters:
  2721. *
  2722. * inMbar:
  2723. * The menubar handle to release.
  2724. *
  2725. * Availability:
  2726. * Mac OS X: in version 10.0 and later in Carbon.framework
  2727. * CarbonLib: in CarbonLib 1.0.2 and later
  2728. * Non-Carbon CFM: not available
  2729. }
  2730. function DisposeMenuBar( inMbar: MenuBarHandle ): OSStatus; external name '_DisposeMenuBar';
  2731. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2732. {
  2733. * GetMenuHandle()
  2734. *
  2735. * Mac OS X threading:
  2736. * Not thread safe
  2737. *
  2738. * Availability:
  2739. * Mac OS X: in version 10.0 and later in Carbon.framework
  2740. * CarbonLib: in CarbonLib 1.0 and later
  2741. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2742. }
  2743. function GetMenuHandle( menuID_: MenuID ): MenuRef; external name '_GetMenuHandle';
  2744. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2745. function GetMenuRef( menuID_: MenuID ): MenuRef; external name '_GetMenuHandle';
  2746. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2747. {
  2748. * [Mac]InsertMenu()
  2749. *
  2750. * Mac OS X threading:
  2751. * Not thread safe
  2752. *
  2753. * Availability:
  2754. * Mac OS X: in version 10.0 and later in Carbon.framework
  2755. * CarbonLib: in CarbonLib 1.0 and later
  2756. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2757. }
  2758. procedure InsertMenu( theMenu: MenuRef; beforeID: MenuID ); external name '_InsertMenu';
  2759. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2760. procedure MacInsertMenu( theMenu: MenuRef; beforeID: MenuID ); external name '_InsertMenu';
  2761. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2762. {
  2763. * [Mac]DeleteMenu()
  2764. *
  2765. * Mac OS X threading:
  2766. * Not thread safe
  2767. *
  2768. * Availability:
  2769. * Mac OS X: in version 10.0 and later in Carbon.framework
  2770. * CarbonLib: in CarbonLib 1.0 and later
  2771. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2772. }
  2773. procedure DeleteMenu( menuID_: MenuID ); external name '_DeleteMenu';
  2774. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2775. procedure MacDeleteMenu( menuID_: MenuID ); external name '_DeleteMenu';
  2776. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2777. {
  2778. * ClearMenuBar()
  2779. *
  2780. * Mac OS X threading:
  2781. * Not thread safe
  2782. *
  2783. * Availability:
  2784. * Mac OS X: in version 10.0 and later in Carbon.framework
  2785. * CarbonLib: in CarbonLib 1.0 and later
  2786. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2787. }
  2788. procedure ClearMenuBar; external name '_ClearMenuBar';
  2789. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2790. {
  2791. * SetMenuFlash()
  2792. *
  2793. * Summary:
  2794. * Renamed to SetMenuFlashCount in Carbon
  2795. *
  2796. * Availability:
  2797. * Mac OS X: not available
  2798. * CarbonLib: not available
  2799. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2800. }
  2801. {
  2802. * SetMenuFlashCount()
  2803. *
  2804. * Mac OS X threading:
  2805. * Not thread safe
  2806. *
  2807. * Availability:
  2808. * Mac OS X: in version 10.0 and later in Carbon.framework
  2809. * CarbonLib: in CarbonLib 1.0 and later
  2810. * Non-Carbon CFM: in CarbonAccessors.o 1.3 and later or as macro/inline
  2811. }
  2812. procedure SetMenuFlashCount( count: SInt16 ); external name '_SetMenuFlashCount';
  2813. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2814. {
  2815. * FlashMenuBar()
  2816. *
  2817. * Mac OS X threading:
  2818. * Not thread safe
  2819. *
  2820. * Availability:
  2821. * Mac OS X: in version 10.0 and later in Carbon.framework
  2822. * CarbonLib: in CarbonLib 1.0 and later
  2823. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2824. }
  2825. procedure FlashMenuBar( menuID_: MenuID ); external name '_FlashMenuBar';
  2826. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2827. { These are obsolete because Carbon does not support desk accessories.}
  2828. {
  2829. * SystemEdit()
  2830. *
  2831. * Availability:
  2832. * Mac OS X: not available
  2833. * CarbonLib: not available
  2834. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2835. }
  2836. {
  2837. * SystemMenu()
  2838. *
  2839. * Availability:
  2840. * Mac OS X: not available
  2841. * CarbonLib: not available
  2842. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2843. }
  2844. {
  2845. * IsMenuBarVisible()
  2846. *
  2847. * Mac OS X threading:
  2848. * Not thread safe
  2849. *
  2850. * Availability:
  2851. * Mac OS X: in version 10.0 and later in Carbon.framework
  2852. * CarbonLib: in CarbonLib 1.0 and later
  2853. * Non-Carbon CFM: in MenusLib 8.5 and later
  2854. }
  2855. function IsMenuBarVisible: Boolean; external name '_IsMenuBarVisible';
  2856. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2857. {
  2858. * ShowMenuBar()
  2859. *
  2860. * Mac OS X threading:
  2861. * Not thread safe
  2862. *
  2863. * Availability:
  2864. * Mac OS X: in version 10.0 and later in Carbon.framework
  2865. * CarbonLib: in CarbonLib 1.0 and later
  2866. * Non-Carbon CFM: in MenusLib 8.5 and later
  2867. }
  2868. procedure ShowMenuBar; external name '_ShowMenuBar';
  2869. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2870. {
  2871. * HideMenuBar()
  2872. *
  2873. * Mac OS X threading:
  2874. * Not thread safe
  2875. *
  2876. * Availability:
  2877. * Mac OS X: in version 10.0 and later in Carbon.framework
  2878. * CarbonLib: in CarbonLib 1.0 and later
  2879. * Non-Carbon CFM: in MenusLib 8.5 and later
  2880. }
  2881. procedure HideMenuBar; external name '_HideMenuBar';
  2882. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2883. {
  2884. * AcquireRootMenu()
  2885. *
  2886. * Summary:
  2887. * Get the menu whose contents are displayed in the menubar.
  2888. *
  2889. * Discussion:
  2890. * The refcount of the root menu is incremented by this API. The
  2891. * caller should release a refcount with ReleaseMenu when itÕs done
  2892. * with the menu.
  2893. *
  2894. * Mac OS X threading:
  2895. * Not thread safe
  2896. *
  2897. * Availability:
  2898. * Mac OS X: in version 10.0 and later in Carbon.framework
  2899. * CarbonLib: in CarbonLib 1.1 and later
  2900. * Non-Carbon CFM: not available
  2901. }
  2902. function AcquireRootMenu: MenuRef; external name '_AcquireRootMenu';
  2903. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2904. {
  2905. * SetRootMenu()
  2906. *
  2907. * Summary:
  2908. * Sets the menu whose contents are displayed in the menubar.
  2909. *
  2910. * Discussion:
  2911. * The refcount of the root menu is incremented by this API. The
  2912. * caller may release the menu after calling SetRootMenu.
  2913. *
  2914. * A root menu should contain one menu item for each top-level menu
  2915. * that should be displayed in the menubar. Each menu item should
  2916. * have a submenu that was installed with
  2917. * SetMenuItemHierarchicalMenu.
  2918. *
  2919. * SetRootMenu also sets the contents of the hierarchical portion of
  2920. * the menulist (the set of menus that were inserted with
  2921. * InsertMenu( menu, kInsertHierarchicalMenu). If a menu that was
  2922. * returned by AcquireRootMenu is passed to SetRootMenu, the
  2923. * hierarchical menulist is changed to include the menus that were
  2924. * in the hierarchical menulist when AcquireRootMenu was called. If
  2925. * a newly created menu is passed to SetRootMenu, the hierarchical
  2926. * menulist is cleared and has no menus in it.
  2927. *
  2928. * Mac OS X threading:
  2929. * Not thread safe
  2930. *
  2931. * Parameters:
  2932. *
  2933. * inMenu:
  2934. * The new root menu.
  2935. *
  2936. * Availability:
  2937. * Mac OS X: in version 10.0 and later in Carbon.framework
  2938. * CarbonLib: in CarbonLib 1.1 and later
  2939. * Non-Carbon CFM: not available
  2940. }
  2941. function SetRootMenu( inMenu: MenuRef ): OSStatus; external name '_SetRootMenu';
  2942. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2943. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  2944. { ¥ Menu Item Accessors }
  2945. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  2946. {
  2947. * CheckItem()
  2948. *
  2949. * Summary:
  2950. * Renamed to CheckMenuItem in Carbon
  2951. *
  2952. * Availability:
  2953. * Mac OS X: not available
  2954. * CarbonLib: not available
  2955. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2956. }
  2957. {
  2958. * [Mac]CheckMenuItem()
  2959. *
  2960. * Mac OS X threading:
  2961. * Not thread safe
  2962. *
  2963. * Availability:
  2964. * Mac OS X: in version 10.0 and later in Carbon.framework
  2965. * CarbonLib: in CarbonLib 1.0 and later
  2966. * Non-Carbon CFM: in CarbonAccessors.o 1.3 and later or as macro/inline
  2967. }
  2968. procedure CheckMenuItem( theMenu: MenuRef; item: MenuItemIndex; checked: Boolean ); external name '_CheckMenuItem';
  2969. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2970. procedure MacCheckMenuItem( theMenu: MenuRef; item: MenuItemIndex; checked: Boolean ); external name '_CheckMenuItem';
  2971. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2972. {
  2973. * SetMenuItemText()
  2974. *
  2975. * Mac OS X threading:
  2976. * Not thread safe
  2977. *
  2978. * Availability:
  2979. * Mac OS X: in version 10.0 and later in Carbon.framework
  2980. * CarbonLib: in CarbonLib 1.0 and later
  2981. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2982. }
  2983. procedure SetMenuItemText( theMenu: MenuRef; item: MenuItemIndex; const (*var*) itemString: Str255 ); external name '_SetMenuItemText';
  2984. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2985. {
  2986. * GetMenuItemText()
  2987. *
  2988. * Mac OS X threading:
  2989. * Not thread safe
  2990. *
  2991. * Availability:
  2992. * Mac OS X: in version 10.0 and later in Carbon.framework
  2993. * CarbonLib: in CarbonLib 1.0 and later
  2994. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  2995. }
  2996. procedure GetMenuItemText( theMenu: MenuRef; item: MenuItemIndex; var itemString: Str255 ); external name '_GetMenuItemText';
  2997. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  2998. {
  2999. * SetItemMark()
  3000. *
  3001. * Mac OS X threading:
  3002. * Not thread safe
  3003. *
  3004. * Availability:
  3005. * Mac OS X: in version 10.0 and later in Carbon.framework
  3006. * CarbonLib: in CarbonLib 1.0 and later
  3007. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3008. }
  3009. procedure SetItemMark( theMenu: MenuRef; item: MenuItemIndex; markChar: CharParameter ); external name '_SetItemMark';
  3010. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3011. {
  3012. * GetItemMark()
  3013. *
  3014. * Mac OS X threading:
  3015. * Not thread safe
  3016. *
  3017. * Availability:
  3018. * Mac OS X: in version 10.0 and later in Carbon.framework
  3019. * CarbonLib: in CarbonLib 1.0 and later
  3020. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3021. }
  3022. procedure GetItemMark( theMenu: MenuRef; item: MenuItemIndex; var markChar: CharParameter ); external name '_GetItemMark';
  3023. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3024. {
  3025. * SetItemCmd()
  3026. *
  3027. * Mac OS X threading:
  3028. * Not thread safe
  3029. *
  3030. * Availability:
  3031. * Mac OS X: in version 10.0 and later in Carbon.framework
  3032. * CarbonLib: in CarbonLib 1.0 and later
  3033. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3034. }
  3035. procedure SetItemCmd( theMenu: MenuRef; item: MenuItemIndex; cmdChar: CharParameter ); external name '_SetItemCmd';
  3036. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3037. {
  3038. * GetItemCmd()
  3039. *
  3040. * Mac OS X threading:
  3041. * Not thread safe
  3042. *
  3043. * Availability:
  3044. * Mac OS X: in version 10.0 and later in Carbon.framework
  3045. * CarbonLib: in CarbonLib 1.0 and later
  3046. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3047. }
  3048. procedure GetItemCmd( theMenu: MenuRef; item: MenuItemIndex; var cmdChar: CharParameter ); external name '_GetItemCmd';
  3049. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3050. {
  3051. * SetItemIcon()
  3052. *
  3053. * Mac OS X threading:
  3054. * Not thread safe
  3055. *
  3056. * Availability:
  3057. * Mac OS X: in version 10.0 and later in Carbon.framework
  3058. * CarbonLib: in CarbonLib 1.0 and later
  3059. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3060. }
  3061. procedure SetItemIcon( theMenu: MenuRef; item: MenuItemIndex; iconIndex: SInt16 ); external name '_SetItemIcon';
  3062. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3063. { icon is returned in high byte of 16-bit iconIndex }
  3064. {
  3065. * GetItemIcon()
  3066. *
  3067. * Mac OS X threading:
  3068. * Not thread safe
  3069. *
  3070. * Availability:
  3071. * Mac OS X: in version 10.0 and later in Carbon.framework
  3072. * CarbonLib: in CarbonLib 1.0 and later
  3073. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3074. }
  3075. procedure GetItemIcon( theMenu: MenuRef; item: MenuItemIndex; var iconIndex: SInt16 ); external name '_GetItemIcon';
  3076. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3077. {
  3078. * SetItemStyle()
  3079. *
  3080. * Mac OS X threading:
  3081. * Not thread safe
  3082. *
  3083. * Availability:
  3084. * Mac OS X: in version 10.0 and later in Carbon.framework
  3085. * CarbonLib: in CarbonLib 1.0 and later
  3086. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3087. }
  3088. procedure SetItemStyle( theMenu: MenuRef; item: MenuItemIndex; chStyle: StyleParameter ); external name '_SetItemStyle';
  3089. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3090. {
  3091. * GetItemStyle()
  3092. *
  3093. * Mac OS X threading:
  3094. * Not thread safe
  3095. *
  3096. * Availability:
  3097. * Mac OS X: in version 10.0 and later in Carbon.framework
  3098. * CarbonLib: in CarbonLib 1.0 and later
  3099. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3100. }
  3101. procedure GetItemStyle( theMenu: MenuRef; item: MenuItemIndex; var chStyle: Style ); external name '_GetItemStyle';
  3102. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3103. { These APIs are not supported in Carbon. Please use EnableMenuItem and }
  3104. { DisableMenuItem (available back through Mac OS 8.5) instead. }
  3105. {
  3106. * DisableItem()
  3107. *
  3108. * Availability:
  3109. * Mac OS X: not available
  3110. * CarbonLib: not available
  3111. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3112. }
  3113. {
  3114. * EnableItem()
  3115. *
  3116. * Availability:
  3117. * Mac OS X: not available
  3118. * CarbonLib: not available
  3119. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3120. }
  3121. {
  3122. * SetMenuItemCommandID()
  3123. *
  3124. * Mac OS X threading:
  3125. * Not thread safe
  3126. *
  3127. * Availability:
  3128. * Mac OS X: in version 10.0 and later in Carbon.framework
  3129. * CarbonLib: in CarbonLib 1.0 and later
  3130. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3131. }
  3132. function SetMenuItemCommandID( inMenu: MenuRef; inItem: MenuItemIndex; inCommandID: MenuCommand ): OSErr; external name '_SetMenuItemCommandID';
  3133. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3134. {
  3135. * GetMenuItemCommandID()
  3136. *
  3137. * Mac OS X threading:
  3138. * Not thread safe
  3139. *
  3140. * Availability:
  3141. * Mac OS X: in version 10.0 and later in Carbon.framework
  3142. * CarbonLib: in CarbonLib 1.0 and later
  3143. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3144. }
  3145. function GetMenuItemCommandID( inMenu: MenuRef; inItem: MenuItemIndex; var outCommandID: MenuCommand ): OSErr; external name '_GetMenuItemCommandID';
  3146. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3147. {
  3148. * SetMenuItemModifiers()
  3149. *
  3150. * Mac OS X threading:
  3151. * Not thread safe
  3152. *
  3153. * Availability:
  3154. * Mac OS X: in version 10.0 and later in Carbon.framework
  3155. * CarbonLib: in CarbonLib 1.0 and later
  3156. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3157. }
  3158. function SetMenuItemModifiers( inMenu: MenuRef; inItem: MenuItemIndex; inModifiers: UInt8 ): OSErr; external name '_SetMenuItemModifiers';
  3159. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3160. {
  3161. * GetMenuItemModifiers()
  3162. *
  3163. * Mac OS X threading:
  3164. * Not thread safe
  3165. *
  3166. * Availability:
  3167. * Mac OS X: in version 10.0 and later in Carbon.framework
  3168. * CarbonLib: in CarbonLib 1.0 and later
  3169. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3170. }
  3171. function GetMenuItemModifiers( inMenu: MenuRef; inItem: MenuItemIndex; var outModifiers: UInt8 ): OSErr; external name '_GetMenuItemModifiers';
  3172. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3173. {
  3174. * SetMenuItemIconHandle()
  3175. *
  3176. * Mac OS X threading:
  3177. * Not thread safe
  3178. *
  3179. * Availability:
  3180. * Mac OS X: in version 10.0 and later in Carbon.framework
  3181. * CarbonLib: in CarbonLib 1.0 and later
  3182. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3183. }
  3184. function SetMenuItemIconHandle( inMenu: MenuRef; inItem: MenuItemIndex; inIconType: UInt8; inIconHandle: Handle ): OSErr; external name '_SetMenuItemIconHandle';
  3185. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3186. {
  3187. * GetMenuItemIconHandle()
  3188. *
  3189. * Mac OS X threading:
  3190. * Not thread safe
  3191. *
  3192. * Availability:
  3193. * Mac OS X: in version 10.0 and later in Carbon.framework
  3194. * CarbonLib: in CarbonLib 1.0 and later
  3195. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3196. }
  3197. function GetMenuItemIconHandle( inMenu: MenuRef; inItem: MenuItemIndex; var outIconType: UInt8; var outIconHandle: Handle ): OSErr; external name '_GetMenuItemIconHandle';
  3198. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3199. {
  3200. * SetMenuItemTextEncoding()
  3201. *
  3202. * Mac OS X threading:
  3203. * Not thread safe
  3204. *
  3205. * Availability:
  3206. * Mac OS X: in version 10.0 and later in Carbon.framework
  3207. * CarbonLib: in CarbonLib 1.0 and later
  3208. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3209. }
  3210. function SetMenuItemTextEncoding( inMenu: MenuRef; inItem: MenuItemIndex; inScriptID: TextEncoding ): OSErr; external name '_SetMenuItemTextEncoding';
  3211. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3212. {
  3213. * GetMenuItemTextEncoding()
  3214. *
  3215. * Mac OS X threading:
  3216. * Not thread safe
  3217. *
  3218. * Availability:
  3219. * Mac OS X: in version 10.0 and later in Carbon.framework
  3220. * CarbonLib: in CarbonLib 1.0 and later
  3221. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3222. }
  3223. function GetMenuItemTextEncoding( inMenu: MenuRef; inItem: MenuItemIndex; var outScriptID: TextEncoding ): OSErr; external name '_GetMenuItemTextEncoding';
  3224. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3225. {
  3226. * SetMenuItemHierarchicalID()
  3227. *
  3228. * Mac OS X threading:
  3229. * Not thread safe
  3230. *
  3231. * Availability:
  3232. * Mac OS X: in version 10.0 and later in Carbon.framework
  3233. * CarbonLib: in CarbonLib 1.0 and later
  3234. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3235. }
  3236. function SetMenuItemHierarchicalID( inMenu: MenuRef; inItem: MenuItemIndex; inHierID: MenuID ): OSErr; external name '_SetMenuItemHierarchicalID';
  3237. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3238. {
  3239. * GetMenuItemHierarchicalID()
  3240. *
  3241. * Mac OS X threading:
  3242. * Not thread safe
  3243. *
  3244. * Availability:
  3245. * Mac OS X: in version 10.0 and later in Carbon.framework
  3246. * CarbonLib: in CarbonLib 1.0 and later
  3247. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3248. }
  3249. function GetMenuItemHierarchicalID( inMenu: MenuRef; inItem: MenuItemIndex; var outHierID: MenuID ): OSErr; external name '_GetMenuItemHierarchicalID';
  3250. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3251. {
  3252. * SetMenuItemFontID()
  3253. *
  3254. * Mac OS X threading:
  3255. * Not thread safe
  3256. *
  3257. * Availability:
  3258. * Mac OS X: in version 10.0 and later in Carbon.framework
  3259. * CarbonLib: in CarbonLib 1.0 and later
  3260. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3261. }
  3262. function SetMenuItemFontID( inMenu: MenuRef; inItem: MenuItemIndex; inFontID: SInt16 ): OSErr; external name '_SetMenuItemFontID';
  3263. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3264. {
  3265. * GetMenuItemFontID()
  3266. *
  3267. * Mac OS X threading:
  3268. * Not thread safe
  3269. *
  3270. * Availability:
  3271. * Mac OS X: in version 10.0 and later in Carbon.framework
  3272. * CarbonLib: in CarbonLib 1.0 and later
  3273. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3274. }
  3275. function GetMenuItemFontID( inMenu: MenuRef; inItem: MenuItemIndex; var outFontID: SInt16 ): OSErr; external name '_GetMenuItemFontID';
  3276. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3277. {
  3278. * SetMenuItemRefCon()
  3279. *
  3280. * Mac OS X threading:
  3281. * Not thread safe
  3282. *
  3283. * Availability:
  3284. * Mac OS X: in version 10.0 and later in Carbon.framework
  3285. * CarbonLib: in CarbonLib 1.0 and later
  3286. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3287. }
  3288. function SetMenuItemRefCon( inMenu: MenuRef; inItem: MenuItemIndex; inRefCon: UInt32 ): OSErr; external name '_SetMenuItemRefCon';
  3289. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3290. {
  3291. * GetMenuItemRefCon()
  3292. *
  3293. * Mac OS X threading:
  3294. * Not thread safe
  3295. *
  3296. * Availability:
  3297. * Mac OS X: in version 10.0 and later in Carbon.framework
  3298. * CarbonLib: in CarbonLib 1.0 and later
  3299. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3300. }
  3301. function GetMenuItemRefCon( inMenu: MenuRef; inItem: MenuItemIndex; var outRefCon: UInt32 ): OSErr; external name '_GetMenuItemRefCon';
  3302. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3303. { Please use the menu item property APIs in Carbon.}
  3304. {
  3305. * SetMenuItemRefCon2()
  3306. *
  3307. * Availability:
  3308. * Mac OS X: not available
  3309. * CarbonLib: not available
  3310. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3311. }
  3312. {
  3313. * GetMenuItemRefCon2()
  3314. *
  3315. * Availability:
  3316. * Mac OS X: not available
  3317. * CarbonLib: not available
  3318. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3319. }
  3320. {
  3321. * SetMenuItemKeyGlyph()
  3322. *
  3323. * Summary:
  3324. * Sets the command key glyph code for a menu item.
  3325. *
  3326. * Discussion:
  3327. * A menu item's command key may be customized using a key glyph
  3328. * code; these codes are the kMenu*Glyph constants documented in
  3329. * Menus.h. In classic Mac OS, a glyph code is only used for
  3330. * display; it does not affect command key matching. In Carbon, a
  3331. * menu item's glyph code is used for command key matching if the
  3332. * menu item does not have a command key character or virtual
  3333. * keycode assigned to it.
  3334. *
  3335. * In CarbonLib 1.2 and Mac OS X 10.0 and later, the Menu Manager
  3336. * will automatically draw the appropriate glyph for a menu item
  3337. * that has a virtual keycode command key assigned to it; it is not
  3338. * necessary to set both the virtual keycode and the glyph for an
  3339. * item.
  3340. *
  3341. * Mac OS X threading:
  3342. * Not thread safe
  3343. *
  3344. * Parameters:
  3345. *
  3346. * inMenu:
  3347. * The menu to change.
  3348. *
  3349. * inItem:
  3350. * The menu item to change.
  3351. *
  3352. * inGlyph:
  3353. * The new glyph code for the item, or zero to remove the item's
  3354. * glyph code.
  3355. *
  3356. * Availability:
  3357. * Mac OS X: in version 10.0 and later in Carbon.framework
  3358. * CarbonLib: in CarbonLib 1.0 and later
  3359. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3360. }
  3361. function SetMenuItemKeyGlyph( inMenu: MenuRef; inItem: MenuItemIndex; inGlyph: SInt16 ): OSErr; external name '_SetMenuItemKeyGlyph';
  3362. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3363. {
  3364. * GetMenuItemKeyGlyph()
  3365. *
  3366. * Mac OS X threading:
  3367. * Not thread safe
  3368. *
  3369. * Availability:
  3370. * Mac OS X: in version 10.0 and later in Carbon.framework
  3371. * CarbonLib: in CarbonLib 1.0 and later
  3372. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3373. }
  3374. function GetMenuItemKeyGlyph( inMenu: MenuRef; inItem: MenuItemIndex; var outGlyph: SInt16 ): OSErr; external name '_GetMenuItemKeyGlyph';
  3375. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3376. { Routines available in Mac OS 8.5 and later (supporting enabling/disabling of > 31 items)}
  3377. {
  3378. * [Mac]EnableMenuItem()
  3379. *
  3380. * Mac OS X threading:
  3381. * Not thread safe
  3382. *
  3383. * Availability:
  3384. * Mac OS X: in version 10.0 and later in Carbon.framework
  3385. * CarbonLib: in CarbonLib 1.0 and later
  3386. * Non-Carbon CFM: in MenusLib 8.5 and later
  3387. }
  3388. procedure EnableMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_EnableMenuItem';
  3389. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3390. procedure MacEnableMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_EnableMenuItem';
  3391. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3392. {
  3393. * DisableMenuItem()
  3394. *
  3395. * Mac OS X threading:
  3396. * Not thread safe
  3397. *
  3398. * Availability:
  3399. * Mac OS X: in version 10.0 and later in Carbon.framework
  3400. * CarbonLib: in CarbonLib 1.0 and later
  3401. * Non-Carbon CFM: in MenusLib 8.5 and later
  3402. }
  3403. procedure DisableMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_DisableMenuItem';
  3404. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3405. {
  3406. * IsMenuItemEnabled()
  3407. *
  3408. * Mac OS X threading:
  3409. * Not thread safe
  3410. *
  3411. * Availability:
  3412. * Mac OS X: in version 10.0 and later in Carbon.framework
  3413. * CarbonLib: in CarbonLib 1.0 and later
  3414. * Non-Carbon CFM: in MenusLib 8.5 and later
  3415. }
  3416. function IsMenuItemEnabled( menu: MenuRef; item: MenuItemIndex ): Boolean; external name '_IsMenuItemEnabled';
  3417. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3418. {
  3419. * EnableMenuItemIcon()
  3420. *
  3421. * Mac OS X threading:
  3422. * Not thread safe
  3423. *
  3424. * Availability:
  3425. * Mac OS X: in version 10.0 and later in Carbon.framework
  3426. * CarbonLib: in CarbonLib 1.0 and later
  3427. * Non-Carbon CFM: in MenusLib 8.5 and later
  3428. }
  3429. procedure EnableMenuItemIcon( theMenu: MenuRef; item: MenuItemIndex ); external name '_EnableMenuItemIcon';
  3430. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3431. {
  3432. * DisableMenuItemIcon()
  3433. *
  3434. * Mac OS X threading:
  3435. * Not thread safe
  3436. *
  3437. * Availability:
  3438. * Mac OS X: in version 10.0 and later in Carbon.framework
  3439. * CarbonLib: in CarbonLib 1.0 and later
  3440. * Non-Carbon CFM: in MenusLib 8.5 and later
  3441. }
  3442. procedure DisableMenuItemIcon( theMenu: MenuRef; item: MenuItemIndex ); external name '_DisableMenuItemIcon';
  3443. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3444. {
  3445. * IsMenuItemIconEnabled()
  3446. *
  3447. * Mac OS X threading:
  3448. * Not thread safe
  3449. *
  3450. * Availability:
  3451. * Mac OS X: in version 10.0 and later in Carbon.framework
  3452. * CarbonLib: in CarbonLib 1.0 and later
  3453. * Non-Carbon CFM: in MenusLib 8.5 and later
  3454. }
  3455. function IsMenuItemIconEnabled( menu: MenuRef; item: MenuItemIndex ): Boolean; external name '_IsMenuItemIconEnabled';
  3456. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3457. {
  3458. * SetMenuItemHierarchicalMenu()
  3459. *
  3460. * Summary:
  3461. * Attaches a submenu to a menu item.
  3462. *
  3463. * Discussion:
  3464. * Using SetMenuItemHierarchicalMenu, it is possible to directly
  3465. * specify the submenu for a menu item without specifying its menu
  3466. * ID. It is not necessary to insert the submenu into the
  3467. * hierarchical portion of the menubar, and it is not necessary for
  3468. * the submenu to have a unique menu ID; it is recommended that you
  3469. * use 0 as the menu ID for the submenu, and identify selections
  3470. * from the menu by command ID. The Menu Manager will increment the
  3471. * refcount of the submenu that you specify, and the submenu's
  3472. * refcount will be decremented automatically when the parent menu
  3473. * item is deleted or the parent menu is disposed.
  3474. *
  3475. * Mac OS X threading:
  3476. * Not thread safe
  3477. *
  3478. * Parameters:
  3479. *
  3480. * inMenu:
  3481. * The parent menu.
  3482. *
  3483. * inItem:
  3484. * The parent item.
  3485. *
  3486. * inHierMenu:
  3487. * The submenu. You may pass NULL to remove any existing submenu.
  3488. *
  3489. * Availability:
  3490. * Mac OS X: in version 10.0 and later in Carbon.framework
  3491. * CarbonLib: in CarbonLib 1.1 and later
  3492. * Non-Carbon CFM: not available
  3493. }
  3494. function SetMenuItemHierarchicalMenu( inMenu: MenuRef; inItem: MenuItemIndex; inHierMenu: MenuRef { can be NULL } ): OSStatus; external name '_SetMenuItemHierarchicalMenu';
  3495. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3496. {
  3497. * GetMenuItemHierarchicalMenu()
  3498. *
  3499. * Summary:
  3500. * Returns the submenu attached to a menu item.
  3501. *
  3502. * Discussion:
  3503. * GetMenuItemHierarchicalMenu will return the submenu attached to a
  3504. * menu item regardless of how the submenu was specified. If the
  3505. * submenu was specified by menu ID (using SetItemCmd or
  3506. * SetMenuItemHierarchicalID), GetMenuItemHierarchicalMenu will
  3507. * return the currently installed menu with that ID, if any. The
  3508. * only case where GetMenuItemHierarchicalMenu will fail to return
  3509. * the item's submenu is when the submenu is specified by menu ID,
  3510. * but the submenu is not currently inserted in the menu bar.
  3511. *
  3512. * Mac OS X threading:
  3513. * Not thread safe
  3514. *
  3515. * Parameters:
  3516. *
  3517. * inMenu:
  3518. * The parent menu.
  3519. *
  3520. * inItem:
  3521. * The parent item.
  3522. *
  3523. * outHierMenu:
  3524. * On exit, the item's submenu, or NULL if it does not have one.
  3525. *
  3526. * Availability:
  3527. * Mac OS X: in version 10.0 and later in Carbon.framework
  3528. * CarbonLib: in CarbonLib 1.1 and later
  3529. * Non-Carbon CFM: not available
  3530. }
  3531. function GetMenuItemHierarchicalMenu( inMenu: MenuRef; inItem: MenuItemIndex; var outHierMenu: MenuRef ): OSStatus; external name '_GetMenuItemHierarchicalMenu';
  3532. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3533. {
  3534. * CopyMenuItemTextAsCFString()
  3535. *
  3536. * Summary:
  3537. * Returns a CFString containing the text of a menu item.
  3538. *
  3539. * Mac OS X threading:
  3540. * Not thread safe
  3541. *
  3542. * Parameters:
  3543. *
  3544. * inMenu:
  3545. * The menu containing the item.
  3546. *
  3547. * inItem:
  3548. * The item whose text to return.
  3549. *
  3550. * outString:
  3551. * On exit, a CFString containing the item's text. This string
  3552. * must be released by the caller.
  3553. *
  3554. * Availability:
  3555. * Mac OS X: in version 10.0 and later in Carbon.framework
  3556. * CarbonLib: in CarbonLib 1.1 and later
  3557. * Non-Carbon CFM: not available
  3558. }
  3559. function CopyMenuItemTextAsCFString( inMenu: MenuRef; inItem: MenuItemIndex; var outString: CFStringRef ): OSStatus; external name '_CopyMenuItemTextAsCFString';
  3560. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3561. {
  3562. * SetMenuItemTextWithCFString()
  3563. *
  3564. * Summary:
  3565. * Sets the text of a menu item to the text contained in a CFString.
  3566. *
  3567. * Discussion:
  3568. * The Menu Manager will either make its own copy or just increment
  3569. * the refcount of the CFString before returning from
  3570. * SetMenuItemTextWithCFString, depending on whether the string is
  3571. * mutable or immutable. If the string is mutable, modifying the
  3572. * string after calling SetMenuItemTextWithCFString will have no
  3573. * effect on the menu item's actual text. The caller may release the
  3574. * string after calling SetMenuItemTextWithCFString.
  3575. *
  3576. * Mac OS X threading:
  3577. * Not thread safe
  3578. *
  3579. * Parameters:
  3580. *
  3581. * inMenu:
  3582. * The menu containing the item.
  3583. *
  3584. * inItem:
  3585. * The item whose text to return.
  3586. *
  3587. * inString:
  3588. * The string containing the new menu item text.
  3589. *
  3590. * Availability:
  3591. * Mac OS X: in version 10.0 and later in Carbon.framework
  3592. * CarbonLib: in CarbonLib 1.1 and later
  3593. * Non-Carbon CFM: not available
  3594. }
  3595. function SetMenuItemTextWithCFString( inMenu: MenuRef; inItem: MenuItemIndex; inString: CFStringRef ): OSStatus; external name '_SetMenuItemTextWithCFString';
  3596. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3597. {
  3598. * GetMenuItemIndent()
  3599. *
  3600. * Summary:
  3601. * Gets the indent level of a menu item.
  3602. *
  3603. * Discussion:
  3604. * The indent level of an item is an amount of extra space added to
  3605. * the left of the item's icon or checkmark. The level is simply a
  3606. * number, starting at zero, which the Menu Manager multiplies by a
  3607. * constant to get the indent in pixels. The default indent level is
  3608. * zero.
  3609. *
  3610. * Mac OS X threading:
  3611. * Not thread safe
  3612. *
  3613. * Parameters:
  3614. *
  3615. * inMenu:
  3616. * The menu containing the item.
  3617. *
  3618. * inItem:
  3619. * The item whose indent to retrieve.
  3620. *
  3621. * outIndent:
  3622. * On exit, the indent level of the item.
  3623. *
  3624. * Availability:
  3625. * Mac OS X: in version 10.0 and later in Carbon.framework
  3626. * CarbonLib: in CarbonLib 1.1 and later
  3627. * Non-Carbon CFM: not available
  3628. }
  3629. function GetMenuItemIndent( inMenu: MenuRef; inItem: MenuItemIndex; var outIndent: UInt32 ): OSStatus; external name '_GetMenuItemIndent';
  3630. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3631. {
  3632. * SetMenuItemIndent()
  3633. *
  3634. * Summary:
  3635. * Sets the indent level of a menu item.
  3636. *
  3637. * Discussion:
  3638. * The indent level of an item is an amount of extra space added to
  3639. * the left of the item's icon or checkmark. The level is simply a
  3640. * number, starting at zero, which the Menu Manager multiplies by a
  3641. * constant to get the indent in pixels. The default indent level is
  3642. * zero.
  3643. *
  3644. * Mac OS X threading:
  3645. * Not thread safe
  3646. *
  3647. * Parameters:
  3648. *
  3649. * inMenu:
  3650. * The menu containing the item.
  3651. *
  3652. * inItem:
  3653. * The item whose indent to set.
  3654. *
  3655. * inIndent:
  3656. * The new indent level of the item.
  3657. *
  3658. * Availability:
  3659. * Mac OS X: in version 10.0 and later in Carbon.framework
  3660. * CarbonLib: in CarbonLib 1.1 and later
  3661. * Non-Carbon CFM: not available
  3662. }
  3663. function SetMenuItemIndent( inMenu: MenuRef; inItem: MenuItemIndex; inIndent: UInt32 ): OSStatus; external name '_SetMenuItemIndent';
  3664. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3665. {
  3666. * GetMenuItemCommandKey()
  3667. *
  3668. * Summary:
  3669. * Gets the keyboard equivalent of a menu item.
  3670. *
  3671. * Discussion:
  3672. * A menu item's keyboard equivalent may be either a character code
  3673. * or a virtual keycode. An item's character code and virtual
  3674. * keycode are stored separately and may contain different values,
  3675. * but only one is used by the Menu Manager at any given time. When
  3676. * requesting a menu item's virtual keycode equivalent, you should
  3677. * first check that the item is using a virtual keycode by testing
  3678. * the kMenuItemAttrUseVirtualKey attribute for that item. If this
  3679. * attribute is not set, the item's virtual keycode is ignored by
  3680. * the Menu Manager. Note that zero is a valid virtual keycode, so
  3681. * you cannot test the returned keycode against zero to determine if
  3682. * the item is using a virtual keycode equivalent. You must test the
  3683. * kMenuItemAttrUseVirtualKey attribute.
  3684. *
  3685. * Mac OS X threading:
  3686. * Not thread safe
  3687. *
  3688. * Parameters:
  3689. *
  3690. * inMenu:
  3691. * The menu containing the item.
  3692. *
  3693. * inItem:
  3694. * The item whose keyboard equivalent to retrieve.
  3695. *
  3696. * inGetVirtualKey:
  3697. * Indicates whether to retrieve the item's character code or
  3698. * virtual keycode equivalent.
  3699. *
  3700. * outKey:
  3701. * On exit, the keyboard equivalent of the item.
  3702. *
  3703. * Availability:
  3704. * Mac OS X: in version 10.0 and later in Carbon.framework
  3705. * CarbonLib: in CarbonLib 1.1 and later
  3706. * Non-Carbon CFM: not available
  3707. }
  3708. function GetMenuItemCommandKey( inMenu: MenuRef; inItem: MenuItemIndex; inGetVirtualKey: Boolean; var outKey: UInt16 ): OSStatus; external name '_GetMenuItemCommandKey';
  3709. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3710. {
  3711. * SetMenuItemCommandKey()
  3712. *
  3713. * Summary:
  3714. * Sets the keyboard equivalent of a menu item.
  3715. *
  3716. * Discussion:
  3717. * A menu item's keyboard equivalent may be either a character code
  3718. * or a virtual keycode. The character code is always used to draw
  3719. * the item's keyboard equivalent in the menu, but either may be
  3720. * used for keyboard equivalent matching by MenuEvent and
  3721. * IsMenuKeyEvent, depending on whether the
  3722. * kMenuItemAttrUseVirtualKey item attribute is set. If
  3723. * SetMenuItemCommandKey is used to set the virtual keycode
  3724. * equivalent for a menu item, it also automatically sets the
  3725. * kMenuItemAttrUseVirtualKey item attribute. To make the menu item
  3726. * stop using the virtual keycode equivalent and use the character
  3727. * code equivalent instead, use ChangeMenuItemAttributes to clear
  3728. * the kMenuItemAttrUseVirtualKey item attribute.
  3729. *
  3730. * Mac OS X threading:
  3731. * Not thread safe
  3732. *
  3733. * Parameters:
  3734. *
  3735. * inMenu:
  3736. * The menu containing the item.
  3737. *
  3738. * inItem:
  3739. * The item whose keyboard equivalent to set.
  3740. *
  3741. * inSetVirtualKey:
  3742. * Indicates whether to set the item's character code or virtual
  3743. * keycode equivalent.
  3744. *
  3745. * inKey:
  3746. * The item's new character code or virtual keycode equivalent.
  3747. *
  3748. * Availability:
  3749. * Mac OS X: in version 10.0 and later in Carbon.framework
  3750. * CarbonLib: in CarbonLib 1.1 and later
  3751. * Non-Carbon CFM: not available
  3752. }
  3753. function SetMenuItemCommandKey( inMenu: MenuRef; inItem: MenuItemIndex; inSetVirtualKey: Boolean; inKey: UInt16 ): OSStatus; external name '_SetMenuItemCommandKey';
  3754. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3755. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3756. { ¥ Menu Item Color Tables }
  3757. { Menu color manipulation is considered deprecated with the advent of the Appearance }
  3758. { Manager. Avoid using these routines if possible }
  3759. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3760. {
  3761. * DeleteMCEntries()
  3762. *
  3763. * Mac OS X threading:
  3764. * Not thread safe
  3765. *
  3766. * Availability:
  3767. * Mac OS X: in version 10.0 and later in Carbon.framework
  3768. * CarbonLib: in CarbonLib 1.0 and later
  3769. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3770. }
  3771. procedure DeleteMCEntries( menuID_: MenuID; menuItem: SInt16 ); external name '_DeleteMCEntries';
  3772. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3773. {
  3774. * GetMCInfo()
  3775. *
  3776. * Mac OS X threading:
  3777. * Not thread safe
  3778. *
  3779. * Availability:
  3780. * Mac OS X: in version 10.0 and later in Carbon.framework
  3781. * CarbonLib: in CarbonLib 1.0 and later
  3782. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3783. }
  3784. function GetMCInfo: MCTableHandle; external name '_GetMCInfo';
  3785. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3786. {
  3787. * SetMCInfo()
  3788. *
  3789. * Mac OS X threading:
  3790. * Not thread safe
  3791. *
  3792. * Availability:
  3793. * Mac OS X: in version 10.0 and later in Carbon.framework
  3794. * CarbonLib: in CarbonLib 1.0 and later
  3795. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3796. }
  3797. procedure SetMCInfo( menuCTbl: MCTableHandle ); external name '_SetMCInfo';
  3798. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3799. {
  3800. * DisposeMCInfo()
  3801. *
  3802. * Mac OS X threading:
  3803. * Not thread safe
  3804. *
  3805. * Availability:
  3806. * Mac OS X: in version 10.0 and later in Carbon.framework
  3807. * CarbonLib: in CarbonLib 1.0 and later
  3808. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3809. }
  3810. procedure DisposeMCInfo( menuCTbl: MCTableHandle ); external name '_DisposeMCInfo';
  3811. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3812. {
  3813. * GetMCEntry()
  3814. *
  3815. * Mac OS X threading:
  3816. * Not thread safe
  3817. *
  3818. * Availability:
  3819. * Mac OS X: in version 10.0 and later in Carbon.framework
  3820. * CarbonLib: in CarbonLib 1.0 and later
  3821. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3822. }
  3823. function GetMCEntry( menuID_: MenuID; menuItem: SInt16 ): MCEntryPtr; external name '_GetMCEntry';
  3824. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3825. {
  3826. * SetMCEntries()
  3827. *
  3828. * Mac OS X threading:
  3829. * Not thread safe
  3830. *
  3831. * Availability:
  3832. * Mac OS X: in version 10.0 and later in Carbon.framework
  3833. * CarbonLib: in CarbonLib 1.0 and later
  3834. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3835. }
  3836. procedure SetMCEntries( numEntries: SInt16; menuCEntries: MCTablePtr ); external name '_SetMCEntries';
  3837. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3838. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3839. { ¥ Properties (Mac OS 8.5 and later) }
  3840. { With the following property APIs, you can attach any piece of data you'd like to a }
  3841. { menu or menu item. Passing zero for the item number parameter indicates you'd like }
  3842. { to attach the data to the menu itself, and not to any specific menu item. }
  3843. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3844. const
  3845. kMenuPropertyPersistent = $00000001; { whether this property gets saved when flattening the menu}
  3846. {
  3847. * GetMenuItemProperty()
  3848. *
  3849. * Mac OS X threading:
  3850. * Not thread safe
  3851. *
  3852. * Availability:
  3853. * Mac OS X: in version 10.0 and later in Carbon.framework
  3854. * CarbonLib: in CarbonLib 1.0 and later
  3855. * Non-Carbon CFM: in MenusLib 8.5 and later
  3856. }
  3857. function GetMenuItemProperty( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; bufferSize: UInt32; var actualSize: UInt32; propertyBuffer: UnivPtr ): OSStatus; external name '_GetMenuItemProperty';
  3858. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3859. {
  3860. * GetMenuItemPropertySize()
  3861. *
  3862. * Mac OS X threading:
  3863. * Not thread safe
  3864. *
  3865. * Availability:
  3866. * Mac OS X: in version 10.0 and later in Carbon.framework
  3867. * CarbonLib: in CarbonLib 1.0 and later
  3868. * Non-Carbon CFM: in MenusLib 8.5 and later
  3869. }
  3870. function GetMenuItemPropertySize( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; var size: UInt32 ): OSStatus; external name '_GetMenuItemPropertySize';
  3871. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3872. {
  3873. * SetMenuItemProperty()
  3874. *
  3875. * Mac OS X threading:
  3876. * Not thread safe
  3877. *
  3878. * Availability:
  3879. * Mac OS X: in version 10.0 and later in Carbon.framework
  3880. * CarbonLib: in CarbonLib 1.0 and later
  3881. * Non-Carbon CFM: in MenusLib 8.5 and later
  3882. }
  3883. function SetMenuItemProperty( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; propertySize: UInt32; propertyData: {const} UnivPtr ): OSStatus; external name '_SetMenuItemProperty';
  3884. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3885. {
  3886. * RemoveMenuItemProperty()
  3887. *
  3888. * Mac OS X threading:
  3889. * Not thread safe
  3890. *
  3891. * Availability:
  3892. * Mac OS X: in version 10.0 and later in Carbon.framework
  3893. * CarbonLib: in CarbonLib 1.0 and later
  3894. * Non-Carbon CFM: in MenusLib 8.5 and later
  3895. }
  3896. function RemoveMenuItemProperty( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType ): OSStatus; external name '_RemoveMenuItemProperty';
  3897. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3898. {
  3899. * GetMenuItemPropertyAttributes()
  3900. *
  3901. * Summary:
  3902. * Gets the attributes of a menu item property.
  3903. *
  3904. * Mac OS X threading:
  3905. * Not thread safe
  3906. *
  3907. * Parameters:
  3908. *
  3909. * menu:
  3910. * The menu.
  3911. *
  3912. * item:
  3913. * The menu item.
  3914. *
  3915. * propertyCreator:
  3916. * The creator code of the property.
  3917. *
  3918. * propertyTag:
  3919. * The property tag.
  3920. *
  3921. * attributes:
  3922. * On exit, contains the attributes of the property.
  3923. *
  3924. * Availability:
  3925. * Mac OS X: in version 10.0 and later in Carbon.framework
  3926. * CarbonLib: in CarbonLib 1.0 and later
  3927. * Non-Carbon CFM: not available
  3928. }
  3929. function GetMenuItemPropertyAttributes( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; var attributes: UInt32 ): OSStatus; external name '_GetMenuItemPropertyAttributes';
  3930. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3931. {
  3932. * ChangeMenuItemPropertyAttributes()
  3933. *
  3934. * Summary:
  3935. * Changes the attributes of a menu item property.
  3936. *
  3937. * Mac OS X threading:
  3938. * Not thread safe
  3939. *
  3940. * Parameters:
  3941. *
  3942. * menu:
  3943. * The menu.
  3944. *
  3945. * item:
  3946. * The menu item.
  3947. *
  3948. * propertyCreator:
  3949. * The creator code of the property.
  3950. *
  3951. * propertyTag:
  3952. * The property tag.
  3953. *
  3954. * attributesToSet:
  3955. * The attributes to add to the menu item property.
  3956. *
  3957. * attributesToClear:
  3958. * The attributes to remove from the menu item property.
  3959. *
  3960. * Availability:
  3961. * Mac OS X: in version 10.0 and later in Carbon.framework
  3962. * CarbonLib: in CarbonLib 1.0 and later
  3963. * Non-Carbon CFM: not available
  3964. }
  3965. function ChangeMenuItemPropertyAttributes( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; attributesToSet: UInt32; attributesToClear: UInt32 ): OSStatus; external name '_ChangeMenuItemPropertyAttributes';
  3966. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3967. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3968. { ¥ Attributes (Carbon and later) }
  3969. { Each menu and menu item has attribute flags. }
  3970. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3971. {
  3972. * GetMenuAttributes()
  3973. *
  3974. * Summary:
  3975. * Gets the attributes of a menu.
  3976. *
  3977. * Mac OS X threading:
  3978. * Not thread safe
  3979. *
  3980. * Parameters:
  3981. *
  3982. * menu:
  3983. * The menu.
  3984. *
  3985. * outAttributes:
  3986. * On exit, contains the attributes of the menu.
  3987. *
  3988. * Availability:
  3989. * Mac OS X: in version 10.0 and later in Carbon.framework
  3990. * CarbonLib: in CarbonLib 1.0 and later
  3991. * Non-Carbon CFM: not available
  3992. }
  3993. function GetMenuAttributes( menu: MenuRef; var outAttributes: MenuAttributes ): OSStatus; external name '_GetMenuAttributes';
  3994. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3995. {
  3996. * ChangeMenuAttributes()
  3997. *
  3998. * Summary:
  3999. * Changes the attributes of a menu.
  4000. *
  4001. * Mac OS X threading:
  4002. * Not thread safe
  4003. *
  4004. * Parameters:
  4005. *
  4006. * menu:
  4007. * The menu.
  4008. *
  4009. * setTheseAttributes:
  4010. * The attributes to add to the menu.
  4011. *
  4012. * clearTheseAttributes:
  4013. * The attributes to remove from the menu.
  4014. *
  4015. * Availability:
  4016. * Mac OS X: in version 10.0 and later in Carbon.framework
  4017. * CarbonLib: in CarbonLib 1.0 and later
  4018. * Non-Carbon CFM: not available
  4019. }
  4020. function ChangeMenuAttributes( menu: MenuRef; setTheseAttributes: MenuAttributes; clearTheseAttributes: MenuAttributes ): OSStatus; external name '_ChangeMenuAttributes';
  4021. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4022. {
  4023. * GetMenuItemAttributes()
  4024. *
  4025. * Summary:
  4026. * Gets the attributes of a menu item.
  4027. *
  4028. * Mac OS X threading:
  4029. * Not thread safe
  4030. *
  4031. * Parameters:
  4032. *
  4033. * menu:
  4034. * The menu.
  4035. *
  4036. * item:
  4037. * The menu item.
  4038. *
  4039. * outAttributes:
  4040. * On exit, contains the attributes of the menu item.
  4041. *
  4042. * Availability:
  4043. * Mac OS X: in version 10.0 and later in Carbon.framework
  4044. * CarbonLib: in CarbonLib 1.0 and later
  4045. * Non-Carbon CFM: not available
  4046. }
  4047. function GetMenuItemAttributes( menu: MenuRef; item: MenuItemIndex; var outAttributes: MenuItemAttributes ): OSStatus; external name '_GetMenuItemAttributes';
  4048. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4049. {
  4050. * ChangeMenuItemAttributes()
  4051. *
  4052. * Summary:
  4053. * Changes the attributes of a menu item.
  4054. *
  4055. * Mac OS X threading:
  4056. * Not thread safe
  4057. *
  4058. * Parameters:
  4059. *
  4060. * menu:
  4061. * The menu.
  4062. *
  4063. * item:
  4064. * The menu item.
  4065. *
  4066. * setTheseAttributes:
  4067. * The attributes to add to the menu item.
  4068. *
  4069. * clearTheseAttributes:
  4070. * The attributes to remove from the menu item.
  4071. *
  4072. * Availability:
  4073. * Mac OS X: in version 10.0 and later in Carbon.framework
  4074. * CarbonLib: in CarbonLib 1.0 and later
  4075. * Non-Carbon CFM: not available
  4076. }
  4077. function ChangeMenuItemAttributes( menu: MenuRef; item: MenuItemIndex; setTheseAttributes: MenuItemAttributes; clearTheseAttributes: MenuItemAttributes ): OSStatus; external name '_ChangeMenuItemAttributes';
  4078. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4079. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4080. { ¥ Mass menu item enabling and disabling (Carbon and later) }
  4081. { Useful when rewriting code that modifies the enableFlags field directly. }
  4082. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4083. {
  4084. * DisableAllMenuItems()
  4085. *
  4086. * Summary:
  4087. * Disables all items in a menu.
  4088. *
  4089. * Discussion:
  4090. * This API is equivalent to pre-Carbon code that masked the
  4091. * enableFlags field of the MenuInfo with 0x01. It disables all
  4092. * items (including items past item 31) but does not affect the
  4093. * state of the menu title.
  4094. *
  4095. * Mac OS X threading:
  4096. * Not thread safe
  4097. *
  4098. * Parameters:
  4099. *
  4100. * theMenu:
  4101. * The menu whose items to disable.
  4102. *
  4103. * Availability:
  4104. * Mac OS X: in version 10.0 and later in Carbon.framework
  4105. * CarbonLib: in CarbonLib 1.0 and later
  4106. * Non-Carbon CFM: not available
  4107. }
  4108. procedure DisableAllMenuItems( theMenu: MenuRef ); external name '_DisableAllMenuItems';
  4109. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4110. {
  4111. * EnableAllMenuItems()
  4112. *
  4113. * Summary:
  4114. * Enables all items in a menu.
  4115. *
  4116. * Discussion:
  4117. * This API is equivalent to pre-Carbon code that or'd the
  4118. * enableFlags field of the MenuInfo with 0xFFFFFFFE. It enables all
  4119. * items (including items past item 31) but does not affect the
  4120. * state of the menu title.
  4121. *
  4122. * Mac OS X threading:
  4123. * Not thread safe
  4124. *
  4125. * Parameters:
  4126. *
  4127. * theMenu:
  4128. * The menu whose items to enable.
  4129. *
  4130. * Availability:
  4131. * Mac OS X: in version 10.0 and later in Carbon.framework
  4132. * CarbonLib: in CarbonLib 1.0 and later
  4133. * Non-Carbon CFM: not available
  4134. }
  4135. procedure EnableAllMenuItems( theMenu: MenuRef ); external name '_EnableAllMenuItems';
  4136. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4137. {
  4138. * MenuHasEnabledItems()
  4139. *
  4140. * Summary:
  4141. * Determines if any items in a menu are enabled.
  4142. *
  4143. * Discussion:
  4144. * This API is equivalent to pre-Carbon code that compared the
  4145. * enableFlags field of the MenuInfo with 0. It checks the enable
  4146. * state of all items to see if any are enabled, but ignores the
  4147. * state of the menu title. It will return true even if the menu
  4148. * title is disabled.
  4149. *
  4150. * Mac OS X threading:
  4151. * Not thread safe
  4152. *
  4153. * Parameters:
  4154. *
  4155. * theMenu:
  4156. * The menu whose items to examine.
  4157. *
  4158. * Availability:
  4159. * Mac OS X: in version 10.0 and later in Carbon.framework
  4160. * CarbonLib: in CarbonLib 1.0 and later
  4161. * Non-Carbon CFM: not available
  4162. }
  4163. function MenuHasEnabledItems( theMenu: MenuRef ): Boolean; external name '_MenuHasEnabledItems';
  4164. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4165. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4166. { ¥ Menu tracking status (Carbon and later) }
  4167. { Get info about the selected menu item during menu tracking. Replaces direct access }
  4168. { to low-mem globals that previously held this info. }
  4169. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4170. {
  4171. * GetMenuTrackingData()
  4172. *
  4173. * Summary:
  4174. * Gets information about the menu currently selected by the user.
  4175. *
  4176. * Discussion:
  4177. * This API replaces direct access to the low-memory globals
  4178. * TopMenuItem, AtMenuBottom, MenuDisable, and mbSaveLoc. It is only
  4179. * valid to call this API while menu tracking is occurring. This API
  4180. * will most commonly be used by custom MDEFs.
  4181. *
  4182. * Mac OS X threading:
  4183. * Not thread safe
  4184. *
  4185. * Parameters:
  4186. *
  4187. * theMenu:
  4188. * The menu about which to get tracking information. May be NULL
  4189. * to get information about the menu that the user is currently
  4190. * selecting. If the menu is not currently open, menuNotFoundErr
  4191. * is returned.
  4192. *
  4193. * outData:
  4194. * On exit, contains tracking data about the menu. On CarbonLib,
  4195. * the itemRect field is not supported and is always set to an
  4196. * empty rect.
  4197. *
  4198. * Availability:
  4199. * Mac OS X: in version 10.0 and later in Carbon.framework
  4200. * CarbonLib: in CarbonLib 1.0 and later
  4201. * Non-Carbon CFM: not available
  4202. }
  4203. function GetMenuTrackingData( theMenu: MenuRef; var outData: MenuTrackingData ): OSStatus; external name '_GetMenuTrackingData';
  4204. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4205. {
  4206. * GetMenuType()
  4207. *
  4208. * Summary:
  4209. * Gets the display type (pulldown, hierarchical, or popup) of a
  4210. * menu.
  4211. *
  4212. * Discussion:
  4213. * This API may only be called when the menu is displayed. If the
  4214. * menu is not currently open, an error is returned. The display
  4215. * type of a menu may vary from one menu tracking session to
  4216. * another; for example, the same menu might be displayed as a
  4217. * pulldown menu and as a popup menu.
  4218. *
  4219. * Mac OS X threading:
  4220. * Not thread safe
  4221. *
  4222. * Parameters:
  4223. *
  4224. * theMenu:
  4225. * The menu whose type to get.
  4226. *
  4227. * outType:
  4228. * On exit, the type of the menu. The returned value will be one
  4229. * of the ThemeMenuType constants: kThemeMenuTypePullDown, PopUp,
  4230. * or Hierarchical. The kThemeMenuTypeInactive bit will never be
  4231. * set.
  4232. *
  4233. * Availability:
  4234. * Mac OS X: in version 10.0 and later in Carbon.framework
  4235. * CarbonLib: in CarbonLib 1.1 and later
  4236. * Non-Carbon CFM: not available
  4237. }
  4238. function GetMenuType( theMenu: MenuRef; var outType: UInt16 ): OSStatus; external name '_GetMenuType';
  4239. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4240. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4241. { ¥ÊUniversal command ID access (Carbon and later) }
  4242. { These APIs allow you to operate on menu items strictly by command ID, with no }
  4243. { knowledge of a menu item's index. }
  4244. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4245. {
  4246. * CountMenuItemsWithCommandID()
  4247. *
  4248. * Summary:
  4249. * Counts the menu items with a specified command ID.
  4250. *
  4251. * Discussion:
  4252. * In CarbonLib 1.0.x and 1.1, this API always returns zero or one;
  4253. * it stops after finding the first menu item with the specified
  4254. * command ID. In CarbonLib 1.2 and Mac OS X 10.0 and later, it
  4255. * counts all menu items with the specified command ID. In Mac OS X
  4256. * 10.0 and CarbonLib 1.0 through 1.4, this API only searches
  4257. * top-level menus (menus visible in the menubar) and submenus of
  4258. * top-level menus. It does not search hierarchical menus that are
  4259. * inserted in the menubar but are not submenus of a top-level menus
  4260. * (for example, it does not search menus that are inserted for use
  4261. * in a popup menu control). In Mac OS X 10.1 and CarbonLib 1.5 and
  4262. * later, this API also searches inserted hierarchical menus.
  4263. *
  4264. * Mac OS X threading:
  4265. * Not thread safe
  4266. *
  4267. * Parameters:
  4268. *
  4269. * inMenu:
  4270. * The menu in which to begin searching for items with the
  4271. * specified command ID. Pass NULL to hegin searching with the
  4272. * root menu. The search will descend into all submenus of this
  4273. * menu.
  4274. *
  4275. * inCommandID:
  4276. * The command ID for which to search.
  4277. *
  4278. * Availability:
  4279. * Mac OS X: in version 10.0 and later in Carbon.framework
  4280. * CarbonLib: in CarbonLib 1.0 and later
  4281. * Non-Carbon CFM: not available
  4282. }
  4283. function CountMenuItemsWithCommandID( inMenu: MenuRef; inCommandID: MenuCommand ): ItemCount; external name '_CountMenuItemsWithCommandID';
  4284. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4285. {
  4286. * GetIndMenuItemWithCommandID()
  4287. *
  4288. * Summary:
  4289. * Finds a menu item with a specified command ID.
  4290. *
  4291. * Discussion:
  4292. * This API searches the specified menu and its submenus for the
  4293. * n'th menu item with the specified command ID. In CarbonLib 1.0.x
  4294. * and 1.1, only the first menu item is returned. In CarbonLib 1.2
  4295. * and Mac OS X 10.0 and later, this API iterates over all menu
  4296. * items with the specified command ID. In Mac OS X 10.0 and
  4297. * CarbonLib 1.0 through 1.4, this API only searches top-level menus
  4298. * (menus visible in the menubar) and submenus of top-level menus.
  4299. * It does not search hierarchical menus that are inserted in the
  4300. * menubar but are not submenus of a top-level menus (for example,
  4301. * it does not search menus that are inserted for use in a popup
  4302. * menu control). In Mac OS X 10.1 and CarbonLib 1.5 and later, this
  4303. * API also searches inserted hierarchical menus.
  4304. *
  4305. * Mac OS X threading:
  4306. * Not thread safe
  4307. *
  4308. * Parameters:
  4309. *
  4310. * inMenu:
  4311. * The menu in which to begin searching for items with the
  4312. * specified command ID. Pass NULL to hegin searching with the
  4313. * root menu. The search will descend into all submenus of this
  4314. * menu.
  4315. *
  4316. * inCommandID:
  4317. * The command ID for which to search.
  4318. *
  4319. * inItemIndex:
  4320. * The 1-based index of the menu item to retrieve. In CarbonLib
  4321. * 1.0.x and 1.1, this parameter must be 1. In CarbonLib 1.2 and
  4322. * Mac OS X 10.0, this parameter may vary from 1 to the number of
  4323. * menu items with the specified command ID.
  4324. *
  4325. * outMenu:
  4326. * On exit, the menu containing the menu item with the specified
  4327. * command ID.
  4328. *
  4329. * outIndex:
  4330. * On exit, the item index of the menu item with the specified
  4331. * command ID.
  4332. *
  4333. * Availability:
  4334. * Mac OS X: in version 10.0 and later in Carbon.framework
  4335. * CarbonLib: in CarbonLib 1.0 and later
  4336. * Non-Carbon CFM: not available
  4337. }
  4338. function GetIndMenuItemWithCommandID( inMenu: MenuRef; inCommandID: MenuCommand; inItemIndex: UInt32; outMenu: MenuRefPtr { can be NULL }; outIndex: MenuItemIndexPtr { can be NULL } ): OSStatus; external name '_GetIndMenuItemWithCommandID';
  4339. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4340. {
  4341. * EnableMenuCommand()
  4342. *
  4343. * Summary:
  4344. * Enables the menu item with a specified command ID.
  4345. *
  4346. * Mac OS X threading:
  4347. * Not thread safe
  4348. *
  4349. * Parameters:
  4350. *
  4351. * inMenu:
  4352. * The menu in which to begin searching for the item. Pass NULL to
  4353. * begin searching with the root menu. The search will descend
  4354. * into all submenus of this menu.
  4355. *
  4356. * inCommandID:
  4357. * The command ID of the menu item to be enabled. If more than one
  4358. * item has this command ID, only the first will be enabled.
  4359. *
  4360. * Availability:
  4361. * Mac OS X: in version 10.0 and later in Carbon.framework
  4362. * CarbonLib: in CarbonLib 1.0 and later
  4363. * Non-Carbon CFM: not available
  4364. }
  4365. procedure EnableMenuCommand( inMenu: MenuRef; inCommandID: MenuCommand ); external name '_EnableMenuCommand';
  4366. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4367. {
  4368. * DisableMenuCommand()
  4369. *
  4370. * Summary:
  4371. * Disables the menu item with a specified command ID.
  4372. *
  4373. * Mac OS X threading:
  4374. * Not thread safe
  4375. *
  4376. * Parameters:
  4377. *
  4378. * inMenu:
  4379. * The menu in which to begin searching for the item. Pass NULL to
  4380. * begin searching with the root menu. The search will descend
  4381. * into all submenus of this menu.
  4382. *
  4383. * inCommandID:
  4384. * The command ID of the menu item to be disabled. If more than
  4385. * one item has this command ID, only the first will be disabled.
  4386. *
  4387. * Availability:
  4388. * Mac OS X: in version 10.0 and later in Carbon.framework
  4389. * CarbonLib: in CarbonLib 1.0 and later
  4390. * Non-Carbon CFM: not available
  4391. }
  4392. procedure DisableMenuCommand( inMenu: MenuRef; inCommandID: MenuCommand ); external name '_DisableMenuCommand';
  4393. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4394. {
  4395. * IsMenuCommandEnabled()
  4396. *
  4397. * Summary:
  4398. * Determines if the menu item with a specified command ID is
  4399. * enabled.
  4400. *
  4401. * Mac OS X threading:
  4402. * Not thread safe
  4403. *
  4404. * Parameters:
  4405. *
  4406. * inMenu:
  4407. * The menu in which to begin searching for the item. Pass NULL to
  4408. * begin searching with the root menu. The search will descend
  4409. * into all submenus of this menu.
  4410. *
  4411. * inCommandID:
  4412. * The command ID of the menu item to examine. If more than one
  4413. * item has this command ID, only the first will be examined.
  4414. *
  4415. * Availability:
  4416. * Mac OS X: in version 10.0 and later in Carbon.framework
  4417. * CarbonLib: in CarbonLib 1.0 and later
  4418. * Non-Carbon CFM: not available
  4419. }
  4420. function IsMenuCommandEnabled( inMenu: MenuRef; inCommandID: MenuCommand ): Boolean; external name '_IsMenuCommandEnabled';
  4421. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4422. {
  4423. * SetMenuCommandMark()
  4424. *
  4425. * Summary:
  4426. * Locates the menu item with a specified command ID and sets its
  4427. * mark character.
  4428. *
  4429. * Mac OS X threading:
  4430. * Not thread safe
  4431. *
  4432. * Parameters:
  4433. *
  4434. * inMenu:
  4435. * The menu in which to begin searching for the item. Pass NULL to
  4436. * begin searching with the root menu. The search will descend
  4437. * into all submenus of this menu.
  4438. *
  4439. * inCommandID:
  4440. * The command ID of the menu item to be modified. If more than
  4441. * one item has this command ID, only the first will be modified.
  4442. *
  4443. * inMark:
  4444. * The new mark character. Although the type of this parameter is
  4445. * UniChar, currently only the low byte of this character will be
  4446. * used as the mark character, and it is interpreted using the
  4447. * applicationÕs text encoding.
  4448. *
  4449. * Availability:
  4450. * Mac OS X: in version 10.0 and later in Carbon.framework
  4451. * CarbonLib: in CarbonLib 1.1 and later
  4452. * Non-Carbon CFM: not available
  4453. }
  4454. function SetMenuCommandMark( inMenu: MenuRef; inCommandID: MenuCommand; inMark: UniChar ): OSStatus; external name '_SetMenuCommandMark';
  4455. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4456. {
  4457. * GetMenuCommandMark()
  4458. *
  4459. * Summary:
  4460. * Locates the menu item with a specified command ID and returns its
  4461. * mark character.
  4462. *
  4463. * Mac OS X threading:
  4464. * Not thread safe
  4465. *
  4466. * Parameters:
  4467. *
  4468. * inMenu:
  4469. * The menu in which to begin searching for the item. Pass NULL to
  4470. * begin searching with the root menu. The search will descend
  4471. * into all submenus of this menu.
  4472. *
  4473. * inCommandID:
  4474. * The command ID of the menu item to be examined. If more than
  4475. * one item has this command ID, only the first will be examined.
  4476. *
  4477. * outMark:
  4478. * On exit, the menu item's mark character.
  4479. *
  4480. * Availability:
  4481. * Mac OS X: in version 10.0 and later in Carbon.framework
  4482. * CarbonLib: in CarbonLib 1.1 and later
  4483. * Non-Carbon CFM: not available
  4484. }
  4485. function GetMenuCommandMark( inMenu: MenuRef; inCommandID: MenuCommand; var outMark: UniChar ): OSStatus; external name '_GetMenuCommandMark';
  4486. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4487. {
  4488. * GetMenuCommandProperty()
  4489. *
  4490. * Summary:
  4491. * Retrives property data for a menu item with a specified command
  4492. * ID.
  4493. *
  4494. * Mac OS X threading:
  4495. * Not thread safe
  4496. *
  4497. * Parameters:
  4498. *
  4499. * inMenu:
  4500. * The menu in which to begin searching for the item. Pass NULL to
  4501. * begin searching with the root menu. The search will descend
  4502. * into all submenus of this menu.
  4503. *
  4504. * inCommandID:
  4505. * The command ID of the menu item containing the property. If
  4506. * more than one item has this command ID, only the first will be
  4507. * used.
  4508. *
  4509. * inPropertyCreator:
  4510. * The property creator.
  4511. *
  4512. * inPropertyTag:
  4513. * The property tag.
  4514. *
  4515. * inBufferSize:
  4516. * The size of the output buffer, in bytes.
  4517. *
  4518. * outActualSize:
  4519. * On exit, contains the actual size of the property data. May be
  4520. * NULL if you do not need this information.
  4521. *
  4522. * inPropertyBuffer:
  4523. * The address of a buffer in which to place the property data.
  4524. *
  4525. * Availability:
  4526. * Mac OS X: in version 10.0 and later in Carbon.framework
  4527. * CarbonLib: in CarbonLib 1.0 and later
  4528. * Non-Carbon CFM: not available
  4529. }
  4530. function GetMenuCommandProperty( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; inBufferSize: ByteCount; outActualSize: ByteCountPtr { can be NULL }; inPropertyBuffer: UnivPtr ): OSStatus; external name '_GetMenuCommandProperty';
  4531. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4532. {
  4533. * GetMenuCommandPropertySize()
  4534. *
  4535. * Summary:
  4536. * Retrives the size of property data for a menu item with a
  4537. * specified command ID.
  4538. *
  4539. * Mac OS X threading:
  4540. * Not thread safe
  4541. *
  4542. * Parameters:
  4543. *
  4544. * inMenu:
  4545. * The menu in which to begin searching for the item. Pass NULL to
  4546. * begin searching with the root menu. The search will descend
  4547. * into all submenus of this menu.
  4548. *
  4549. * inCommandID:
  4550. * The command ID of the menu item containing the property. If
  4551. * more than one item has this command ID, only the first will be
  4552. * used.
  4553. *
  4554. * inPropertyCreator:
  4555. * The property creator.
  4556. *
  4557. * inPropertyTag:
  4558. * The property tag.
  4559. *
  4560. * outSize:
  4561. * On exit, contains the size of the property data.
  4562. *
  4563. * Availability:
  4564. * Mac OS X: in version 10.0 and later in Carbon.framework
  4565. * CarbonLib: in CarbonLib 1.0 and later
  4566. * Non-Carbon CFM: not available
  4567. }
  4568. function GetMenuCommandPropertySize( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; var outSize: ByteCount ): OSStatus; external name '_GetMenuCommandPropertySize';
  4569. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4570. {
  4571. * SetMenuCommandProperty()
  4572. *
  4573. * Summary:
  4574. * Sets property data for a menu item with a specified command ID.
  4575. *
  4576. * Mac OS X threading:
  4577. * Not thread safe
  4578. *
  4579. * Parameters:
  4580. *
  4581. * inMenu:
  4582. * The menu in which to begin searching for the item. Pass NULL to
  4583. * begin searching with the root menu. The search will descend
  4584. * into all submenus of this menu.
  4585. *
  4586. * inCommandID:
  4587. * The command ID of the menu item that will receive the property.
  4588. * If more than one item has this command ID, only the first will
  4589. * be modified.
  4590. *
  4591. * inPropertyCreator:
  4592. * The property creator.
  4593. *
  4594. * inPropertyTag:
  4595. * The property tag.
  4596. *
  4597. * inPropertySize:
  4598. * The size of the property data, in bytes.
  4599. *
  4600. * inPropertyData:
  4601. * The address of the property data.
  4602. *
  4603. * Availability:
  4604. * Mac OS X: in version 10.0 and later in Carbon.framework
  4605. * CarbonLib: in CarbonLib 1.0 and later
  4606. * Non-Carbon CFM: not available
  4607. }
  4608. function SetMenuCommandProperty( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; inPropertySize: ByteCount; inPropertyData: {const} UnivPtr ): OSStatus; external name '_SetMenuCommandProperty';
  4609. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4610. {
  4611. * RemoveMenuCommandProperty()
  4612. *
  4613. * Summary:
  4614. * Removes a property from a menu item with a specified command ID.
  4615. *
  4616. * Mac OS X threading:
  4617. * Not thread safe
  4618. *
  4619. * Parameters:
  4620. *
  4621. * inMenu:
  4622. * The menu in which to begin searching for the item. Pass NULL to
  4623. * begin searching with the root menu. The search will descend
  4624. * into all submenus of this menu.
  4625. *
  4626. * inCommandID:
  4627. * The command ID of the menu item from which the property will be
  4628. * removed. If more than one item has this command ID, only the
  4629. * first will be modified.
  4630. *
  4631. * inPropertyCreator:
  4632. * The property creator.
  4633. *
  4634. * inPropertyTag:
  4635. * The property tag.
  4636. *
  4637. * Availability:
  4638. * Mac OS X: in version 10.0 and later in Carbon.framework
  4639. * CarbonLib: in CarbonLib 1.0 and later
  4640. * Non-Carbon CFM: not available
  4641. }
  4642. function RemoveMenuCommandProperty( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType ): OSStatus; external name '_RemoveMenuCommandProperty';
  4643. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4644. {
  4645. * CopyMenuItemData()
  4646. *
  4647. * Summary:
  4648. * Returns multiple attributes of a menu item at once.
  4649. *
  4650. * Discussion:
  4651. * This function is used to retrieve many attributes of a menu item
  4652. * simultaneously; for example, it might be used by a menu
  4653. * definition function that needs to know how to draw a menu item.
  4654. * It is more efficient to use this function than to use the
  4655. * accessor functions for the individual attributes of the menu.
  4656. * This function returns a copy of the data in the menu, so any data
  4657. * in the MenuItemDataRec that is dynamically allocated (for
  4658. * example, the CFString item text) should be released by the caller.
  4659. *
  4660. * Mac OS X threading:
  4661. * Not thread safe
  4662. *
  4663. * Parameters:
  4664. *
  4665. * inMenu:
  4666. * The menu from which to copy data. If inIsCommandID is true, you
  4667. * may pass NULL for this parameter to search for an item in the
  4668. * root menu; if inIsCommandID is false, this parameter must be a
  4669. * valid MenuRef.
  4670. *
  4671. * inItem:
  4672. * The item or command ID from which to copy data.
  4673. *
  4674. * inIsCommandID:
  4675. * Indicates whether inItem is a MenuItemIndex or MenuCommand. If
  4676. * inIsCommandID is true, the inItem parameter is interpreted as a
  4677. * menu command ID, and data is copied from the first item in the
  4678. * menu with that command ID. If inIsCommandID is false, the
  4679. * inItem parameter is interpreted as a menu item index, and data
  4680. * is copied for that item in the specified menu.
  4681. *
  4682. * ioData:
  4683. * Data is copied from the item and placed here. On entry, the
  4684. * whichData field of this structure should be initialized to
  4685. * indicate which data the caller would like returned. Individual
  4686. * fields of the MenuItemDataRec structure may require
  4687. * pre-initialization also; see the individual MenuItemDataFlags
  4688. * documentation for details.
  4689. *
  4690. * Availability:
  4691. * Mac OS X: in version 10.0 and later in Carbon.framework
  4692. * CarbonLib: in CarbonLib 1.1 and later
  4693. * Non-Carbon CFM: not available
  4694. }
  4695. function CopyMenuItemData( inMenu: MenuRef { can be NULL }; inItem: MenuItemID; inIsCommandID: Boolean; ioData: MenuItemDataPtr ): OSStatus; external name '_CopyMenuItemData';
  4696. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4697. {
  4698. * SetMenuItemData()
  4699. *
  4700. * Summary:
  4701. * Sets multiple attributes of a menu item at once.
  4702. *
  4703. * Discussion:
  4704. * This function is used to set many attributes of a menu item
  4705. * simultaneously. It is more efficient to use this function than to
  4706. * use the accessor functions for the individual attributes of the
  4707. * menu.
  4708. *
  4709. * Mac OS X threading:
  4710. * Not thread safe
  4711. *
  4712. * Parameters:
  4713. *
  4714. * inMenu:
  4715. * The menu to modify.
  4716. *
  4717. * inItem:
  4718. * The item or command ID to modify.
  4719. *
  4720. * inIsCommandID:
  4721. * Indicates whether inItem is a MenuItemIndex or MenuCommand. If
  4722. * inIsCommandID is true, the inItem parameter is interpreted as a
  4723. * menu command ID, and the first item in the menu with that
  4724. * command ID. is modified. If inIsCommandID is false, the inItem
  4725. * parameter is interpreted as a menu item index, and the item
  4726. * with that index in the specified menu is modified.
  4727. *
  4728. * inData:
  4729. * The data to set. The caller should set the whichData field of
  4730. * this structure to indicate which data should be set. Only the
  4731. * fields of the structure corresponding to the non-zero whichData
  4732. * flags must be initialized; other fields are ignored.
  4733. *
  4734. * Availability:
  4735. * Mac OS X: in version 10.0 and later in Carbon.framework
  4736. * CarbonLib: in CarbonLib 1.1 and later
  4737. * Non-Carbon CFM: not available
  4738. }
  4739. function SetMenuItemData( inMenu: MenuRef; inItem: MenuItemID; inIsCommandID: Boolean; const (*var*) inData: MenuItemDataRec ): OSStatus; external name '_SetMenuItemData';
  4740. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4741. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4742. { ¥ Dynamic menu item support (available in CarbonLib 1.1 and Mac OS X) }
  4743. { Dynamic menu item support allows a menu item to be redrawn while the menu is open }
  4744. { and visible to the user. Carbon contains automatic support for dynamic items based }
  4745. { on keyboard modifier state. If you need to implement your own variable item state }
  4746. { based on other system state, you can use these APIs to implement it. }
  4747. { To use the built-in support for dynamic items, you should create a menu containing }
  4748. { several contiguous items with the same command key but different text and modifier }
  4749. { keys. For example, you might have: }
  4750. { Close cmd-W }
  4751. { Close All cmd-option-W }
  4752. { The Menu Manager automatically determines a dynamic menu group using the base }
  4753. { command key of a dynamic menu item ('W' in this case). Only a single item from }
  4754. { a dynamic group is visible at any time; the other items are hidden. The Menu }
  4755. { Manager uses the current keyboard modifiers to determine which item is visible. }
  4756. { It is also possible to have a dynamic menu item group that does not have command }
  4757. { keys, but only modifiers; for example, in the Finder's View menu, the Clean Up }
  4758. { and Clean Up Selection items have no command key, but are a dynamic menu item }
  4759. { group that changes visibility based on the Option modifier key. }
  4760. { In this example, in your MENU resource, you would create the Close and Close All }
  4761. { items and give them each the letter 'W' as the command key; using an associated }
  4762. { xmnu resource, you would specify kMenuOptionModifier as the modifier for the }
  4763. { Close All item. You can do the same thing using InterfacerBuilder and nib-based }
  4764. { menus. }
  4765. { After loading your menu from the resource, you must set the kMenuItemAttrDynamic }
  4766. { flag for each dynamic item. In this example, you would use: }
  4767. { ChangeMenuItemAttributes( menu, kCloseItem, kMenuItemAttrDynamic, 0 ); }
  4768. { ChangeMenuItemAttributes( menu, kCloseAllItem, kMenuItemAttrDynamic, 0 ); }
  4769. { The Menu Manager will now automatically display the correct item depending on }
  4770. { whether the Option key is pressed. The result from MenuSelect will be the item }
  4771. { number of the item that was visible when the menu closed. }
  4772. { Note that: }
  4773. { - If you use InterfacerBuilder, you can set the kMenuItemAttrDynamic attribute }
  4774. { directly in the menu object in the nib, using the Inspector window for the }
  4775. { menu. You don't need to add the attribute after creating the menu. }
  4776. { - If your application requires Mac OS X 10.2 or CarbonLib 1.6 or later, you }
  4777. { can also use a version-one-format 'xmnu' resource, which allows settting }
  4778. { the menu item attributes in the 'xmnu'. Using a version one resource, you }
  4779. { can include the kMenuItemAttrDynamic attribute in the resource rather than }
  4780. { adding it after creating the menu. }
  4781. { If the Menu Manager's built-in support is not sufficient, you can also change the }
  4782. { attributes of an item yourself and use the UpdateInvalidMenuItems API to cause }
  4783. { the menu to redraw. Changes to a menu item (changing text, command key, style, }
  4784. { etc.) that occur while the menu is open will cause the menu item to be invalidated, }
  4785. { but not redrawn. If you need to invalidate the item explicitly yourself, perhaps }
  4786. { because you have a custom MDEF that depends on state not accessed using Menu }
  4787. { Manager APIs, you can use the InvalidateMenuItems API. UpdateInvalidMenuItems will }
  4788. { scan the menu for invalid items and redraw each, clearing its invalid flag }
  4789. { afterwards. }
  4790. { If you need to change menu contents based on modifier key state without using the }
  4791. { built-in support in the Menu Manager, we recommend that you install a Carbon event }
  4792. { handler on your menu for the [kEventClassKeyboard, kEventRawKeyModifiersChanged] }
  4793. { event. Modifier key events are passed to the currently open menu before being sent }
  4794. { to the user focus target. }
  4795. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4796. {
  4797. * IsMenuItemInvalid()
  4798. *
  4799. * Summary:
  4800. * Determines if a menu item is invalid and should be redrawn.
  4801. *
  4802. * Mac OS X threading:
  4803. * Not thread safe
  4804. *
  4805. * Parameters:
  4806. *
  4807. * inMenu:
  4808. * The menu whose item to examine.
  4809. *
  4810. * inItem:
  4811. * The item to examine.
  4812. *
  4813. * Availability:
  4814. * Mac OS X: in version 10.0 and later in Carbon.framework
  4815. * CarbonLib: in CarbonLib 1.1 and later
  4816. * Non-Carbon CFM: not available
  4817. }
  4818. function IsMenuItemInvalid( inMenu: MenuRef; inItem: MenuItemIndex ): Boolean; external name '_IsMenuItemInvalid';
  4819. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4820. {
  4821. * InvalidateMenuItems()
  4822. *
  4823. * Summary:
  4824. * Invalidates a group of menu items so that they will be redrawn
  4825. * when UpdateInvalidMenuItems is next called.
  4826. *
  4827. * Discussion:
  4828. * Menu items are automatically invalidated when their contents are
  4829. * changed using Menu Manager APIs while the menu is open. However,
  4830. * you might need to use this API if you have a custom MDEF that
  4831. * draws using state not contained in the menu.
  4832. *
  4833. * Mac OS X threading:
  4834. * Not thread safe
  4835. *
  4836. * Parameters:
  4837. *
  4838. * inMenu:
  4839. * The menu whose items to invalidate.
  4840. *
  4841. * inFirstItem:
  4842. * The first item to invalidate.
  4843. *
  4844. * inNumItems:
  4845. * The number of items to invalidate.
  4846. *
  4847. * Availability:
  4848. * Mac OS X: in version 10.0 and later in Carbon.framework
  4849. * CarbonLib: in CarbonLib 1.1 and later
  4850. * Non-Carbon CFM: not available
  4851. }
  4852. function InvalidateMenuItems( inMenu: MenuRef; inFirstItem: MenuItemIndex; inNumItems: ItemCount ): OSStatus; external name '_InvalidateMenuItems';
  4853. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4854. {
  4855. * UpdateInvalidMenuItems()
  4856. *
  4857. * Summary:
  4858. * Redraws the invalid items of an open menu.
  4859. *
  4860. * Discussion:
  4861. * It is not necessary to use UpdateInvalidMenuItems if you are
  4862. * using Carbon's built-in support for dynamic items based on
  4863. * modifier key state. However, if you are modifying items
  4864. * dynamically using your own implementation, you should call
  4865. * UpdateInvalidMenuItems after completing your modifications for a
  4866. * single menu. It will redraw any items that have been marked as
  4867. * invalid, and clear the invalid flag for those items.
  4868. *
  4869. * Mac OS X threading:
  4870. * Not thread safe
  4871. *
  4872. * Parameters:
  4873. *
  4874. * inMenu:
  4875. * The menu to update.
  4876. *
  4877. * Availability:
  4878. * Mac OS X: in version 10.0 and later in Carbon.framework
  4879. * CarbonLib: in CarbonLib 1.1 and later
  4880. * Non-Carbon CFM: not available
  4881. }
  4882. function UpdateInvalidMenuItems( inMenu: MenuRef ): OSStatus; external name '_UpdateInvalidMenuItems';
  4883. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4884. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4885. { ¥ÊStandard font menu (Carbon and later) }
  4886. { These APIs allow you to create and use the standard font menu. }
  4887. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4888. const
  4889. kHierarchicalFontMenuOption = $00000001;
  4890. {
  4891. * CreateStandardFontMenu()
  4892. *
  4893. * Mac OS X threading:
  4894. * Not thread safe
  4895. *
  4896. * Availability:
  4897. * Mac OS X: in version 10.0 and later in Carbon.framework
  4898. * CarbonLib: in CarbonLib 1.0 and later
  4899. * Non-Carbon CFM: not available
  4900. }
  4901. function CreateStandardFontMenu( menu: MenuRef; afterItem: MenuItemIndex; firstHierMenuID: MenuID; options: OptionBits; outHierMenuCount: ItemCountPtr { can be NULL } ): OSStatus; external name '_CreateStandardFontMenu';
  4902. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4903. {
  4904. * UpdateStandardFontMenu()
  4905. *
  4906. * Mac OS X threading:
  4907. * Not thread safe
  4908. *
  4909. * Availability:
  4910. * Mac OS X: in version 10.0 and later in Carbon.framework
  4911. * CarbonLib: in CarbonLib 1.0 and later
  4912. * Non-Carbon CFM: not available
  4913. }
  4914. function UpdateStandardFontMenu( menu: MenuRef; outHierMenuCount: ItemCountPtr { can be NULL } ): OSStatus; external name '_UpdateStandardFontMenu';
  4915. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4916. {
  4917. * GetFontFamilyFromMenuSelection()
  4918. *
  4919. * Mac OS X threading:
  4920. * Not thread safe
  4921. *
  4922. * Availability:
  4923. * Mac OS X: in version 10.0 and later in Carbon.framework
  4924. * CarbonLib: in CarbonLib 1.0 and later
  4925. * Non-Carbon CFM: not available
  4926. }
  4927. function GetFontFamilyFromMenuSelection( menu: MenuRef; item: MenuItemIndex; var outFontFamily: FMFontFamily; var outStyle: FMFontStyle ): OSStatus; external name '_GetFontFamilyFromMenuSelection';
  4928. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4929. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4930. { ¥ Contextual Menu routines and constants }
  4931. { available with Conxtextual Menu extension 1.0 and later }
  4932. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4933. { Gestalt Selector for classic 68K apps only. }
  4934. { CFM apps should weak link and check the symbols. }
  4935. const
  4936. gestaltContextualMenuAttr = $636D6E75 (* 'cmnu' *);
  4937. gestaltContextualMenuUnusedBit = 0;
  4938. gestaltContextualMenuTrapAvailable = 1;
  4939. gestaltContextualMenuHasAttributeAndModifierKeys = 2; { Contextual Menu Manager supports keyContextualMenuAttributes and keyContextualMenuModifiers }
  4940. gestaltContextualMenuHasUnicodeSupport = 3; { Contextual Menu Manager supports typeUnicodeText and typeCFStringRef }
  4941. {
  4942. * Summary:
  4943. * Values indicating what kind of help the application supports
  4944. }
  4945. const
  4946. {
  4947. * The application does not support any help. The Menu Manager will
  4948. * put an appropriate help string into the contextual menu and
  4949. * disable the Help item.
  4950. }
  4951. kCMHelpItemNoHelp = 0;
  4952. {
  4953. * The application supports Apple Guide help. The Menu Manager will
  4954. * put the name of the main Guide file into the contextual menu and
  4955. * enable the Help item.
  4956. }
  4957. kCMHelpItemAppleGuide = 1;
  4958. {
  4959. * The application supports some other form of help. In this case,
  4960. * the application must also pass a valid string into the
  4961. * inHelpItemString parameter of ContextualMenuSelect. This string
  4962. * will be the text of the Help item in the contextual menu, and the
  4963. * Help item will be enabled.
  4964. }
  4965. kCMHelpItemOtherHelp = 2;
  4966. {
  4967. * The application does not support any help. The Menu Manager will
  4968. * remove the Help item from the contextual menu. This constant is
  4969. * available in Mac OS X and CarbonLib 1.6, and later; however, in
  4970. * CarbonLib it is translated to kCMHelpItemNoHelp, and the Help item
  4971. * is only disabled, not removed.
  4972. }
  4973. kCMHelpItemRemoveHelp = 3;
  4974. {
  4975. * Summary:
  4976. * Values indicating what was chosen from a contextual menu
  4977. }
  4978. const
  4979. {
  4980. * The user did not choose an item from the contextual menu and the
  4981. * application should do no further processing of the event.
  4982. }
  4983. kCMNothingSelected = 0;
  4984. {
  4985. * The user chose one of the application's items from the menu. The
  4986. * application can examine the outMenuID and outMenuItem parameters
  4987. * of ContextualMenuSelect to see what the menu selection was, and it
  4988. * should then handle the selection appropriately.
  4989. }
  4990. kCMMenuItemSelected = 1;
  4991. {
  4992. * The user chose the Help item from the menu. The application should
  4993. * open an Apple Guide database to a section appropriate for the
  4994. * selection. If the application supports some other form of help, it
  4995. * should be presented instead.
  4996. }
  4997. kCMShowHelpSelected = 3;
  4998. {
  4999. * Summary:
  5000. * AERecord keywords used by the ExamineContext method of a
  5001. * Contextual Menu plugin to specify menu item contents.
  5002. }
  5003. const
  5004. {
  5005. * Specifies the text of an item in a contextual menu. Data for this
  5006. * parameter can be in one of several formats. In Mac OS 7/8/9.x and
  5007. * Mac OS X 10.0 and 10.1, typeChar and typeIntlText are supported.
  5008. * In Mac OS X 10.2 and later, typeStyledText, typeAEText,
  5009. * typeUnicodeText, and typeCFStringRef are also supported. If you
  5010. * provide data as typeCFStringRef, the Contextual Menu Manager will
  5011. * automatically release the CFStringRef once the menu has been
  5012. * displayed. If you need the CFStringRef to have a longer timetime,
  5013. * your plugin should retain the CFStringRef before inserting it into
  5014. * the AERecord.
  5015. }
  5016. keyContextualMenuName = $706E616D (* 'pnam' *);
  5017. {
  5018. * Specifies the command ID of an item in a contextual menu. Data for
  5019. * this parameter should be typeLongInteger.
  5020. }
  5021. keyContextualMenuCommandID = $636D6364 (* 'cmcd' *);
  5022. {
  5023. * Specifies a contextual menu item with a submenu. Typically used
  5024. * with AEPutKeyDesc to add an entire AEDesc containing the submenu
  5025. * as the data for the parameter.
  5026. }
  5027. keyContextualMenuSubmenu = $636D7362 (* 'cmsb' *);
  5028. {
  5029. * Specifies the menu item attributes of an item in a contextual
  5030. * menu. Data for this parameter should be typeLongInteger. Available
  5031. * in Mac OS X 10.2 and later.
  5032. }
  5033. keyContextualMenuAttributes = $636D6174 (* 'cmat' *);
  5034. {
  5035. * Specifies the modifier keys of an item in a contextual menu (see
  5036. * kMenuShiftModifier, kMenuControlModifier, etc.) Data for this
  5037. * parameter should be typeLongInteger. Using this parameter together
  5038. * with the keyContextualMenuAttributes parameter, it is possible to
  5039. * create a contextual menu with dynamic items which change according
  5040. * to the modifier keys pressed by the user. Available in Mac OS X
  5041. * 10.2 and later.
  5042. }
  5043. keyContextualMenuModifiers = $636D6D64 (* 'cmmd' *);
  5044. {
  5045. * InitContextualMenus()
  5046. *
  5047. * Summary:
  5048. * Adds the current process to the system registry of contextual
  5049. * menu clients.
  5050. *
  5051. * Discussion:
  5052. * On Mac OS 8.x and 9.x, your program should call the
  5053. * InitContextualMenus function early in your startup code to
  5054. * register your application as a contextual menu client. If you do
  5055. * not register your program, some system-level functions may
  5056. * respond as though your program does not use contextual menus. Not
  5057. * registering your program may also cause
  5058. * ProcessIsContextualMenuClient to return an incorrect value. On
  5059. * Mac OS X, it is not necessary to call InitContextualMenus.
  5060. *
  5061. * Mac OS X threading:
  5062. * Not thread safe
  5063. *
  5064. * Availability:
  5065. * Mac OS X: in version 10.0 and later in Carbon.framework
  5066. * CarbonLib: in CarbonLib 1.0 and later
  5067. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  5068. }
  5069. function InitContextualMenus: OSStatus; external name '_InitContextualMenus';
  5070. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5071. {
  5072. * IsShowContextualMenuClick()
  5073. *
  5074. * Summary:
  5075. * Determines whether a particular EventRecord could invoke a
  5076. * contextual menu.
  5077. *
  5078. * Discussion:
  5079. * Applications should call IsShowContextualMenuClick when they
  5080. * receive non-null events. If IsShowContextualMenuClick returns
  5081. * true, your application should generate its own menu and Apple
  5082. * Event descriptor (AEDesc), and then call ContextualMenuSelect to
  5083. * display and track the contextual menu, and then handle the user's
  5084. * choice. Some users may choose to use a two-button mouse with
  5085. * their Macintosh computer. This API does not return true for a
  5086. * right-click unless the mouse manufacturer has provided driver
  5087. * software that returns a control-left click in place of a right
  5088. * click. For proper recognition of a right-click gesture, you must
  5089. * use the IsShowContextualMenuEvent API.
  5090. *
  5091. * Mac OS X threading:
  5092. * Not thread safe
  5093. *
  5094. * Parameters:
  5095. *
  5096. * inEvent:
  5097. * The event to examine.
  5098. *
  5099. * Result:
  5100. * Returns true if the application should display a contextual menu,
  5101. * false if not.
  5102. *
  5103. * Availability:
  5104. * Mac OS X: in version 10.0 and later in Carbon.framework
  5105. * CarbonLib: in CarbonLib 1.0 and later
  5106. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  5107. }
  5108. function IsShowContextualMenuClick( const (*var*) inEvent: EventRecord ): Boolean; external name '_IsShowContextualMenuClick';
  5109. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5110. {
  5111. * IsShowContextualMenuEvent()
  5112. *
  5113. * Summary:
  5114. * Determines whether a particular EventRef could invoke a
  5115. * contextual menu.
  5116. *
  5117. * Discussion:
  5118. * This API is similar to IsShowContextualMenuClick, but takes a
  5119. * Carbon EventRef as its parameter instead of an EventRecord.
  5120. * EventRecords cannot express a right-mouse-click, but EventRefs
  5121. * can, so this API will return true for a right- click where
  5122. * IsShowContextualMenuClick will not.
  5123. *
  5124. * In Mac OS X 10.3 and earlier, this API always returned false if
  5125. * the event kind was not kEventMouseDown,
  5126. * kEventWindowClickContentRgn, kEventWindowClickStructureRgn, or
  5127. * kEventWindowHandleContentClick. In Mac OS X 10.4 and later, this
  5128. * API no longer requires a specific event kind; it only requires
  5129. * that the event contain kEventParamMouseButton and
  5130. * kEventParamKeyModifiers parameters.
  5131. *
  5132. * Mac OS X threading:
  5133. * Not thread safe
  5134. *
  5135. * Parameters:
  5136. *
  5137. * inEvent:
  5138. * The event to examine.
  5139. *
  5140. * Result:
  5141. * Returns true if the application should display a contextual menu,
  5142. * false if not.
  5143. *
  5144. * Availability:
  5145. * Mac OS X: in version 10.0 and later in Carbon.framework
  5146. * CarbonLib: in CarbonLib 1.1 and later
  5147. * Non-Carbon CFM: not available
  5148. }
  5149. function IsShowContextualMenuEvent( inEvent: EventRef ): Boolean; external name '_IsShowContextualMenuEvent';
  5150. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5151. {
  5152. * ContextualMenuSelect()
  5153. *
  5154. * Summary:
  5155. * Displays a contextual menu.
  5156. *
  5157. * Discussion:
  5158. * If IsShowContextualMenuClick returns true, you should call the
  5159. * ContextualMenuSelect API after generating your own menu and
  5160. * preparing an Apple Event descriptor (AEDesc) that describes the
  5161. * item for which your application is displaying a contextual menu.
  5162. * This descriptor may contain an object specifier or raw data and
  5163. * will be passed to all contextual menu plug-ins. The system will
  5164. * add other items before displaying the contextual menu, and it
  5165. * will remove those items before returning, leaving the menu in its
  5166. * original state. After all the system commands are added, the
  5167. * contextual menu is displayed and tracked. If the user selects one
  5168. * of the system items, it is handled by the system and the call
  5169. * returns as though the user didn't select anything from the menu.
  5170. * If the user selects any other item (or no item at all), the Menu
  5171. * Manager passes back appropriate values in the parameters
  5172. * outUserSelectionType, outMenuID, and outMenuItem. Your
  5173. * application should provide visual feedback indicating the item
  5174. * that was clicked upon. For example, a click on an icon should
  5175. * highlight the icon, while a click on editable text should not
  5176. * eliminate the current selection. If the outUserSelectionType
  5177. * parameter contains kCMMenuItemSelected, you should look at the
  5178. * outMenuID and outMenuItem parameters to determine what menu item
  5179. * the user chose and handle it appropriately. If the user selected
  5180. * kCMHelpItemSelected, you should open the proper Apple Guide
  5181. * sequence or other form of custom help.
  5182. *
  5183. * Mac OS X threading:
  5184. * Not thread safe
  5185. *
  5186. * Parameters:
  5187. *
  5188. * inMenu:
  5189. * A menu containing application commands to display. The caller
  5190. * creates this menu based on the current context, the mouse
  5191. * location, and the current selection (if it was the target of
  5192. * the mouse). If you pass nil, only system commands will be
  5193. * displayed. The menu should be added to the menu list as a
  5194. * pop-up menu (using the InsertMenu function).
  5195. *
  5196. * inGlobalLocation:
  5197. * The location (in global coordinates) of the mouse near which
  5198. * the menu is to be displayed.
  5199. *
  5200. * inReserved:
  5201. * Reserved for future use. Pass false for this parameter.
  5202. *
  5203. * inHelpType:
  5204. * An identifier specifying the type of help to be provided by the
  5205. * application; see kCMHelpItem constants.
  5206. *
  5207. * inHelpItemString:
  5208. * A string containing the text to be displayed for the help menu
  5209. * item. This string is unused unless you also pass the constant
  5210. * kCMHelpItemOtherHelp in the inHelpType parameter.
  5211. *
  5212. * inSelection:
  5213. * An object specifier for the current selection. This allows he
  5214. * system to examine the selection and add special system commands
  5215. * accordingly. Passing a value of nil indicates that no selection
  5216. * should be examined, and most likely, no special system actions
  5217. * will be included.
  5218. *
  5219. * outUserSelectionType:
  5220. * On exit, the value indicates what the user selected from the
  5221. * contextual menu; see kCMNothingSelected, kCMMenuItemSelected,
  5222. * and kCMShowHelpSelected.
  5223. *
  5224. * outMenuID:
  5225. * On exit, if outUserSelectionType is set to kCMMenuItemSelected,
  5226. * the value is set to the menu ID of the chosen item.
  5227. *
  5228. * outMenuItem:
  5229. * On exit, if outUserSelectionType is set to kCMMenuItemSelected,
  5230. * the value is set to the menu item chosen.
  5231. *
  5232. * Result:
  5233. * An OSStatus result code. ContextualMenuSelect returns the result
  5234. * code userCanceledErr and sets outUserSelectionType to
  5235. * kCMNothingSelected to indicate that the user did not select
  5236. * anything from the contextual menu and no further processing is
  5237. * needed.
  5238. *
  5239. * Availability:
  5240. * Mac OS X: in version 10.0 and later in Carbon.framework
  5241. * CarbonLib: in CarbonLib 1.0 and later
  5242. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  5243. }
  5244. function ContextualMenuSelect( inMenu: MenuRef; inGlobalLocation: Point; inReserved: Boolean; inHelpType: UInt32; {const} inHelpItemString:ConstStringPtr { can be NULL }; {const} inSelection: AEDescPtr { can be NULL }; var outUserSelectionType: UInt32; var outMenuID: MenuID; var outMenuItem: MenuItemIndex ): OSStatus; external name '_ContextualMenuSelect';
  5245. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5246. {
  5247. * ProcessIsContextualMenuClient()
  5248. *
  5249. * Summary:
  5250. * Determines whether the specified process is a contextual menu
  5251. * client.
  5252. *
  5253. * Discussion:
  5254. * On Mac OS 9, this API consults a global table of all processes
  5255. * that have registered with the Contextual Menu Manager by calling
  5256. * InitContextualMenus. On Mac OS X, this API ignores the inPSN
  5257. * parameter and always returns whether the current process is
  5258. * registered with the Contextual Menu Manager.
  5259. *
  5260. * Mac OS X threading:
  5261. * Not thread safe
  5262. *
  5263. * Parameters:
  5264. *
  5265. * inPSN:
  5266. * The process to examine.
  5267. *
  5268. * Result:
  5269. * Whether the specified process (or, on Mac OS X, the current
  5270. * process) is registered with the Contextual Menu Manager.
  5271. *
  5272. * Availability:
  5273. * Mac OS X: in version 10.0 and later in Carbon.framework
  5274. * CarbonLib: in CarbonLib 1.0 and later
  5275. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  5276. }
  5277. function ProcessIsContextualMenuClient( var inPSN: ProcessSerialNumber ): Boolean; external name '_ProcessIsContextualMenuClient';
  5278. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5279. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  5280. { Contextual Menu Plugin Interface }
  5281. { For Mac OS X 10.1, we support a new type of Contextual Menu Plugin: the CFPlugIn }
  5282. { based plugin. Each plugin must be in a CFPlugIn in the Contextual Menu Items }
  5283. { folder in one of these paths: }
  5284. { /System/Library/Contextual Menu Items/ }
  5285. { /Library/Contextual Menu Items/ }
  5286. { ~/Library/Contextual Menu Items/ }
  5287. { It must export the following functions using the following interface or a C++ }
  5288. { interface inheriting from IUnknown and including similar functions. }
  5289. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  5290. (*
  5291. { The Contextual Menu Manager will only load CFPlugIns of type kContextualMenuTypeID }
  5292. #define kContextualMenuTypeID ( CFUUIDGetConstantUUIDWithBytes( NULL, \
  5293. 0x2F, 0x65, 0x22, 0xE9, 0x3E, 0x66, 0x11, 0xD5, \
  5294. 0x80, 0xA7, 0x00, 0x30, 0x65, 0xB3, 0x00, 0xBC ) )
  5295. { 2F6522E9-3E66-11D5-80A7-003065B300BC }
  5296. { Contextual Menu Plugins must implement this Contexual Menu Plugin Interface }
  5297. #define kContextualMenuInterfaceID ( CFUUIDGetConstantUUIDWithBytes( NULL, \
  5298. 0x32, 0x99, 0x7B, 0x62, 0x3E, 0x66, 0x11, 0xD5, \
  5299. 0xBE, 0xAB, 0x00, 0x30, 0x65, 0xB3, 0x00, 0xBC ) )
  5300. { 32997B62-3E66-11D5-BEAB-003065B300BC }
  5301. #define CM_IUNKNOWN_C_GUTS \
  5302. void *_reserved; \
  5303. SInt32 (*QueryInterface)(void *thisPointer, CFUUIDBytes iid, void ** ppv); \
  5304. UInt32 (*AddRef)(void *thisPointer); \
  5305. UInt32 (*Release)(void *thisPointer)
  5306. { The function table for the interface }
  5307. type
  5308. ContextualMenuInterfaceStruct = record
  5309. CM_IUNKNOWN_C_GUTS;
  5310. OSStatus ( *ExamineContext )(
  5311. void* thisInstance,
  5312. const AEDesc* inContext,
  5313. AEDescList* outCommandPairs );
  5314. OSStatus ( *HandleSelection )(
  5315. void* thisInstance,
  5316. AEDesc* inContext,
  5317. SInt32 inCommandID );
  5318. void ( *PostMenuCleanup )(
  5319. void* thisInstance );
  5320. end;
  5321. *)
  5322. {
  5323. * CMPluginExamineContext()
  5324. *
  5325. * Availability:
  5326. * Implemented by client
  5327. }
  5328. function CMPluginExamineContext( thisInstance: UnivPtr; const (*var*) inContext: AEDesc; var outCommandPairs: AEDescList ): OSStatus; external name '_CMPluginExamineContext';
  5329. {
  5330. * CMPluginHandleSelection()
  5331. *
  5332. * Availability:
  5333. * Implemented by client
  5334. }
  5335. function CMPluginHandleSelection( thisInstance: UnivPtr; var inContext: AEDesc; inCommandID: SInt32 ): OSStatus; external name '_CMPluginHandleSelection';
  5336. {
  5337. * CMPluginPostMenuCleanup()
  5338. *
  5339. * Availability:
  5340. * Implemented by client
  5341. }
  5342. procedure CMPluginPostMenuCleanup( thisInstance: UnivPtr ); external name '_CMPluginPostMenuCleanup';
  5343. { previously in LowMem.h. This functions return the menu ID of the hilited menu }
  5344. {
  5345. * LMGetTheMenu()
  5346. *
  5347. * Mac OS X threading:
  5348. * Not thread safe
  5349. *
  5350. * Availability:
  5351. * Mac OS X: in version 10.0 and later in Carbon.framework
  5352. * CarbonLib: in CarbonLib 1.0 and later
  5353. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5354. }
  5355. function LMGetTheMenu: MenuID; external name '_LMGetTheMenu';
  5356. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5357. {
  5358. * newmenu()
  5359. *
  5360. * Availability:
  5361. * Mac OS X: not available
  5362. * CarbonLib: not available
  5363. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5364. }
  5365. {
  5366. * appendmenu()
  5367. *
  5368. * Availability:
  5369. * Mac OS X: not available
  5370. * CarbonLib: not available
  5371. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5372. }
  5373. {
  5374. * insertmenuitem()
  5375. *
  5376. * Availability:
  5377. * Mac OS X: not available
  5378. * CarbonLib: not available
  5379. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5380. }
  5381. {
  5382. * menuselect()
  5383. *
  5384. * Availability:
  5385. * Mac OS X: not available
  5386. * CarbonLib: not available
  5387. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5388. }
  5389. {
  5390. * setmenuitemtext()
  5391. *
  5392. * Availability:
  5393. * Mac OS X: not available
  5394. * CarbonLib: not available
  5395. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5396. }
  5397. {
  5398. * getmenuitemtext()
  5399. *
  5400. * Availability:
  5401. * Mac OS X: not available
  5402. * CarbonLib: not available
  5403. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5404. }
  5405. (*
  5406. #if OLDROUTINENAMES
  5407. #define AddResMenu(theMenu, theType) AppendResMenu(theMenu, theType)
  5408. #define InsMenuItem(theMenu, itemString, afterItem) InsertMenuItem(theMenu, itemString, afterItem)
  5409. #define DelMenuItem( theMenu, item ) DeleteMenuItem( theMenu, item )
  5410. #if TARGET_OS_MAC
  5411. #define SetItem MacSetItem
  5412. #define GetItem MacGetItem
  5413. #endif
  5414. #define MacSetItem(theMenu, item, itemString) SetMenuItemText(theMenu, item, itemString)
  5415. #define MacGetItem(theMenu, item, itemString) GetMenuItemText(theMenu, item, itemString)
  5416. #define GetMHandle(menuID) GetMenuHandle(menuID)
  5417. #define DelMCEntries(menuID, menuItem) DeleteMCEntries(menuID, menuItem)
  5418. #define DispMCInfo(menuCTbl) DisposeMCInfo(menuCTbl)
  5419. #if CALL_NOT_IN_CARBON
  5420. #define addresmenu(menu, data) appendresmenu(menu, data)
  5421. #define getitem(menu, item, itemString) getmenuitemtext(menu, item, itemString)
  5422. #define setitem(menu, item, itemString) setmenuitemtext(menu, item, itemString)
  5423. #define insmenuitem(theMenu, itemString, afterItem) insertmenuitem(theMenu, itemString, afterItem)
  5424. #endif
  5425. #endif { OLDROUTINENAMES }
  5426. *)
  5427. { Getters }
  5428. {
  5429. * GetMenuID()
  5430. *
  5431. * Mac OS X threading:
  5432. * Not thread safe
  5433. *
  5434. * Availability:
  5435. * Mac OS X: in version 10.0 and later in Carbon.framework
  5436. * CarbonLib: in CarbonLib 1.0 and later
  5437. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5438. }
  5439. function GetMenuID( menu: MenuRef ): MenuID; external name '_GetMenuID';
  5440. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5441. {
  5442. * GetMenuWidth()
  5443. *
  5444. * Mac OS X threading:
  5445. * Not thread safe
  5446. *
  5447. * Availability:
  5448. * Mac OS X: in version 10.0 and later in Carbon.framework
  5449. * CarbonLib: in CarbonLib 1.0 and later
  5450. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5451. }
  5452. function GetMenuWidth( menu: MenuRef ): SInt16; external name '_GetMenuWidth';
  5453. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5454. {
  5455. * GetMenuHeight()
  5456. *
  5457. * Mac OS X threading:
  5458. * Not thread safe
  5459. *
  5460. * Availability:
  5461. * Mac OS X: in version 10.0 and later in Carbon.framework
  5462. * CarbonLib: in CarbonLib 1.0 and later
  5463. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5464. }
  5465. function GetMenuHeight( menu: MenuRef ): SInt16; external name '_GetMenuHeight';
  5466. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5467. {
  5468. * GetMenuTitle()
  5469. *
  5470. * Mac OS X threading:
  5471. * Not thread safe
  5472. *
  5473. * Availability:
  5474. * Mac OS X: in version 10.0 and later in Carbon.framework
  5475. * CarbonLib: in CarbonLib 1.0 and later
  5476. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5477. }
  5478. function GetMenuTitle( menu: MenuRef; var title: Str255 ): StringPtr; external name '_GetMenuTitle';
  5479. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5480. {
  5481. * GetMenuDefinition()
  5482. *
  5483. * Mac OS X threading:
  5484. * Not thread safe
  5485. *
  5486. * Availability:
  5487. * Mac OS X: in version 10.0 and later in Carbon.framework
  5488. * CarbonLib: in CarbonLib 1.0 and later
  5489. * Non-Carbon CFM: not available
  5490. }
  5491. function GetMenuDefinition( menu: MenuRef; outDefSpec: MenuDefSpecPtr ): OSStatus; external name '_GetMenuDefinition';
  5492. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5493. { Setters }
  5494. {
  5495. * SetMenuID()
  5496. *
  5497. * Mac OS X threading:
  5498. * Not thread safe
  5499. *
  5500. * Availability:
  5501. * Mac OS X: in version 10.0 and later in Carbon.framework
  5502. * CarbonLib: in CarbonLib 1.0 and later
  5503. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5504. }
  5505. procedure SetMenuID( menu: MenuRef; menuID_: MenuID ); external name '_SetMenuID';
  5506. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5507. {
  5508. * SetMenuWidth()
  5509. *
  5510. * Mac OS X threading:
  5511. * Not thread safe
  5512. *
  5513. * Availability:
  5514. * Mac OS X: in version 10.0 and later in Carbon.framework
  5515. * CarbonLib: in CarbonLib 1.0 and later
  5516. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5517. }
  5518. procedure SetMenuWidth( menu: MenuRef; width: SInt16 ); external name '_SetMenuWidth';
  5519. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5520. {
  5521. * SetMenuHeight()
  5522. *
  5523. * Mac OS X threading:
  5524. * Not thread safe
  5525. *
  5526. * Availability:
  5527. * Mac OS X: in version 10.0 and later in Carbon.framework
  5528. * CarbonLib: in CarbonLib 1.0 and later
  5529. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5530. }
  5531. procedure SetMenuHeight( menu: MenuRef; height: SInt16 ); external name '_SetMenuHeight';
  5532. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5533. {
  5534. * SetMenuTitle()
  5535. *
  5536. * Mac OS X threading:
  5537. * Not thread safe
  5538. *
  5539. * Availability:
  5540. * Mac OS X: in version 10.0 and later in Carbon.framework
  5541. * CarbonLib: in CarbonLib 1.0 and later
  5542. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5543. }
  5544. function SetMenuTitle( menu: MenuRef; const (*var*) title: Str255 ): OSStatus; external name '_SetMenuTitle';
  5545. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5546. {
  5547. * SetMenuDefinition()
  5548. *
  5549. * Mac OS X threading:
  5550. * Not thread safe
  5551. *
  5552. * Availability:
  5553. * Mac OS X: in version 10.0 and later in Carbon.framework
  5554. * CarbonLib: in CarbonLib 1.0 and later
  5555. * Non-Carbon CFM: not available
  5556. }
  5557. function SetMenuDefinition( menu: MenuRef; const (*var*) defSpec: MenuDefSpec ): OSStatus; external name '_SetMenuDefinition';
  5558. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5559. end.