Menus.pas 203 KB

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