Menus.pas 202 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154
  1. {
  2. File: HIToolbox/Menus.h
  3. Contains: Menu Manager Interfaces.
  4. Version: HIToolbox-219.4.81~2
  5. Copyright: © 1985-2005 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://www.freepascal.org/bugs.html
  9. }
  10. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, August 2005 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit Menus;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,AEDataModel,CFBase,CGContext,ATSTypes,Events,Quickdraw,Fonts,TextCommon,Processes,AppleEvents,Collections,MacErrors,CFString,CFUUID,CarbonEventsCore;
  92. {$ALIGN MAC68K}
  93. {
  94. * Menu Manager
  95. }
  96. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  97. { ¥ Menu Constants }
  98. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  99. {
  100. A Short Course on Menu Definition Functions
  101. A menu definition function is used to implement a custom visual appearance for a menu.
  102. Menu definition functions are still supported in Carbon, but the messages sent to a
  103. menu definition function in Carbon are different than for a non-Carbon application.
  104. In general, Apple recommends using the system menu definition whenever possible.
  105. Menu definition functions will continue to be supported, but it is not easy to write
  106. a correct menu definition, especially one that attempts to imitate the standard system
  107. menu appearance. If you require special features in your menu that the system menu
  108. definition does not support, please mail <[email protected]> and describe your requirements;
  109. we would much rather enhance the system menu definition than have you write a custom one.
  110. Menu definition functions before Carbon used the following messages:
  111. kMenuDrawMsg
  112. kMenuChooseMsg
  113. kMenuSizeMsg
  114. kMenuPopUpMsg
  115. kMenuDrawItemMsg
  116. kMenuCalcItemMsg
  117. kMenuThemeSavvyMsg
  118. kMenuChooseMsg and kMenuDrawItemMsg are not supported in Carbon and are not sent to
  119. Carbon menu definitions. In Carbon, kMenuChooseMsg is replaced by kMenuFindItemMsg and
  120. kMenuHiliteItemMsg. Menu definition functions in Carbon use the following messages:
  121. kMenuInitMsg
  122. kMenuDisposeMsg
  123. kMenuFindItemMsg
  124. kMenuHiliteItemMsg
  125. kMenuDrawItemsMsg
  126. kMenuDrawMsg
  127. kMenuSizeMsg
  128. kMenuPopUpMsg
  129. kMenuCalcItemMsg
  130. kMenuThemeSavvyMsg
  131. The rest of this documentation will focus on Carbon menu definitions only.
  132. Menu Definition Messages
  133. Carbon menu definition functions should support the following messages:
  134. kMenuInitMsg
  135. menuRect unused
  136. hitPt unused
  137. whichItem OSErr*
  138. Sent when a menu is created. This message gives the menu definition an opportunity
  139. to initialize its own state. If the menu definition encounters an error while
  140. initializing, it should set *whichItem to a non-zero error code; this will cause the
  141. Menu Manager to destroy the menu and return an error back from the API that was used
  142. to create the menu.
  143. kMenuDisposeMsg
  144. menuRect unused
  145. hitPt unused
  146. whichItem unused
  147. Sent when a menu is destroyed. This message gives the menu definition an opportunity
  148. to destroy its own data.
  149. kMenuFindItemMsg
  150. menuRect menu bounds
  151. hitPt point to hit-test
  152. whichItem MDEFFindItemData*
  153. Sent when the Menu Manager is displaying a menu and needs to know what item is under
  154. the mouse. The whichItem parameter is actually a pointer to a MenuTrackingData structure.
  155. On entry, the menu, virtualMenuTop, and virtualMenuBottom fields of this structure are
  156. valid. The menu definition should determine which item containst the given point, if any,
  157. and fill in the itemUnderMouse, itemSelected, and itemRect fields. If an item is found,
  158. the menu definition should always fill in the itemUnderMouse and itemRect fields. The
  159. menu definition should only fill in the itemSelected field if the item is available for
  160. selection; if it is unavailable (because it is disabled, or for some other reason), the
  161. menu definition should set the itemSelected field to zero.
  162. The values placed in the itemUnderMouse and itemSelected fields should be less than or
  163. equal to the number of items returned by CountMenuItems on this menu. The values placed
  164. in these two fields should be identical if both are non-zero. itemUnderMouse should always
  165. be non-zero if the mouse is actually over an item.
  166. The menu definition should not hilite the found item during this message. The Menu
  167. Manager will send a separate kMenuHiliteItemMsg to request hiliting of the item.
  168. If the menu definition supports scrolling, it should scroll the menu during this message,
  169. and update the virtualMenuTop and virtualMenuBottom fields of the MenuTrackingData to
  170. indicate the menu's new scrolled position.
  171. If the menu definition uses QuickDraw to draw while scrolling, it should draw into the
  172. current port.
  173. If the menu definition uses CoreGraphics to draw while scrolling, it should use the
  174. CGContextRef passed in the context field of the MDEFHiliteItemData structure.
  175. Menu definitions must use the ScrollMenuImage API, if available, to scroll the menu contents.
  176. This API is available in CarbonLib 1.5 and later, and in Mac OS X 10.1 and later. ScrollMenuImage
  177. properly supports scrolling the alpha channel in the menu's image data. Use of QuickDraw's
  178. ScrollRect API to scroll the menu contents will result in the alpha channel being set to 0xFF
  179. (opaque) and the menu will no longer be transparent.
  180. The menu definition should not modify the menu field of the MenuTrackingData.
  181. kMenuHiliteItemMsg
  182. menuRect menu bounds
  183. hitPt unused
  184. whichItem MDEFHiliteItemData*
  185. Sent when the Menu Manager is displaying a menu and needs to hilite a newly selected
  186. item. The whichItem parameter is actually a pointer to a MDEFHiliteItemData structure.
  187. The menu definition should unhilite the item in the previousItem field, if non-zero,
  188. and hilite the item in the newItem field.
  189. Menu definitions should use the EraseMenuBackground API to erase the old menu contents
  190. before unhiliting a menu item, if the menu definition is using the Appearance Manager's
  191. menu drawing APIs. This is necessary because the background of a menu is transparent on
  192. Aqua, and if the old hilite is not erased first, it will show through the new unhilited
  193. menu background.
  194. If the menu definition uses QuickDraw to draw, it should draw into the current port.
  195. If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
  196. in the context field of the MDEFHiliteItemData structure.
  197. kMenuDrawItemsMsg
  198. menuRect menu bounds
  199. hitPt unused
  200. whichItem MDEFDrawItemsData*
  201. Sent when the Menu Manager is displaying a menu and needs to redraw a portion of the
  202. menu. This message is used by the dynamic menu item support code in the Menu Manager;
  203. for example, if items five and six in a menu are a dynamic group, the Menu Manager will
  204. send a DrawItems message when the group's modifier key is pressed or released to redraw
  205. the appropriate item, but no other items in the menu.
  206. The whichItem parameter for this message is actually a pointer to a MDEFDrawItemsData
  207. structure. The menu definition should redraw the items starting with firstItem and
  208. ending with lastItem, inclusive.
  209. If the menu definition uses QuickDraw to draw, it should draw into the current port.
  210. If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
  211. in the context field of the MDEFDrawItemsData structure.
  212. kMenuDrawMsg
  213. menuRect menu bounds
  214. hitPt unused
  215. whichItem MDEFDrawData*
  216. Sent when the Menu Manager is displaying a menu and needs to redraw the entire menu.
  217. The whichItem parameter is actually a pointer to a MenuTrackingData structure. On entry,
  218. the menu field of this structure is valid. The menu definition should draw the menu and,
  219. if it supports scrolling, should also fill in the virtualMenuTop and virtualMenuBottom
  220. fields of the structure to indicate the menu's initial unscrolled position; typically,
  221. virtualMenuTop would be set to the same value as the top coordinate of the menu rect,
  222. and virtualMenuBottom would be set to virtualMenuTop plus the virtual height of the menu.
  223. If the menu definition uses QuickDraw to draw, it should draw into the current port.
  224. If the menu definition uses CoreGraphics to draw, it should use the CGContextRef passed
  225. in the context field of the MDEFDrawData structure.
  226. kMenuSizeMsg
  227. menuRect unused
  228. hitPt maximum width and height of the menu
  229. whichItem unused
  230. Sent when the Menu Manager needs to determine the size of a menu. The menu definition
  231. should calculate the width and height of the menu and store the sizes into the menu with
  232. SetMenuWidth and SetMenuHeight.
  233. If the gestaltMenuMgrSendsMenuBoundsToDefProc bit is set in the Menu Manager's Gestalt
  234. value, then the hitPt parameter to this message is the maximum width (hitPt.h) and height
  235. (hitPt.v) of the menu. The menu definition should ensure that the width and height that it
  236. places in the menu do not exceed these values. If the gestalt bit is not set, the menu
  237. definition should just use the main GDevice's width and height as constraints on the menu's
  238. width and height.
  239. kMenuPopUpMsg
  240. menuRect on entry, constraints on the menu's position; on exit, menu bounds
  241. hitPt requested menu location, with swapped coordinates
  242. whichItem on entry, requested initial selection; on exit, virtual menu top
  243. Sent when the Menu Manager is about to display a popup menu. The menu definition should
  244. calculate the appropriate menu bounds to contain the menu based on the requested menu
  245. location and selected item. It should write the menuBounds into the rect given by the
  246. menuRect parameter.
  247. If the gestaltMenuMgrSendsMenuBoundsToDefProc bit is set in the Menu Manager's Gestalt
  248. value, then the menuRect parameter on entry to this message contains a constraint rect,
  249. in global coordinates, outside of which the popup menu should not be positioned. The menu
  250. definition should take this constraint rect into account as it calculates the menu bounds.
  251. If the gestalt bit is not set, the menu definition should use the bounds of the GDevice
  252. containing the menu's top left corner as a constraint on the menu's position.
  253. The hitPt parameter is a requested location for the top left corner of the menu. The
  254. coordinates of this parameter are swapped from their normal order; the h field of the
  255. hitPt parameter contains the vertical coordinate, and the v field of hitPt contains
  256. the horizontal coordinate.
  257. On entry, the whichItem parameter points at a menu item index which is requested to be
  258. the initial selection when the menu is displayed. After calculating the menu's bounds,
  259. the menu definition should write the menu's virtual top coordinate into the location
  260. pointed at by the whichItem parameter. If displaying the menu at the requested location
  261. does not require scrolling, the virtual top will be the same as the menu bounds top;
  262. if the menu must scroll to fit in the requested location, the virtual top may be different.
  263. kMenuCalcItemMsg
  264. menuRect on exit, item bounds
  265. hitPt unused
  266. whichItem the item whose rect to calculate
  267. Sent when the Menu Manager needs to know the bounds of a menu item. The menu definition
  268. should calculate the size of the item specified by the whichItem parameter, and store
  269. the bounds in the rect specified by the menuRect parameter.
  270. Some sample menu definition code provided by Apple has previously shown an implementation
  271. of this message that always sets the top left corner of the item bounds to (0,0), regardless
  272. of the item's actual position in the menu. For best future compatibility, menu definitions
  273. should begin storing an item bounds that gives the item's actual position in the menu based
  274. on the menu's current virtual top. For example, if the virtual menu top starts at 20, then
  275. the menu definition would calculate an item bounds for the first item that starts at (0,20),
  276. an item bounds for the second item that starts at (0,40), and so on. The menu definition
  277. should call GetMenuTrackingData to get the menu's current virtual position, and use zero
  278. for the menu top if GetMenuTrackingData returns an error.
  279. kMenuThemeSavvyMsg
  280. menuRect unused
  281. hitPt unused
  282. whichItem on exit, indicates theme-savvyness of the menu definition
  283. Sent by the Menu Manager to determine whether the MDEF uses the Appearance Manager
  284. menu-drawing functions to draw its menu. If it does, the menu definition should return
  285. kThemeSavvyMenuResponse in the location pointed to by whichItem. If the menu definition
  286. draws its own custom content without using the Appearance Manager menu-drawing functions,
  287. it should ignore this message.
  288. Low-memory Global Replacements
  289. Pre-Carbon menu definitions needed to use several low-memory globals to communicate with the
  290. Menu Manager. These globals have all been replaced or made obsolete in Carbon, as follows:
  291. MenuDisable
  292. MenuDisable is now set automatically by the Menu Manager using the value returned in the
  293. itemUnderMouse field of the MenuTrackingData structure passed to kMenuFindItemMsg.
  294. TopMenuItem
  295. AtMenuBottom
  296. TopMenuItem and AtMenuBottom are now set automatically by the Menu Manager using the
  297. values returned in the virtualMenuTop and virtualMenuBottom fields of the MenuTrackingData
  298. structure passed to kMenuDrawMsg and kMenuFindItemMsg.
  299. mbSaveLoc
  300. This undocumented low-memory global was used by pre-Carbon menu definitions to store
  301. the bounding rect of the currently selected item and to avoid drawing glitches while
  302. the menu definition was scrolling the contents of a menu that had submenus. The Menu
  303. Manager now automatically sets the selected item bounds using the value returned in
  304. the itemRect field of the MenuTrackingData structure passed to kMenuFindItemMsg. In
  305. order to correctly support scrolling of menus with submenus, a menu definition should
  306. verify, before scrolling the menu contents, that no submenus of the scrolling menu are
  307. currently visible. A menu definition can use GetMenuTrackingData to verify this condition,
  308. as follows:
  309. Boolean SafeToScroll( MenuRef menuBeingScrolled )
  310. (
  311. MenuTrackingData lastMenuData;
  312. return GetMenuTrackingData( NULL, &lastMenuData ) == noErr
  313. && lastMenuData.menu == menuBeingScrolled;
  314. )
  315. If SafeToScroll returns false, the menu definition should not scroll the menu.
  316. }
  317. const
  318. { menu defProc messages }
  319. kMenuDrawMsg = 0;
  320. kMenuSizeMsg = 2;
  321. kMenuPopUpMsg = 3; { position the popup menu rect appropriately }
  322. kMenuCalcItemMsg = 5;
  323. kMenuThemeSavvyMsg = 7; { is your MDEF theme-savvy? If so, return kThemeSavvyMenuResponse in the whichItem parameter}
  324. kMenuInitMsg = 8; { Return an error code in *whichItem to indicate success or failure. Only supported in Carbon. }
  325. kMenuDisposeMsg = 9; { The menu is being destroyed. Only supported in Carbon.}
  326. kMenuFindItemMsg = 10; { Determine which item is under the mouse. Only supported in Carbon.}
  327. kMenuHiliteItemMsg = 11; { Hilite the specified item. Only supported in Carbon.}
  328. kMenuDrawItemsMsg = 12; { Draw a range of items. Only supported in Carbon.}
  329. mDrawMsg = kMenuDrawMsg; { obsolete constant name}
  330. mSizeMsg = kMenuSizeMsg; { obsolete constant name}
  331. mPopUpMsg = kMenuPopUpMsg; { obsolete constant name}
  332. mCalcItemMsg = kMenuCalcItemMsg; { obsolete constant name}
  333. const
  334. kThemeSavvyMenuResponse = $7473; { should be returned in *whichItem when handling kMenuThemeSavvyMsg}
  335. const
  336. {
  337. * Proc ID for a normal text menu. This constant is not typically
  338. * used.
  339. }
  340. textMenuProc = 0;
  341. {
  342. * Menu item command ID to indicate a hierarchical menu; the item
  343. * icon ID is the hierarchical menu ID. This constant is deprecated.
  344. * Use SetMenuItemHierarchicalID or SetMenuItemHierarchicalMenu
  345. * instead of using this constant.
  346. }
  347. hMenuCmd = 27;
  348. {
  349. * A menu ID used with InsertMenu to insert a menu into the
  350. * hierarchical portion of the menubar.
  351. }
  352. kInsertHierarchicalMenu = -1;
  353. {
  354. * The old name for kInsertHierarchicalMenu. This constant is
  355. * deprecated.
  356. }
  357. hierMenu = -1;
  358. {
  359. * This value may be passed to InsertMenuItem, InsertMenuItemText,
  360. * and InsertMenuItemTextWithCFString to indicate that the new item
  361. * should be inserted at the end of the menu. Note that you can also
  362. * just call AppendMenu[ItemText][WithCFString].
  363. }
  364. kHIMenuAppendItem = $0000FFFF;
  365. const
  366. noMark = 0; { mark symbol for SetItemMark; other mark symbols are defined in Fonts.h }
  367. { obsolete menu color table constants}
  368. const
  369. mctAllItems = -98; {search for all Items for the given ID}
  370. mctLastIDIndic = -99; {last color table entry has this in ID field}
  371. { Constants for use with MacOS 8.0 (Appearance 1.0) and later}
  372. const
  373. kMenuStdMenuProc = 63;
  374. kMenuStdMenuBarProc = 63;
  375. { For use with Get/SetMenuItemModifiers}
  376. const
  377. kMenuNoModifiers = 0; { Mask for no modifiers}
  378. kMenuShiftModifier = 1 shl 0; { Mask for shift key modifier}
  379. kMenuOptionModifier = 1 shl 1; { Mask for option key modifier}
  380. kMenuControlModifier = 1 shl 2; { Mask for control key modifier}
  381. kMenuNoCommandModifier = 1 shl 3; { Mask for no command key modifier}
  382. { For use with Get/SetMenuItemIconHandle}
  383. const
  384. kMenuNoIcon = 0; { No icon}
  385. kMenuIconType = 1; { Type for ICON}
  386. kMenuShrinkIconType = 2; { Type for ICON plotted 16 x 16}
  387. kMenuSmallIconType = 3; { Type for SICN}
  388. kMenuColorIconType = 4; { Type for cicn}
  389. kMenuIconSuiteType = 5; { Type for Icon Suite}
  390. kMenuIconRefType = 6; { Type for Icon Ref}
  391. kMenuCGImageRefType = 7; { Type for a CGImageRef (Mac OS X only)}
  392. kMenuSystemIconSelectorType = 8; { Type for an OSType identifying an IconRef registered with Icon Services under kSystemIconsCreator (Mac OS X 10.1 and later only)}
  393. kMenuIconResourceType = 9; { Type for a CFStringRef with the full name of a .icns resource in the main bundle of the process (Mac OS X 10.1 and later only)}
  394. { For use with Get/SetMenuItemKeyGlyph}
  395. const
  396. kMenuNullGlyph = $00; { Null (always glyph 1)}
  397. kMenuTabRightGlyph = $02; { Tab to the right key (for left-to-right script systems)}
  398. kMenuTabLeftGlyph = $03; { Tab to the left key (for right-to-left script systems)}
  399. kMenuEnterGlyph = $04; { Enter key}
  400. kMenuShiftGlyph = $05; { Shift key}
  401. kMenuControlGlyph = $06; { Control key}
  402. kMenuOptionGlyph = $07; { Option key}
  403. kMenuSpaceGlyph = $09; { Space (always glyph 3) key}
  404. kMenuDeleteRightGlyph = $0A; { Delete to the right key (for right-to-left script systems)}
  405. kMenuReturnGlyph = $0B; { Return key (for left-to-right script systems)}
  406. kMenuReturnR2LGlyph = $0C; { Return key (for right-to-left script systems)}
  407. kMenuNonmarkingReturnGlyph = $0D; { Nonmarking return key}
  408. kMenuPencilGlyph = $0F; { Pencil key}
  409. kMenuDownwardArrowDashedGlyph = $10; { Downward dashed arrow key}
  410. kMenuCommandGlyph = $11; { Command key}
  411. kMenuCheckmarkGlyph = $12; { Checkmark key}
  412. kMenuDiamondGlyph = $13; { Diamond key}
  413. kMenuAppleLogoFilledGlyph = $14; { Apple logo key (filled)}
  414. kMenuParagraphKoreanGlyph = $15; { Unassigned (paragraph in Korean)}
  415. kMenuDeleteLeftGlyph = $17; { Delete to the left key (for left-to-right script systems)}
  416. kMenuLeftArrowDashedGlyph = $18; { Leftward dashed arrow key}
  417. kMenuUpArrowDashedGlyph = $19; { Upward dashed arrow key}
  418. kMenuRightArrowDashedGlyph = $1A; { Rightward dashed arrow key}
  419. kMenuEscapeGlyph = $1B; { Escape key}
  420. kMenuClearGlyph = $1C; { Clear key}
  421. kMenuLeftDoubleQuotesJapaneseGlyph = $1D; { Unassigned (left double quotes in Japanese)}
  422. kMenuRightDoubleQuotesJapaneseGlyph = $1E; { Unassigned (right double quotes in Japanese)}
  423. kMenuTrademarkJapaneseGlyph = $1F; { Unassigned (trademark in Japanese)}
  424. kMenuBlankGlyph = $61; { Blank key}
  425. kMenuPageUpGlyph = $62; { Page up key}
  426. kMenuCapsLockGlyph = $63; { Caps lock key}
  427. kMenuLeftArrowGlyph = $64; { Left arrow key}
  428. kMenuRightArrowGlyph = $65; { Right arrow key}
  429. kMenuNorthwestArrowGlyph = $66; { Northwest arrow key}
  430. kMenuHelpGlyph = $67; { Help key}
  431. kMenuUpArrowGlyph = $68; { Up arrow key}
  432. kMenuSoutheastArrowGlyph = $69; { Southeast arrow key}
  433. kMenuDownArrowGlyph = $6A; { Down arrow key}
  434. kMenuPageDownGlyph = $6B; { Page down key}
  435. kMenuAppleLogoOutlineGlyph = $6C; { Apple logo key (outline)}
  436. kMenuContextualMenuGlyph = $6D; { Contextual menu key}
  437. kMenuPowerGlyph = $6E; { Power key}
  438. kMenuF1Glyph = $6F; { F1 key}
  439. kMenuF2Glyph = $70; { F2 key}
  440. kMenuF3Glyph = $71; { F3 key}
  441. kMenuF4Glyph = $72; { F4 key}
  442. kMenuF5Glyph = $73; { F5 key}
  443. kMenuF6Glyph = $74; { F6 key}
  444. kMenuF7Glyph = $75; { F7 key}
  445. kMenuF8Glyph = $76; { F8 key}
  446. kMenuF9Glyph = $77; { F9 key}
  447. kMenuF10Glyph = $78; { F10 key}
  448. kMenuF11Glyph = $79; { F11 key}
  449. kMenuF12Glyph = $7A; { F12 key}
  450. kMenuF13Glyph = $87; { F13 key}
  451. kMenuF14Glyph = $88; { F14 key}
  452. kMenuF15Glyph = $89; { F15 key}
  453. kMenuControlISOGlyph = $8A; { Control key (ISO standard)}
  454. kMenuEjectGlyph = $8C; { Eject key (available on Mac OS X 10.2 and later)}
  455. kMenuEisuGlyph = $8D; { Japanese eisu key (available in Mac OS X 10.4 and later)}
  456. kMenuKanaGlyph = $8E; { Japanese kana key (available in Mac OS X 10.4 and later)}
  457. {
  458. * MenuAttributes
  459. *
  460. * Summary:
  461. * Menu attributes control behavior of the entire menu. They are
  462. * used with the Get/ChangeMenuAttributes APIs.
  463. }
  464. type
  465. MenuAttributes = UInt32;
  466. const
  467. {
  468. * No column space is allocated for the mark character when this menu
  469. * is drawn.
  470. }
  471. kMenuAttrExcludesMarkColumn = 1 shl 0;
  472. {
  473. * The menu title is automatically disabled when all items are
  474. * disabled.
  475. }
  476. kMenuAttrAutoDisable = 1 shl 2;
  477. {
  478. * The pencil glyph from the Keyboard font (kMenuPencilGlyph) is used
  479. * to draw the Control modifier key in menu keyboard equivalents.
  480. * This appearance is typically used only by Japanese input method
  481. * menus.
  482. }
  483. kMenuAttrUsePencilGlyph = 1 shl 3;
  484. {
  485. * The menu title is not drawn in the menubar, even when the menu is
  486. * inserted in the menubar. Useful for adding command keys that don't
  487. * correspond to a visible menu item; menu items with the desired
  488. * command keys can be added to the menu and inserted in the menubar
  489. * without making the menu visible. This attribute is available in
  490. * Mac OS X 10.2 and later.
  491. }
  492. kMenuAttrHidden = 1 shl 4;
  493. {
  494. * If menu item separators are present at the beginning or end of the
  495. * menu, or if multiple contiguous separators are present, the extra
  496. * separator items are marked as hidden to avoid extra blank space in
  497. * the menu. The menu is examined for extra separators whenever the
  498. * menu size is recalculated. This attribute is available in Mac OS X
  499. * 10.3 and later.
  500. }
  501. kMenuAttrCondenseSeparators = 1 shl 5;
  502. {
  503. * Disables automatic caching of the menu image by the Menu Manager.
  504. * Automatic caching is provided for all menus that use an HIView to
  505. * draw their content. Setting this attribute will prevent the Menu
  506. * Manager from caching the menu image; instead, the menu will be
  507. * drawn using the standard HIView drawing mechanism each time that
  508. * it is displayed. This attribute is available in Mac OS X 10.3 and
  509. * later.
  510. }
  511. kMenuAttrDoNotCacheImage = 1 shl 6;
  512. {
  513. * Disables substitution of command keys from the
  514. * NSUserKeyEquivalents dictionary. By default, all menu items are
  515. * checked for a match in the dictionary. Note that this attribute,
  516. * to be effective, should be added at the time that the menu is
  517. * created; once the menu has been searched for user command keys
  518. * (which occurs in CalcMenuSize, in GetItemCmd and
  519. * GetMenuItemCommandKey, and before command key matching), the
  520. * original command keys are replaced by the user command keys and
  521. * cannot be retrieved. For this reason, it is also not useful to
  522. * clear this attribute; the original command keys cannot be
  523. * restored. This attribute is available in Mac OS X 10.3 and later.
  524. }
  525. kMenuAttrDoNotUseUserCommandKeys = 1 shl 7;
  526. {
  527. * MenuItemAttributes
  528. *
  529. * Summary:
  530. * Menu item attributes control behavior of individual menu items.
  531. * They are used with the Get/ChangeMenuItemAttributes APIs.
  532. }
  533. type
  534. MenuItemAttributes = UInt32;
  535. const
  536. {
  537. * This item is disabled.
  538. }
  539. kMenuItemAttrDisabled = 1 shl 0;
  540. {
  541. * This item's icon is disabled.
  542. }
  543. kMenuItemAttrIconDisabled = 1 shl 1;
  544. {
  545. * Allows the parent item of a submenu to be selectable.
  546. }
  547. kMenuItemAttrSubmenuParentChoosable = 1 shl 2;
  548. {
  549. * This item changes dynamically based on modifier key state.
  550. }
  551. kMenuItemAttrDynamic = 1 shl 3;
  552. {
  553. * This item is not part of the same dynamic group as the previous
  554. * item.
  555. }
  556. kMenuItemAttrNotPreviousAlternate = 1 shl 4;
  557. {
  558. * This item is not drawn when the menu is displayed. It is also not
  559. * included in command key matching, unless the item also has either
  560. * the Dynamic or IncludeInCmdKeyMatching attributes.
  561. }
  562. kMenuItemAttrHidden = 1 shl 5;
  563. {
  564. * This item is a separator; the text of the item is ignored.
  565. }
  566. kMenuItemAttrSeparator = 1 shl 6;
  567. {
  568. * This item is a menu section header; it is disabled and
  569. * unselectable.
  570. }
  571. kMenuItemAttrSectionHeader = 1 shl 7;
  572. {
  573. * Metacharacters in the text of this item (such as the dash) are
  574. * ignored.
  575. }
  576. kMenuItemAttrIgnoreMeta = 1 shl 8;
  577. {
  578. * This item is recognized by IsMenuKeyEvent when it is passed an
  579. * auto-repeat keyboard event.
  580. }
  581. kMenuItemAttrAutoRepeat = 1 shl 9;
  582. {
  583. * When MenuEvent and IsMenuKeyEvent compare this item's keyboard
  584. * equivalent against a keyboard event, they use the item's virtual
  585. * keycode equivalent rather than its character code equivalent.
  586. }
  587. kMenuItemAttrUseVirtualKey = 1 shl 10;
  588. {
  589. * This item is drawn in a customized fashion by the application.
  590. * Causes custom menu item drawing Carbon events to be sent. This
  591. * attribute is available in CarbonLib 1.4 and Mac OS X 10.1, and
  592. * later.
  593. }
  594. kMenuItemAttrCustomDraw = 1 shl 11;
  595. {
  596. * This item is examined during command key matching by MenuKey,
  597. * MenuEvent, and IsMenuKeyEvent. Normally, visible menu items are
  598. * included in command key matching, but hidden menu items are
  599. * excluded (unless the item also has the Dynamic menu item
  600. * attribute). The IncludeInCmdKeyMatching attribute can be used to
  601. * force a hidden, non-dynamic menu item to be included in command
  602. * key matching when it normally wouldn't. This attribute is
  603. * available in CarbonLib 1.6 and Mac OS X 10.2 and later.
  604. }
  605. kMenuItemAttrIncludeInCmdKeyMatching = 1 shl 12;
  606. {
  607. * This item is automatically disabled if, when
  608. * kEventCommandUpdateStatus is sent for this item, no handler is
  609. * installed or all handlers return eventNotHandledErr. A return
  610. * value from any handler of any value other than eventNotHandledErr
  611. * will prevent automatic disabling. This attribute is useful for
  612. * applications that use kEventCommandUpdateStatus events for all
  613. * menu item enabling; previously, an application would need to
  614. * install UpdateStatus handlers on its application target to disable
  615. * all items in the application that were unnecessary when no
  616. * document windows were open. By setting this attribute, all menu
  617. * items will be disabled automatically unless specifically enabled
  618. * by an UpdateStatus handler on a window, control, or application
  619. * target. This attribute is available in Mac OS X 10.3 and later.
  620. }
  621. kMenuItemAttrAutoDisable = 1 shl 13;
  622. {
  623. * During command key matching, the Menu Manager uses a cache of the
  624. * available command keys to locate the menu item that matches an
  625. * event. Before returning this item, the Menu Manager sends a
  626. * kEventMenuEnableItems event to the menu containing the item, and a
  627. * kEventCommandUpdateStatus event to each item in the menu, so that
  628. * the item can be properly enabled or disabled. For some
  629. * applications, updating the item status for each item in the menu
  630. * is quite expensive, and also unnecessary since only a single item
  631. * actually needs to be updated. Setting this attribute indicates to
  632. * the Menu Manager that it only needs to send a
  633. * kEventCommandUpdateStatus event to this menu item before returning
  634. * it from command key matching; kEventMenuEnableItems will not be
  635. * sent to the menu, and no other menu item will receive
  636. * kEventCommandUpdateStatus.
  637. }
  638. kMenuItemAttrUpdateSingleItem = 1 shl 14;
  639. {
  640. * MenuTrackingMode
  641. *
  642. * Summary:
  643. * A menu tracking mode constant is part of the
  644. * kEventMenuBeginTracking and kEventMenuChangeTrackingMode Carbon
  645. * events. It indicates whether menus are being tracked using the
  646. * mouse or keyboard.
  647. }
  648. type
  649. MenuTrackingMode = UInt32;
  650. const
  651. {
  652. * Menus are being tracked using the mouse.
  653. }
  654. kMenuTrackingModeMouse = 1;
  655. {
  656. * Menus are being tracked using the keyboard.
  657. }
  658. kMenuTrackingModeKeyboard = 2;
  659. {
  660. * MenuEventOptions
  661. *
  662. * Summary:
  663. * Menu event options control how the menus are searched for an item
  664. * matching a particular keyboard event. They are used with the
  665. * IsMenuKeyEvent API.
  666. }
  667. type
  668. MenuEventOptions = UInt32;
  669. const
  670. {
  671. * Disabled items are examined for a match.
  672. }
  673. kMenuEventIncludeDisabledItems = $0001;
  674. {
  675. * Don't hilite the menu title if a match is found.
  676. }
  677. kMenuEventQueryOnly = $0002;
  678. {
  679. * Don't look for a match in submenus of the starting menu.
  680. }
  681. kMenuEventDontCheckSubmenus = $0004;
  682. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  683. { ¥ Menu Types }
  684. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  685. type
  686. MenuID = SInt16;
  687. type
  688. MenuItemIndex = UInt16;
  689. 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: CharParameter ); external name '_GetItemMark';
  3025. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3026. {
  3027. * SetItemCmd()
  3028. *
  3029. * Mac OS X threading:
  3030. * Not thread safe
  3031. *
  3032. * Availability:
  3033. * Mac OS X: in version 10.0 and later in Carbon.framework
  3034. * CarbonLib: in CarbonLib 1.0 and later
  3035. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3036. }
  3037. procedure SetItemCmd( theMenu: MenuRef; item: MenuItemIndex; cmdChar: CharParameter ); external name '_SetItemCmd';
  3038. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3039. {
  3040. * GetItemCmd()
  3041. *
  3042. * Mac OS X threading:
  3043. * Not thread safe
  3044. *
  3045. * Availability:
  3046. * Mac OS X: in version 10.0 and later in Carbon.framework
  3047. * CarbonLib: in CarbonLib 1.0 and later
  3048. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3049. }
  3050. procedure GetItemCmd( theMenu: MenuRef; item: MenuItemIndex; var cmdChar: CharParameter ); external name '_GetItemCmd';
  3051. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3052. {
  3053. * SetItemIcon()
  3054. *
  3055. * Mac OS X threading:
  3056. * Not thread safe
  3057. *
  3058. * Availability:
  3059. * Mac OS X: in version 10.0 and later in Carbon.framework
  3060. * CarbonLib: in CarbonLib 1.0 and later
  3061. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3062. }
  3063. procedure SetItemIcon( theMenu: MenuRef; item: MenuItemIndex; iconIndex: SInt16 ); external name '_SetItemIcon';
  3064. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3065. { icon is returned in high byte of 16-bit iconIndex }
  3066. {
  3067. * GetItemIcon()
  3068. *
  3069. * Mac OS X threading:
  3070. * Not thread safe
  3071. *
  3072. * Availability:
  3073. * Mac OS X: in version 10.0 and later in Carbon.framework
  3074. * CarbonLib: in CarbonLib 1.0 and later
  3075. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3076. }
  3077. procedure GetItemIcon( theMenu: MenuRef; item: MenuItemIndex; var iconIndex: SInt16 ); external name '_GetItemIcon';
  3078. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3079. {
  3080. * SetItemStyle()
  3081. *
  3082. * Mac OS X threading:
  3083. * Not thread safe
  3084. *
  3085. * Availability:
  3086. * Mac OS X: in version 10.0 and later in Carbon.framework
  3087. * CarbonLib: in CarbonLib 1.0 and later
  3088. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3089. }
  3090. procedure SetItemStyle( theMenu: MenuRef; item: MenuItemIndex; chStyle: StyleParameter ); external name '_SetItemStyle';
  3091. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3092. {
  3093. * GetItemStyle()
  3094. *
  3095. * Mac OS X threading:
  3096. * Not thread safe
  3097. *
  3098. * Availability:
  3099. * Mac OS X: in version 10.0 and later in Carbon.framework
  3100. * CarbonLib: in CarbonLib 1.0 and later
  3101. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3102. }
  3103. procedure GetItemStyle( theMenu: MenuRef; item: MenuItemIndex; var chStyle: Style ); external name '_GetItemStyle';
  3104. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3105. { These APIs are not supported in Carbon. Please use EnableMenuItem and }
  3106. { DisableMenuItem (available back through Mac OS 8.5) instead. }
  3107. {
  3108. * DisableItem()
  3109. *
  3110. * Availability:
  3111. * Mac OS X: not available
  3112. * CarbonLib: not available
  3113. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3114. }
  3115. {
  3116. * EnableItem()
  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. * SetMenuItemCommandID()
  3125. *
  3126. * Mac OS X threading:
  3127. * Not thread safe
  3128. *
  3129. * Availability:
  3130. * Mac OS X: in version 10.0 and later in Carbon.framework
  3131. * CarbonLib: in CarbonLib 1.0 and later
  3132. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3133. }
  3134. function SetMenuItemCommandID( inMenu: MenuRef; inItem: MenuItemIndex; inCommandID: MenuCommand ): OSErr; external name '_SetMenuItemCommandID';
  3135. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3136. {
  3137. * GetMenuItemCommandID()
  3138. *
  3139. * Mac OS X threading:
  3140. * Not thread safe
  3141. *
  3142. * Availability:
  3143. * Mac OS X: in version 10.0 and later in Carbon.framework
  3144. * CarbonLib: in CarbonLib 1.0 and later
  3145. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3146. }
  3147. function GetMenuItemCommandID( inMenu: MenuRef; inItem: MenuItemIndex; var outCommandID: MenuCommand ): OSErr; external name '_GetMenuItemCommandID';
  3148. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3149. {
  3150. * SetMenuItemModifiers()
  3151. *
  3152. * Mac OS X threading:
  3153. * Not thread safe
  3154. *
  3155. * Availability:
  3156. * Mac OS X: in version 10.0 and later in Carbon.framework
  3157. * CarbonLib: in CarbonLib 1.0 and later
  3158. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3159. }
  3160. function SetMenuItemModifiers( inMenu: MenuRef; inItem: MenuItemIndex; inModifiers: UInt8 ): OSErr; external name '_SetMenuItemModifiers';
  3161. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3162. {
  3163. * GetMenuItemModifiers()
  3164. *
  3165. * Mac OS X threading:
  3166. * Not thread safe
  3167. *
  3168. * Availability:
  3169. * Mac OS X: in version 10.0 and later in Carbon.framework
  3170. * CarbonLib: in CarbonLib 1.0 and later
  3171. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3172. }
  3173. function GetMenuItemModifiers( inMenu: MenuRef; inItem: MenuItemIndex; var outModifiers: UInt8 ): OSErr; external name '_GetMenuItemModifiers';
  3174. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3175. {
  3176. * SetMenuItemIconHandle()
  3177. *
  3178. * Mac OS X threading:
  3179. * Not thread safe
  3180. *
  3181. * Availability:
  3182. * Mac OS X: in version 10.0 and later in Carbon.framework
  3183. * CarbonLib: in CarbonLib 1.0 and later
  3184. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3185. }
  3186. function SetMenuItemIconHandle( inMenu: MenuRef; inItem: MenuItemIndex; inIconType: UInt8; inIconHandle: Handle ): OSErr; external name '_SetMenuItemIconHandle';
  3187. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3188. {
  3189. * GetMenuItemIconHandle()
  3190. *
  3191. * Mac OS X threading:
  3192. * Not thread safe
  3193. *
  3194. * Availability:
  3195. * Mac OS X: in version 10.0 and later in Carbon.framework
  3196. * CarbonLib: in CarbonLib 1.0 and later
  3197. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3198. }
  3199. function GetMenuItemIconHandle( inMenu: MenuRef; inItem: MenuItemIndex; var outIconType: UInt8; var outIconHandle: Handle ): OSErr; external name '_GetMenuItemIconHandle';
  3200. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3201. {
  3202. * SetMenuItemTextEncoding()
  3203. *
  3204. * Mac OS X threading:
  3205. * Not thread safe
  3206. *
  3207. * Availability:
  3208. * Mac OS X: in version 10.0 and later in Carbon.framework
  3209. * CarbonLib: in CarbonLib 1.0 and later
  3210. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3211. }
  3212. function SetMenuItemTextEncoding( inMenu: MenuRef; inItem: MenuItemIndex; inScriptID: TextEncoding ): OSErr; external name '_SetMenuItemTextEncoding';
  3213. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3214. {
  3215. * GetMenuItemTextEncoding()
  3216. *
  3217. * Mac OS X threading:
  3218. * Not thread safe
  3219. *
  3220. * Availability:
  3221. * Mac OS X: in version 10.0 and later in Carbon.framework
  3222. * CarbonLib: in CarbonLib 1.0 and later
  3223. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3224. }
  3225. function GetMenuItemTextEncoding( inMenu: MenuRef; inItem: MenuItemIndex; var outScriptID: TextEncoding ): OSErr; external name '_GetMenuItemTextEncoding';
  3226. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3227. {
  3228. * SetMenuItemHierarchicalID()
  3229. *
  3230. * Mac OS X threading:
  3231. * Not thread safe
  3232. *
  3233. * Availability:
  3234. * Mac OS X: in version 10.0 and later in Carbon.framework
  3235. * CarbonLib: in CarbonLib 1.0 and later
  3236. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3237. }
  3238. function SetMenuItemHierarchicalID( inMenu: MenuRef; inItem: MenuItemIndex; inHierID: MenuID ): OSErr; external name '_SetMenuItemHierarchicalID';
  3239. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3240. {
  3241. * GetMenuItemHierarchicalID()
  3242. *
  3243. * Mac OS X threading:
  3244. * Not thread safe
  3245. *
  3246. * Availability:
  3247. * Mac OS X: in version 10.0 and later in Carbon.framework
  3248. * CarbonLib: in CarbonLib 1.0 and later
  3249. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3250. }
  3251. function GetMenuItemHierarchicalID( inMenu: MenuRef; inItem: MenuItemIndex; var outHierID: MenuID ): OSErr; external name '_GetMenuItemHierarchicalID';
  3252. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3253. {
  3254. * SetMenuItemFontID()
  3255. *
  3256. * Mac OS X threading:
  3257. * Not thread safe
  3258. *
  3259. * Availability:
  3260. * Mac OS X: in version 10.0 and later in Carbon.framework
  3261. * CarbonLib: in CarbonLib 1.0 and later
  3262. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3263. }
  3264. function SetMenuItemFontID( inMenu: MenuRef; inItem: MenuItemIndex; inFontID: SInt16 ): OSErr; external name '_SetMenuItemFontID';
  3265. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3266. {
  3267. * GetMenuItemFontID()
  3268. *
  3269. * Mac OS X threading:
  3270. * Not thread safe
  3271. *
  3272. * Availability:
  3273. * Mac OS X: in version 10.0 and later in Carbon.framework
  3274. * CarbonLib: in CarbonLib 1.0 and later
  3275. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3276. }
  3277. function GetMenuItemFontID( inMenu: MenuRef; inItem: MenuItemIndex; var outFontID: SInt16 ): OSErr; external name '_GetMenuItemFontID';
  3278. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3279. {
  3280. * SetMenuItemRefCon()
  3281. *
  3282. * Mac OS X threading:
  3283. * Not thread safe
  3284. *
  3285. * Availability:
  3286. * Mac OS X: in version 10.0 and later in Carbon.framework
  3287. * CarbonLib: in CarbonLib 1.0 and later
  3288. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3289. }
  3290. function SetMenuItemRefCon( inMenu: MenuRef; inItem: MenuItemIndex; inRefCon: UInt32 ): OSErr; external name '_SetMenuItemRefCon';
  3291. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3292. {
  3293. * GetMenuItemRefCon()
  3294. *
  3295. * Mac OS X threading:
  3296. * Not thread safe
  3297. *
  3298. * Availability:
  3299. * Mac OS X: in version 10.0 and later in Carbon.framework
  3300. * CarbonLib: in CarbonLib 1.0 and later
  3301. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3302. }
  3303. function GetMenuItemRefCon( inMenu: MenuRef; inItem: MenuItemIndex; var outRefCon: UInt32 ): OSErr; external name '_GetMenuItemRefCon';
  3304. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3305. { Please use the menu item property APIs in Carbon.}
  3306. {
  3307. * SetMenuItemRefCon2()
  3308. *
  3309. * Availability:
  3310. * Mac OS X: not available
  3311. * CarbonLib: not available
  3312. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3313. }
  3314. {
  3315. * GetMenuItemRefCon2()
  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. * SetMenuItemKeyGlyph()
  3324. *
  3325. * Summary:
  3326. * Sets the command key glyph code for a menu item.
  3327. *
  3328. * Discussion:
  3329. * A menu item's command key may be customized using a key glyph
  3330. * code; these codes are the kMenu*Glyph constants documented in
  3331. * Menus.h. In classic Mac OS, a glyph code is only used for
  3332. * display; it does not affect command key matching. In Carbon, a
  3333. * menu item's glyph code is used for command key matching if the
  3334. * menu item does not have a command key character or virtual
  3335. * keycode assigned to it.
  3336. *
  3337. * In CarbonLib 1.2 and Mac OS X 10.0 and later, the Menu Manager
  3338. * will automatically draw the appropriate glyph for a menu item
  3339. * that has a virtual keycode command key assigned to it; it is not
  3340. * necessary to set both the virtual keycode and the glyph for an
  3341. * item.
  3342. *
  3343. * Mac OS X threading:
  3344. * Not thread safe
  3345. *
  3346. * Parameters:
  3347. *
  3348. * inMenu:
  3349. * The menu to change.
  3350. *
  3351. * inItem:
  3352. * The menu item to change.
  3353. *
  3354. * inGlyph:
  3355. * The new glyph code for the item, or zero to remove the item's
  3356. * glyph code.
  3357. *
  3358. * Availability:
  3359. * Mac OS X: in version 10.0 and later in Carbon.framework
  3360. * CarbonLib: in CarbonLib 1.0 and later
  3361. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3362. }
  3363. function SetMenuItemKeyGlyph( inMenu: MenuRef; inItem: MenuItemIndex; inGlyph: SInt16 ): OSErr; external name '_SetMenuItemKeyGlyph';
  3364. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3365. {
  3366. * GetMenuItemKeyGlyph()
  3367. *
  3368. * Mac OS X threading:
  3369. * Not thread safe
  3370. *
  3371. * Availability:
  3372. * Mac OS X: in version 10.0 and later in Carbon.framework
  3373. * CarbonLib: in CarbonLib 1.0 and later
  3374. * Non-Carbon CFM: in AppearanceLib 1.0 and later
  3375. }
  3376. function GetMenuItemKeyGlyph( inMenu: MenuRef; inItem: MenuItemIndex; var outGlyph: SInt16 ): OSErr; external name '_GetMenuItemKeyGlyph';
  3377. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3378. { Routines available in Mac OS 8.5 and later (supporting enabling/disabling of > 31 items)}
  3379. {
  3380. * [Mac]EnableMenuItem()
  3381. *
  3382. * Mac OS X threading:
  3383. * Not thread safe
  3384. *
  3385. * Availability:
  3386. * Mac OS X: in version 10.0 and later in Carbon.framework
  3387. * CarbonLib: in CarbonLib 1.0 and later
  3388. * Non-Carbon CFM: in MenusLib 8.5 and later
  3389. }
  3390. procedure EnableMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_EnableMenuItem';
  3391. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3392. procedure MacEnableMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_EnableMenuItem';
  3393. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3394. {
  3395. * DisableMenuItem()
  3396. *
  3397. * Mac OS X threading:
  3398. * Not thread safe
  3399. *
  3400. * Availability:
  3401. * Mac OS X: in version 10.0 and later in Carbon.framework
  3402. * CarbonLib: in CarbonLib 1.0 and later
  3403. * Non-Carbon CFM: in MenusLib 8.5 and later
  3404. }
  3405. procedure DisableMenuItem( theMenu: MenuRef; item: MenuItemIndex ); external name '_DisableMenuItem';
  3406. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3407. {
  3408. * IsMenuItemEnabled()
  3409. *
  3410. * Mac OS X threading:
  3411. * Not thread safe
  3412. *
  3413. * Availability:
  3414. * Mac OS X: in version 10.0 and later in Carbon.framework
  3415. * CarbonLib: in CarbonLib 1.0 and later
  3416. * Non-Carbon CFM: in MenusLib 8.5 and later
  3417. }
  3418. function IsMenuItemEnabled( menu: MenuRef; item: MenuItemIndex ): Boolean; external name '_IsMenuItemEnabled';
  3419. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3420. {
  3421. * EnableMenuItemIcon()
  3422. *
  3423. * Mac OS X threading:
  3424. * Not thread safe
  3425. *
  3426. * Availability:
  3427. * Mac OS X: in version 10.0 and later in Carbon.framework
  3428. * CarbonLib: in CarbonLib 1.0 and later
  3429. * Non-Carbon CFM: in MenusLib 8.5 and later
  3430. }
  3431. procedure EnableMenuItemIcon( theMenu: MenuRef; item: MenuItemIndex ); external name '_EnableMenuItemIcon';
  3432. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3433. {
  3434. * DisableMenuItemIcon()
  3435. *
  3436. * Mac OS X threading:
  3437. * Not thread safe
  3438. *
  3439. * Availability:
  3440. * Mac OS X: in version 10.0 and later in Carbon.framework
  3441. * CarbonLib: in CarbonLib 1.0 and later
  3442. * Non-Carbon CFM: in MenusLib 8.5 and later
  3443. }
  3444. procedure DisableMenuItemIcon( theMenu: MenuRef; item: MenuItemIndex ); external name '_DisableMenuItemIcon';
  3445. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3446. {
  3447. * IsMenuItemIconEnabled()
  3448. *
  3449. * Mac OS X threading:
  3450. * Not thread safe
  3451. *
  3452. * Availability:
  3453. * Mac OS X: in version 10.0 and later in Carbon.framework
  3454. * CarbonLib: in CarbonLib 1.0 and later
  3455. * Non-Carbon CFM: in MenusLib 8.5 and later
  3456. }
  3457. function IsMenuItemIconEnabled( menu: MenuRef; item: MenuItemIndex ): Boolean; external name '_IsMenuItemIconEnabled';
  3458. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3459. {
  3460. * SetMenuItemHierarchicalMenu()
  3461. *
  3462. * Summary:
  3463. * Attaches a submenu to a menu item.
  3464. *
  3465. * Discussion:
  3466. * Using SetMenuItemHierarchicalMenu, it is possible to directly
  3467. * specify the submenu for a menu item without specifying its menu
  3468. * ID. It is not necessary to insert the submenu into the
  3469. * hierarchical portion of the menubar, and it is not necessary for
  3470. * the submenu to have a unique menu ID; it is recommended that you
  3471. * use 0 as the menu ID for the submenu, and identify selections
  3472. * from the menu by command ID. The Menu Manager will increment the
  3473. * refcount of the submenu that you specify, and the submenu's
  3474. * refcount will be decremented automatically when the parent menu
  3475. * item is deleted or the parent menu is disposed.
  3476. *
  3477. * Mac OS X threading:
  3478. * Not thread safe
  3479. *
  3480. * Parameters:
  3481. *
  3482. * inMenu:
  3483. * The parent menu.
  3484. *
  3485. * inItem:
  3486. * The parent item.
  3487. *
  3488. * inHierMenu:
  3489. * The submenu. You may pass NULL to remove any existing submenu.
  3490. *
  3491. * Availability:
  3492. * Mac OS X: in version 10.0 and later in Carbon.framework
  3493. * CarbonLib: in CarbonLib 1.1 and later
  3494. * Non-Carbon CFM: not available
  3495. }
  3496. function SetMenuItemHierarchicalMenu( inMenu: MenuRef; inItem: MenuItemIndex; inHierMenu: MenuRef { can be NULL } ): OSStatus; external name '_SetMenuItemHierarchicalMenu';
  3497. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3498. {
  3499. * GetMenuItemHierarchicalMenu()
  3500. *
  3501. * Summary:
  3502. * Returns the submenu attached to a menu item.
  3503. *
  3504. * Discussion:
  3505. * GetMenuItemHierarchicalMenu will return the submenu attached to a
  3506. * menu item regardless of how the submenu was specified. If the
  3507. * submenu was specified by menu ID (using SetItemCmd or
  3508. * SetMenuItemHierarchicalID), GetMenuItemHierarchicalMenu will
  3509. * return the currently installed menu with that ID, if any. The
  3510. * only case where GetMenuItemHierarchicalMenu will fail to return
  3511. * the item's submenu is when the submenu is specified by menu ID,
  3512. * but the submenu is not currently inserted in the menu bar.
  3513. *
  3514. * Mac OS X threading:
  3515. * Not thread safe
  3516. *
  3517. * Parameters:
  3518. *
  3519. * inMenu:
  3520. * The parent menu.
  3521. *
  3522. * inItem:
  3523. * The parent item.
  3524. *
  3525. * outHierMenu:
  3526. * On exit, the item's submenu, or NULL if it does not have one.
  3527. *
  3528. * Availability:
  3529. * Mac OS X: in version 10.0 and later in Carbon.framework
  3530. * CarbonLib: in CarbonLib 1.1 and later
  3531. * Non-Carbon CFM: not available
  3532. }
  3533. function GetMenuItemHierarchicalMenu( inMenu: MenuRef; inItem: MenuItemIndex; var outHierMenu: MenuRef ): OSStatus; external name '_GetMenuItemHierarchicalMenu';
  3534. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3535. {
  3536. * CopyMenuItemTextAsCFString()
  3537. *
  3538. * Summary:
  3539. * Returns a CFString containing the text of a menu item.
  3540. *
  3541. * Mac OS X threading:
  3542. * Not thread safe
  3543. *
  3544. * Parameters:
  3545. *
  3546. * inMenu:
  3547. * The menu containing the item.
  3548. *
  3549. * inItem:
  3550. * The item whose text to return.
  3551. *
  3552. * outString:
  3553. * On exit, a CFString containing the item's text. This string
  3554. * must be released by the caller.
  3555. *
  3556. * Availability:
  3557. * Mac OS X: in version 10.0 and later in Carbon.framework
  3558. * CarbonLib: in CarbonLib 1.1 and later
  3559. * Non-Carbon CFM: not available
  3560. }
  3561. function CopyMenuItemTextAsCFString( inMenu: MenuRef; inItem: MenuItemIndex; var outString: CFStringRef ): OSStatus; external name '_CopyMenuItemTextAsCFString';
  3562. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3563. {
  3564. * SetMenuItemTextWithCFString()
  3565. *
  3566. * Summary:
  3567. * Sets the text of a menu item to the text contained in a CFString.
  3568. *
  3569. * Discussion:
  3570. * The Menu Manager will either make its own copy or just increment
  3571. * the refcount of the CFString before returning from
  3572. * SetMenuItemTextWithCFString, depending on whether the string is
  3573. * mutable or immutable. If the string is mutable, modifying the
  3574. * string after calling SetMenuItemTextWithCFString will have no
  3575. * effect on the menu item's actual text. The caller may release the
  3576. * string after calling SetMenuItemTextWithCFString.
  3577. *
  3578. * Mac OS X threading:
  3579. * Not thread safe
  3580. *
  3581. * Parameters:
  3582. *
  3583. * inMenu:
  3584. * The menu containing the item.
  3585. *
  3586. * inItem:
  3587. * The item whose text to return.
  3588. *
  3589. * inString:
  3590. * The string containing the new menu item text.
  3591. *
  3592. * Availability:
  3593. * Mac OS X: in version 10.0 and later in Carbon.framework
  3594. * CarbonLib: in CarbonLib 1.1 and later
  3595. * Non-Carbon CFM: not available
  3596. }
  3597. function SetMenuItemTextWithCFString( inMenu: MenuRef; inItem: MenuItemIndex; inString: CFStringRef ): OSStatus; external name '_SetMenuItemTextWithCFString';
  3598. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3599. {
  3600. * GetMenuItemIndent()
  3601. *
  3602. * Summary:
  3603. * Gets the indent level of a menu item.
  3604. *
  3605. * Discussion:
  3606. * The indent level of an item is an amount of extra space added to
  3607. * the left of the item's icon or checkmark. The level is simply a
  3608. * number, starting at zero, which the Menu Manager multiplies by a
  3609. * constant to get the indent in pixels. The default indent level is
  3610. * zero.
  3611. *
  3612. * Mac OS X threading:
  3613. * Not thread safe
  3614. *
  3615. * Parameters:
  3616. *
  3617. * inMenu:
  3618. * The menu containing the item.
  3619. *
  3620. * inItem:
  3621. * The item whose indent to retrieve.
  3622. *
  3623. * outIndent:
  3624. * On exit, the indent level of the item.
  3625. *
  3626. * Availability:
  3627. * Mac OS X: in version 10.0 and later in Carbon.framework
  3628. * CarbonLib: in CarbonLib 1.1 and later
  3629. * Non-Carbon CFM: not available
  3630. }
  3631. function GetMenuItemIndent( inMenu: MenuRef; inItem: MenuItemIndex; var outIndent: UInt32 ): OSStatus; external name '_GetMenuItemIndent';
  3632. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3633. {
  3634. * SetMenuItemIndent()
  3635. *
  3636. * Summary:
  3637. * Sets the indent level of a menu item.
  3638. *
  3639. * Discussion:
  3640. * The indent level of an item is an amount of extra space added to
  3641. * the left of the item's icon or checkmark. The level is simply a
  3642. * number, starting at zero, which the Menu Manager multiplies by a
  3643. * constant to get the indent in pixels. The default indent level is
  3644. * zero.
  3645. *
  3646. * Mac OS X threading:
  3647. * Not thread safe
  3648. *
  3649. * Parameters:
  3650. *
  3651. * inMenu:
  3652. * The menu containing the item.
  3653. *
  3654. * inItem:
  3655. * The item whose indent to set.
  3656. *
  3657. * inIndent:
  3658. * The new indent level of the item.
  3659. *
  3660. * Availability:
  3661. * Mac OS X: in version 10.0 and later in Carbon.framework
  3662. * CarbonLib: in CarbonLib 1.1 and later
  3663. * Non-Carbon CFM: not available
  3664. }
  3665. function SetMenuItemIndent( inMenu: MenuRef; inItem: MenuItemIndex; inIndent: UInt32 ): OSStatus; external name '_SetMenuItemIndent';
  3666. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3667. {
  3668. * GetMenuItemCommandKey()
  3669. *
  3670. * Summary:
  3671. * Gets the keyboard equivalent of a menu item.
  3672. *
  3673. * Discussion:
  3674. * A menu item's keyboard equivalent may be either a character code
  3675. * or a virtual keycode. An item's character code and virtual
  3676. * keycode are stored separately and may contain different values,
  3677. * but only one is used by the Menu Manager at any given time. When
  3678. * requesting a menu item's virtual keycode equivalent, you should
  3679. * first check that the item is using a virtual keycode by testing
  3680. * the kMenuItemAttrUseVirtualKey attribute for that item. If this
  3681. * attribute is not set, the item's virtual keycode is ignored by
  3682. * the Menu Manager. Note that zero is a valid virtual keycode, so
  3683. * you cannot test the returned keycode against zero to determine if
  3684. * the item is using a virtual keycode equivalent. You must test the
  3685. * kMenuItemAttrUseVirtualKey attribute.
  3686. *
  3687. * Mac OS X threading:
  3688. * Not thread safe
  3689. *
  3690. * Parameters:
  3691. *
  3692. * inMenu:
  3693. * The menu containing the item.
  3694. *
  3695. * inItem:
  3696. * The item whose keyboard equivalent to retrieve.
  3697. *
  3698. * inGetVirtualKey:
  3699. * Indicates whether to retrieve the item's character code or
  3700. * virtual keycode equivalent.
  3701. *
  3702. * outKey:
  3703. * On exit, the keyboard equivalent of the item.
  3704. *
  3705. * Availability:
  3706. * Mac OS X: in version 10.0 and later in Carbon.framework
  3707. * CarbonLib: in CarbonLib 1.1 and later
  3708. * Non-Carbon CFM: not available
  3709. }
  3710. function GetMenuItemCommandKey( inMenu: MenuRef; inItem: MenuItemIndex; inGetVirtualKey: Boolean; var outKey: UInt16 ): OSStatus; external name '_GetMenuItemCommandKey';
  3711. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3712. {
  3713. * SetMenuItemCommandKey()
  3714. *
  3715. * Summary:
  3716. * Sets the keyboard equivalent of a menu item.
  3717. *
  3718. * Discussion:
  3719. * A menu item's keyboard equivalent may be either a character code
  3720. * or a virtual keycode. The character code is always used to draw
  3721. * the item's keyboard equivalent in the menu, but either may be
  3722. * used for keyboard equivalent matching by MenuEvent and
  3723. * IsMenuKeyEvent, depending on whether the
  3724. * kMenuItemAttrUseVirtualKey item attribute is set. If
  3725. * SetMenuItemCommandKey is used to set the virtual keycode
  3726. * equivalent for a menu item, it also automatically sets the
  3727. * kMenuItemAttrUseVirtualKey item attribute. To make the menu item
  3728. * stop using the virtual keycode equivalent and use the character
  3729. * code equivalent instead, use ChangeMenuItemAttributes to clear
  3730. * the kMenuItemAttrUseVirtualKey item attribute.
  3731. *
  3732. * Mac OS X threading:
  3733. * Not thread safe
  3734. *
  3735. * Parameters:
  3736. *
  3737. * inMenu:
  3738. * The menu containing the item.
  3739. *
  3740. * inItem:
  3741. * The item whose keyboard equivalent to set.
  3742. *
  3743. * inSetVirtualKey:
  3744. * Indicates whether to set the item's character code or virtual
  3745. * keycode equivalent.
  3746. *
  3747. * inKey:
  3748. * The item's new character code or virtual keycode equivalent.
  3749. *
  3750. * Availability:
  3751. * Mac OS X: in version 10.0 and later in Carbon.framework
  3752. * CarbonLib: in CarbonLib 1.1 and later
  3753. * Non-Carbon CFM: not available
  3754. }
  3755. function SetMenuItemCommandKey( inMenu: MenuRef; inItem: MenuItemIndex; inSetVirtualKey: Boolean; inKey: UInt16 ): OSStatus; external name '_SetMenuItemCommandKey';
  3756. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3757. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3758. { ¥ Menu Item Color Tables }
  3759. { Menu color manipulation is considered deprecated with the advent of the Appearance }
  3760. { Manager. Avoid using these routines if possible }
  3761. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3762. {
  3763. * DeleteMCEntries()
  3764. *
  3765. * Mac OS X threading:
  3766. * Not thread safe
  3767. *
  3768. * Availability:
  3769. * Mac OS X: in version 10.0 and later in Carbon.framework
  3770. * CarbonLib: in CarbonLib 1.0 and later
  3771. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3772. }
  3773. procedure DeleteMCEntries( menuID_: MenuID; menuItem: SInt16 ); external name '_DeleteMCEntries';
  3774. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3775. {
  3776. * GetMCInfo()
  3777. *
  3778. * Mac OS X threading:
  3779. * Not thread safe
  3780. *
  3781. * Availability:
  3782. * Mac OS X: in version 10.0 and later in Carbon.framework
  3783. * CarbonLib: in CarbonLib 1.0 and later
  3784. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3785. }
  3786. function GetMCInfo: MCTableHandle; external name '_GetMCInfo';
  3787. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3788. {
  3789. * SetMCInfo()
  3790. *
  3791. * Mac OS X threading:
  3792. * Not thread safe
  3793. *
  3794. * Availability:
  3795. * Mac OS X: in version 10.0 and later in Carbon.framework
  3796. * CarbonLib: in CarbonLib 1.0 and later
  3797. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3798. }
  3799. procedure SetMCInfo( menuCTbl: MCTableHandle ); external name '_SetMCInfo';
  3800. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3801. {
  3802. * DisposeMCInfo()
  3803. *
  3804. * Mac OS X threading:
  3805. * Not thread safe
  3806. *
  3807. * Availability:
  3808. * Mac OS X: in version 10.0 and later in Carbon.framework
  3809. * CarbonLib: in CarbonLib 1.0 and later
  3810. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3811. }
  3812. procedure DisposeMCInfo( menuCTbl: MCTableHandle ); external name '_DisposeMCInfo';
  3813. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3814. {
  3815. * GetMCEntry()
  3816. *
  3817. * Mac OS X threading:
  3818. * Not thread safe
  3819. *
  3820. * Availability:
  3821. * Mac OS X: in version 10.0 and later in Carbon.framework
  3822. * CarbonLib: in CarbonLib 1.0 and later
  3823. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3824. }
  3825. function GetMCEntry( menuID_: MenuID; menuItem: SInt16 ): MCEntryPtr; external name '_GetMCEntry';
  3826. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3827. {
  3828. * SetMCEntries()
  3829. *
  3830. * Mac OS X threading:
  3831. * Not thread safe
  3832. *
  3833. * Availability:
  3834. * Mac OS X: in version 10.0 and later in Carbon.framework
  3835. * CarbonLib: in CarbonLib 1.0 and later
  3836. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  3837. }
  3838. procedure SetMCEntries( numEntries: SInt16; menuCEntries: MCTablePtr ); external name '_SetMCEntries';
  3839. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3840. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3841. { ¥ Properties (Mac OS 8.5 and later) }
  3842. { With the following property APIs, you can attach any piece of data you'd like to a }
  3843. { menu or menu item. Passing zero for the item number parameter indicates you'd like }
  3844. { to attach the data to the menu itself, and not to any specific menu item. }
  3845. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3846. const
  3847. kMenuPropertyPersistent = $00000001; { whether this property gets saved when flattening the menu}
  3848. {
  3849. * GetMenuItemProperty()
  3850. *
  3851. * Mac OS X threading:
  3852. * Not thread safe
  3853. *
  3854. * Availability:
  3855. * Mac OS X: in version 10.0 and later in Carbon.framework
  3856. * CarbonLib: in CarbonLib 1.0 and later
  3857. * Non-Carbon CFM: in MenusLib 8.5 and later
  3858. }
  3859. function GetMenuItemProperty( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; bufferSize: UInt32; var actualSize: UInt32; propertyBuffer: UnivPtr ): OSStatus; external name '_GetMenuItemProperty';
  3860. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3861. {
  3862. * GetMenuItemPropertySize()
  3863. *
  3864. * Mac OS X threading:
  3865. * Not thread safe
  3866. *
  3867. * Availability:
  3868. * Mac OS X: in version 10.0 and later in Carbon.framework
  3869. * CarbonLib: in CarbonLib 1.0 and later
  3870. * Non-Carbon CFM: in MenusLib 8.5 and later
  3871. }
  3872. function GetMenuItemPropertySize( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; var size: UInt32 ): OSStatus; external name '_GetMenuItemPropertySize';
  3873. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3874. {
  3875. * SetMenuItemProperty()
  3876. *
  3877. * Mac OS X threading:
  3878. * Not thread safe
  3879. *
  3880. * Availability:
  3881. * Mac OS X: in version 10.0 and later in Carbon.framework
  3882. * CarbonLib: in CarbonLib 1.0 and later
  3883. * Non-Carbon CFM: in MenusLib 8.5 and later
  3884. }
  3885. function SetMenuItemProperty( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; propertySize: UInt32; propertyData: {const} UnivPtr ): OSStatus; external name '_SetMenuItemProperty';
  3886. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3887. {
  3888. * RemoveMenuItemProperty()
  3889. *
  3890. * Mac OS X threading:
  3891. * Not thread safe
  3892. *
  3893. * Availability:
  3894. * Mac OS X: in version 10.0 and later in Carbon.framework
  3895. * CarbonLib: in CarbonLib 1.0 and later
  3896. * Non-Carbon CFM: in MenusLib 8.5 and later
  3897. }
  3898. function RemoveMenuItemProperty( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType ): OSStatus; external name '_RemoveMenuItemProperty';
  3899. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3900. {
  3901. * GetMenuItemPropertyAttributes()
  3902. *
  3903. * Summary:
  3904. * Gets the attributes of a menu item property.
  3905. *
  3906. * Mac OS X threading:
  3907. * Not thread safe
  3908. *
  3909. * Parameters:
  3910. *
  3911. * menu:
  3912. * The menu.
  3913. *
  3914. * item:
  3915. * The menu item.
  3916. *
  3917. * propertyCreator:
  3918. * The creator code of the property.
  3919. *
  3920. * propertyTag:
  3921. * The property tag.
  3922. *
  3923. * attributes:
  3924. * On exit, contains the attributes of the property.
  3925. *
  3926. * Availability:
  3927. * Mac OS X: in version 10.0 and later in Carbon.framework
  3928. * CarbonLib: in CarbonLib 1.0 and later
  3929. * Non-Carbon CFM: not available
  3930. }
  3931. function GetMenuItemPropertyAttributes( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; var attributes: UInt32 ): OSStatus; external name '_GetMenuItemPropertyAttributes';
  3932. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3933. {
  3934. * ChangeMenuItemPropertyAttributes()
  3935. *
  3936. * Summary:
  3937. * Changes the attributes of a menu item property.
  3938. *
  3939. * Mac OS X threading:
  3940. * Not thread safe
  3941. *
  3942. * Parameters:
  3943. *
  3944. * menu:
  3945. * The menu.
  3946. *
  3947. * item:
  3948. * The menu item.
  3949. *
  3950. * propertyCreator:
  3951. * The creator code of the property.
  3952. *
  3953. * propertyTag:
  3954. * The property tag.
  3955. *
  3956. * attributesToSet:
  3957. * The attributes to add to the menu item property.
  3958. *
  3959. * attributesToClear:
  3960. * The attributes to remove from the menu item property.
  3961. *
  3962. * Availability:
  3963. * Mac OS X: in version 10.0 and later in Carbon.framework
  3964. * CarbonLib: in CarbonLib 1.0 and later
  3965. * Non-Carbon CFM: not available
  3966. }
  3967. function ChangeMenuItemPropertyAttributes( menu: MenuRef; item: MenuItemIndex; propertyCreator: OSType; propertyTag: OSType; attributesToSet: UInt32; attributesToClear: UInt32 ): OSStatus; external name '_ChangeMenuItemPropertyAttributes';
  3968. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3969. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3970. { ¥ Attributes (Carbon and later) }
  3971. { Each menu and menu item has attribute flags. }
  3972. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  3973. {
  3974. * GetMenuAttributes()
  3975. *
  3976. * Summary:
  3977. * Gets the attributes of a menu.
  3978. *
  3979. * Mac OS X threading:
  3980. * Not thread safe
  3981. *
  3982. * Parameters:
  3983. *
  3984. * menu:
  3985. * The menu.
  3986. *
  3987. * outAttributes:
  3988. * On exit, contains the attributes of the menu.
  3989. *
  3990. * Availability:
  3991. * Mac OS X: in version 10.0 and later in Carbon.framework
  3992. * CarbonLib: in CarbonLib 1.0 and later
  3993. * Non-Carbon CFM: not available
  3994. }
  3995. function GetMenuAttributes( menu: MenuRef; var outAttributes: MenuAttributes ): OSStatus; external name '_GetMenuAttributes';
  3996. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  3997. {
  3998. * ChangeMenuAttributes()
  3999. *
  4000. * Summary:
  4001. * Changes the attributes of a menu.
  4002. *
  4003. * Mac OS X threading:
  4004. * Not thread safe
  4005. *
  4006. * Parameters:
  4007. *
  4008. * menu:
  4009. * The menu.
  4010. *
  4011. * setTheseAttributes:
  4012. * The attributes to add to the menu.
  4013. *
  4014. * clearTheseAttributes:
  4015. * The attributes to remove from the menu.
  4016. *
  4017. * Availability:
  4018. * Mac OS X: in version 10.0 and later in Carbon.framework
  4019. * CarbonLib: in CarbonLib 1.0 and later
  4020. * Non-Carbon CFM: not available
  4021. }
  4022. function ChangeMenuAttributes( menu: MenuRef; setTheseAttributes: MenuAttributes; clearTheseAttributes: MenuAttributes ): OSStatus; external name '_ChangeMenuAttributes';
  4023. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4024. {
  4025. * GetMenuItemAttributes()
  4026. *
  4027. * Summary:
  4028. * Gets the attributes of a menu item.
  4029. *
  4030. * Mac OS X threading:
  4031. * Not thread safe
  4032. *
  4033. * Parameters:
  4034. *
  4035. * menu:
  4036. * The menu.
  4037. *
  4038. * item:
  4039. * The menu item.
  4040. *
  4041. * outAttributes:
  4042. * On exit, contains the attributes of the menu item.
  4043. *
  4044. * Availability:
  4045. * Mac OS X: in version 10.0 and later in Carbon.framework
  4046. * CarbonLib: in CarbonLib 1.0 and later
  4047. * Non-Carbon CFM: not available
  4048. }
  4049. function GetMenuItemAttributes( menu: MenuRef; item: MenuItemIndex; var outAttributes: MenuItemAttributes ): OSStatus; external name '_GetMenuItemAttributes';
  4050. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4051. {
  4052. * ChangeMenuItemAttributes()
  4053. *
  4054. * Summary:
  4055. * Changes the attributes of a menu item.
  4056. *
  4057. * Mac OS X threading:
  4058. * Not thread safe
  4059. *
  4060. * Parameters:
  4061. *
  4062. * menu:
  4063. * The menu.
  4064. *
  4065. * item:
  4066. * The menu item.
  4067. *
  4068. * setTheseAttributes:
  4069. * The attributes to add to the menu item.
  4070. *
  4071. * clearTheseAttributes:
  4072. * The attributes to remove from the menu item.
  4073. *
  4074. * Availability:
  4075. * Mac OS X: in version 10.0 and later in Carbon.framework
  4076. * CarbonLib: in CarbonLib 1.0 and later
  4077. * Non-Carbon CFM: not available
  4078. }
  4079. function ChangeMenuItemAttributes( menu: MenuRef; item: MenuItemIndex; setTheseAttributes: MenuItemAttributes; clearTheseAttributes: MenuItemAttributes ): OSStatus; external name '_ChangeMenuItemAttributes';
  4080. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4081. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4082. { ¥ Mass menu item enabling and disabling (Carbon and later) }
  4083. { Useful when rewriting code that modifies the enableFlags field directly. }
  4084. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4085. {
  4086. * DisableAllMenuItems()
  4087. *
  4088. * Summary:
  4089. * Disables all items in a menu.
  4090. *
  4091. * Discussion:
  4092. * This API is equivalent to pre-Carbon code that masked the
  4093. * enableFlags field of the MenuInfo with 0x01. It disables all
  4094. * items (including items past item 31) but does not affect the
  4095. * state of the menu title.
  4096. *
  4097. * Mac OS X threading:
  4098. * Not thread safe
  4099. *
  4100. * Parameters:
  4101. *
  4102. * theMenu:
  4103. * The menu whose items to disable.
  4104. *
  4105. * Availability:
  4106. * Mac OS X: in version 10.0 and later in Carbon.framework
  4107. * CarbonLib: in CarbonLib 1.0 and later
  4108. * Non-Carbon CFM: not available
  4109. }
  4110. procedure DisableAllMenuItems( theMenu: MenuRef ); external name '_DisableAllMenuItems';
  4111. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4112. {
  4113. * EnableAllMenuItems()
  4114. *
  4115. * Summary:
  4116. * Enables all items in a menu.
  4117. *
  4118. * Discussion:
  4119. * This API is equivalent to pre-Carbon code that or'd the
  4120. * enableFlags field of the MenuInfo with 0xFFFFFFFE. It enables all
  4121. * items (including items past item 31) but does not affect the
  4122. * state of the menu title.
  4123. *
  4124. * Mac OS X threading:
  4125. * Not thread safe
  4126. *
  4127. * Parameters:
  4128. *
  4129. * theMenu:
  4130. * The menu whose items to enable.
  4131. *
  4132. * Availability:
  4133. * Mac OS X: in version 10.0 and later in Carbon.framework
  4134. * CarbonLib: in CarbonLib 1.0 and later
  4135. * Non-Carbon CFM: not available
  4136. }
  4137. procedure EnableAllMenuItems( theMenu: MenuRef ); external name '_EnableAllMenuItems';
  4138. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4139. {
  4140. * MenuHasEnabledItems()
  4141. *
  4142. * Summary:
  4143. * Determines if any items in a menu are enabled.
  4144. *
  4145. * Discussion:
  4146. * This API is equivalent to pre-Carbon code that compared the
  4147. * enableFlags field of the MenuInfo with 0. It checks the enable
  4148. * state of all items to see if any are enabled, but ignores the
  4149. * state of the menu title. It will return true even if the menu
  4150. * title is disabled.
  4151. *
  4152. * Mac OS X threading:
  4153. * Not thread safe
  4154. *
  4155. * Parameters:
  4156. *
  4157. * theMenu:
  4158. * The menu whose items to examine.
  4159. *
  4160. * Availability:
  4161. * Mac OS X: in version 10.0 and later in Carbon.framework
  4162. * CarbonLib: in CarbonLib 1.0 and later
  4163. * Non-Carbon CFM: not available
  4164. }
  4165. function MenuHasEnabledItems( theMenu: MenuRef ): Boolean; external name '_MenuHasEnabledItems';
  4166. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4167. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4168. { ¥ Menu tracking status (Carbon and later) }
  4169. { Get info about the selected menu item during menu tracking. Replaces direct access }
  4170. { to low-mem globals that previously held this info. }
  4171. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4172. {
  4173. * GetMenuTrackingData()
  4174. *
  4175. * Summary:
  4176. * Gets information about the menu currently selected by the user.
  4177. *
  4178. * Discussion:
  4179. * This API replaces direct access to the low-memory globals
  4180. * TopMenuItem, AtMenuBottom, MenuDisable, and mbSaveLoc. It is only
  4181. * valid to call this API while menu tracking is occurring. This API
  4182. * will most commonly be used by custom MDEFs.
  4183. *
  4184. * Mac OS X threading:
  4185. * Not thread safe
  4186. *
  4187. * Parameters:
  4188. *
  4189. * theMenu:
  4190. * The menu about which to get tracking information. May be NULL
  4191. * to get information about the menu that the user is currently
  4192. * selecting. If the menu is not currently open, menuNotFoundErr
  4193. * is returned.
  4194. *
  4195. * outData:
  4196. * On exit, contains tracking data about the menu. On CarbonLib,
  4197. * the itemRect field is not supported and is always set to an
  4198. * empty rect.
  4199. *
  4200. * Availability:
  4201. * Mac OS X: in version 10.0 and later in Carbon.framework
  4202. * CarbonLib: in CarbonLib 1.0 and later
  4203. * Non-Carbon CFM: not available
  4204. }
  4205. function GetMenuTrackingData( theMenu: MenuRef; var outData: MenuTrackingData ): OSStatus; external name '_GetMenuTrackingData';
  4206. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4207. {
  4208. * GetMenuType()
  4209. *
  4210. * Summary:
  4211. * Gets the display type (pulldown, hierarchical, or popup) of a
  4212. * menu.
  4213. *
  4214. * Discussion:
  4215. * This API may only be called when the menu is displayed. If the
  4216. * menu is not currently open, an error is returned. The display
  4217. * type of a menu may vary from one menu tracking session to
  4218. * another; for example, the same menu might be displayed as a
  4219. * pulldown menu and as a popup menu.
  4220. *
  4221. * Mac OS X threading:
  4222. * Not thread safe
  4223. *
  4224. * Parameters:
  4225. *
  4226. * theMenu:
  4227. * The menu whose type to get.
  4228. *
  4229. * outType:
  4230. * On exit, the type of the menu. The returned value will be one
  4231. * of the ThemeMenuType constants: kThemeMenuTypePullDown, PopUp,
  4232. * or Hierarchical. The kThemeMenuTypeInactive bit will never be
  4233. * set.
  4234. *
  4235. * Availability:
  4236. * Mac OS X: in version 10.0 and later in Carbon.framework
  4237. * CarbonLib: in CarbonLib 1.1 and later
  4238. * Non-Carbon CFM: not available
  4239. }
  4240. function GetMenuType( theMenu: MenuRef; var outType: UInt16 ): OSStatus; external name '_GetMenuType';
  4241. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4242. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4243. { ¥ÊUniversal command ID access (Carbon and later) }
  4244. { These APIs allow you to operate on menu items strictly by command ID, with no }
  4245. { knowledge of a menu item's index. }
  4246. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4247. {
  4248. * CountMenuItemsWithCommandID()
  4249. *
  4250. * Summary:
  4251. * Counts the menu items with a specified command ID.
  4252. *
  4253. * Discussion:
  4254. * In CarbonLib 1.0.x and 1.1, this API always returns zero or one;
  4255. * it stops after finding the first menu item with the specified
  4256. * command ID. In CarbonLib 1.2 and Mac OS X 10.0 and later, it
  4257. * counts all menu items with the specified command ID. In Mac OS X
  4258. * 10.0 and CarbonLib 1.0 through 1.4, this API only searches
  4259. * top-level menus (menus visible in the menubar) and submenus of
  4260. * top-level menus. It does not search hierarchical menus that are
  4261. * inserted in the menubar but are not submenus of a top-level menus
  4262. * (for example, it does not search menus that are inserted for use
  4263. * in a popup menu control). In Mac OS X 10.1 and CarbonLib 1.5 and
  4264. * later, this API also searches inserted hierarchical menus.
  4265. *
  4266. * Mac OS X threading:
  4267. * Not thread safe
  4268. *
  4269. * Parameters:
  4270. *
  4271. * inMenu:
  4272. * The menu in which to begin searching for items with the
  4273. * specified command ID. Pass NULL to hegin searching with the
  4274. * root menu. The search will descend into all submenus of this
  4275. * menu.
  4276. *
  4277. * inCommandID:
  4278. * The command ID for which to search.
  4279. *
  4280. * Availability:
  4281. * Mac OS X: in version 10.0 and later in Carbon.framework
  4282. * CarbonLib: in CarbonLib 1.0 and later
  4283. * Non-Carbon CFM: not available
  4284. }
  4285. function CountMenuItemsWithCommandID( inMenu: MenuRef; inCommandID: MenuCommand ): ItemCount; external name '_CountMenuItemsWithCommandID';
  4286. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4287. {
  4288. * GetIndMenuItemWithCommandID()
  4289. *
  4290. * Summary:
  4291. * Finds a menu item with a specified command ID.
  4292. *
  4293. * Discussion:
  4294. * This API searches the specified menu and its submenus for the
  4295. * n'th menu item with the specified command ID. In CarbonLib 1.0.x
  4296. * and 1.1, only the first menu item is returned. In CarbonLib 1.2
  4297. * and Mac OS X 10.0 and later, this API iterates over all menu
  4298. * items with the specified command ID. In Mac OS X 10.0 and
  4299. * CarbonLib 1.0 through 1.4, this API only searches top-level menus
  4300. * (menus visible in the menubar) and submenus of top-level menus.
  4301. * It does not search hierarchical menus that are inserted in the
  4302. * menubar but are not submenus of a top-level menus (for example,
  4303. * it does not search menus that are inserted for use in a popup
  4304. * menu control). In Mac OS X 10.1 and CarbonLib 1.5 and later, this
  4305. * API also searches inserted hierarchical menus.
  4306. *
  4307. * Mac OS X threading:
  4308. * Not thread safe
  4309. *
  4310. * Parameters:
  4311. *
  4312. * inMenu:
  4313. * The menu in which to begin searching for items with the
  4314. * specified command ID. Pass NULL to hegin searching with the
  4315. * root menu. The search will descend into all submenus of this
  4316. * menu.
  4317. *
  4318. * inCommandID:
  4319. * The command ID for which to search.
  4320. *
  4321. * inItemIndex:
  4322. * The 1-based index of the menu item to retrieve. In CarbonLib
  4323. * 1.0.x and 1.1, this parameter must be 1. In CarbonLib 1.2 and
  4324. * Mac OS X 10.0, this parameter may vary from 1 to the number of
  4325. * menu items with the specified command ID.
  4326. *
  4327. * outMenu:
  4328. * On exit, the menu containing the menu item with the specified
  4329. * command ID.
  4330. *
  4331. * outIndex:
  4332. * On exit, the item index of the menu item with the specified
  4333. * command ID.
  4334. *
  4335. * Availability:
  4336. * Mac OS X: in version 10.0 and later in Carbon.framework
  4337. * CarbonLib: in CarbonLib 1.0 and later
  4338. * Non-Carbon CFM: not available
  4339. }
  4340. function GetIndMenuItemWithCommandID( inMenu: MenuRef; inCommandID: MenuCommand; inItemIndex: UInt32; outMenu: MenuRefPtr { can be NULL }; outIndex: MenuItemIndexPtr { can be NULL } ): OSStatus; external name '_GetIndMenuItemWithCommandID';
  4341. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4342. {
  4343. * EnableMenuCommand()
  4344. *
  4345. * Summary:
  4346. * Enables the menu item with a specified command ID.
  4347. *
  4348. * Mac OS X threading:
  4349. * Not thread safe
  4350. *
  4351. * Parameters:
  4352. *
  4353. * inMenu:
  4354. * The menu in which to begin searching for the item. Pass NULL to
  4355. * begin searching with the root menu. The search will descend
  4356. * into all submenus of this menu.
  4357. *
  4358. * inCommandID:
  4359. * The command ID of the menu item to be enabled. If more than one
  4360. * item has this command ID, only the first will be enabled.
  4361. *
  4362. * Availability:
  4363. * Mac OS X: in version 10.0 and later in Carbon.framework
  4364. * CarbonLib: in CarbonLib 1.0 and later
  4365. * Non-Carbon CFM: not available
  4366. }
  4367. procedure EnableMenuCommand( inMenu: MenuRef; inCommandID: MenuCommand ); external name '_EnableMenuCommand';
  4368. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4369. {
  4370. * DisableMenuCommand()
  4371. *
  4372. * Summary:
  4373. * Disables the menu item with a specified command ID.
  4374. *
  4375. * Mac OS X threading:
  4376. * Not thread safe
  4377. *
  4378. * Parameters:
  4379. *
  4380. * inMenu:
  4381. * The menu in which to begin searching for the item. Pass NULL to
  4382. * begin searching with the root menu. The search will descend
  4383. * into all submenus of this menu.
  4384. *
  4385. * inCommandID:
  4386. * The command ID of the menu item to be disabled. If more than
  4387. * one item has this command ID, only the first will be disabled.
  4388. *
  4389. * Availability:
  4390. * Mac OS X: in version 10.0 and later in Carbon.framework
  4391. * CarbonLib: in CarbonLib 1.0 and later
  4392. * Non-Carbon CFM: not available
  4393. }
  4394. procedure DisableMenuCommand( inMenu: MenuRef; inCommandID: MenuCommand ); external name '_DisableMenuCommand';
  4395. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4396. {
  4397. * IsMenuCommandEnabled()
  4398. *
  4399. * Summary:
  4400. * Determines if the menu item with a specified command ID is
  4401. * enabled.
  4402. *
  4403. * Mac OS X threading:
  4404. * Not thread safe
  4405. *
  4406. * Parameters:
  4407. *
  4408. * inMenu:
  4409. * The menu in which to begin searching for the item. Pass NULL to
  4410. * begin searching with the root menu. The search will descend
  4411. * into all submenus of this menu.
  4412. *
  4413. * inCommandID:
  4414. * The command ID of the menu item to examine. If more than one
  4415. * item has this command ID, only the first will be examined.
  4416. *
  4417. * Availability:
  4418. * Mac OS X: in version 10.0 and later in Carbon.framework
  4419. * CarbonLib: in CarbonLib 1.0 and later
  4420. * Non-Carbon CFM: not available
  4421. }
  4422. function IsMenuCommandEnabled( inMenu: MenuRef; inCommandID: MenuCommand ): Boolean; external name '_IsMenuCommandEnabled';
  4423. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4424. {
  4425. * SetMenuCommandMark()
  4426. *
  4427. * Summary:
  4428. * Locates the menu item with a specified command ID and sets its
  4429. * mark character.
  4430. *
  4431. * Mac OS X threading:
  4432. * Not thread safe
  4433. *
  4434. * Parameters:
  4435. *
  4436. * inMenu:
  4437. * The menu in which to begin searching for the item. Pass NULL to
  4438. * begin searching with the root menu. The search will descend
  4439. * into all submenus of this menu.
  4440. *
  4441. * inCommandID:
  4442. * The command ID of the menu item to be modified. If more than
  4443. * one item has this command ID, only the first will be modified.
  4444. *
  4445. * inMark:
  4446. * The new mark character. Although the type of this parameter is
  4447. * UniChar, currently only the low byte of this character will be
  4448. * used as the mark character, and it is interpreted using the
  4449. * applicationÕs text encoding.
  4450. *
  4451. * Availability:
  4452. * Mac OS X: in version 10.0 and later in Carbon.framework
  4453. * CarbonLib: in CarbonLib 1.1 and later
  4454. * Non-Carbon CFM: not available
  4455. }
  4456. function SetMenuCommandMark( inMenu: MenuRef; inCommandID: MenuCommand; inMark: UniChar ): OSStatus; external name '_SetMenuCommandMark';
  4457. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4458. {
  4459. * GetMenuCommandMark()
  4460. *
  4461. * Summary:
  4462. * Locates the menu item with a specified command ID and returns its
  4463. * mark character.
  4464. *
  4465. * Mac OS X threading:
  4466. * Not thread safe
  4467. *
  4468. * Parameters:
  4469. *
  4470. * inMenu:
  4471. * The menu in which to begin searching for the item. Pass NULL to
  4472. * begin searching with the root menu. The search will descend
  4473. * into all submenus of this menu.
  4474. *
  4475. * inCommandID:
  4476. * The command ID of the menu item to be examined. If more than
  4477. * one item has this command ID, only the first will be examined.
  4478. *
  4479. * outMark:
  4480. * On exit, the menu item's mark character.
  4481. *
  4482. * Availability:
  4483. * Mac OS X: in version 10.0 and later in Carbon.framework
  4484. * CarbonLib: in CarbonLib 1.1 and later
  4485. * Non-Carbon CFM: not available
  4486. }
  4487. function GetMenuCommandMark( inMenu: MenuRef; inCommandID: MenuCommand; var outMark: UniChar ): OSStatus; external name '_GetMenuCommandMark';
  4488. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4489. {
  4490. * GetMenuCommandProperty()
  4491. *
  4492. * Summary:
  4493. * Retrives property data for a menu item with a specified command
  4494. * ID.
  4495. *
  4496. * Mac OS X threading:
  4497. * Not thread safe
  4498. *
  4499. * Parameters:
  4500. *
  4501. * inMenu:
  4502. * The menu in which to begin searching for the item. Pass NULL to
  4503. * begin searching with the root menu. The search will descend
  4504. * into all submenus of this menu.
  4505. *
  4506. * inCommandID:
  4507. * The command ID of the menu item containing the property. If
  4508. * more than one item has this command ID, only the first will be
  4509. * used.
  4510. *
  4511. * inPropertyCreator:
  4512. * The property creator.
  4513. *
  4514. * inPropertyTag:
  4515. * The property tag.
  4516. *
  4517. * inBufferSize:
  4518. * The size of the output buffer, in bytes.
  4519. *
  4520. * outActualSize:
  4521. * On exit, contains the actual size of the property data. May be
  4522. * NULL if you do not need this information.
  4523. *
  4524. * inPropertyBuffer:
  4525. * The address of a buffer in which to place the property data.
  4526. *
  4527. * Availability:
  4528. * Mac OS X: in version 10.0 and later in Carbon.framework
  4529. * CarbonLib: in CarbonLib 1.0 and later
  4530. * Non-Carbon CFM: not available
  4531. }
  4532. function GetMenuCommandProperty( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; inBufferSize: ByteCount; outActualSize: ByteCountPtr { can be NULL }; inPropertyBuffer: UnivPtr ): OSStatus; external name '_GetMenuCommandProperty';
  4533. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4534. {
  4535. * GetMenuCommandPropertySize()
  4536. *
  4537. * Summary:
  4538. * Retrives the size of property data for a menu item with a
  4539. * specified command ID.
  4540. *
  4541. * Mac OS X threading:
  4542. * Not thread safe
  4543. *
  4544. * Parameters:
  4545. *
  4546. * inMenu:
  4547. * The menu in which to begin searching for the item. Pass NULL to
  4548. * begin searching with the root menu. The search will descend
  4549. * into all submenus of this menu.
  4550. *
  4551. * inCommandID:
  4552. * The command ID of the menu item containing the property. If
  4553. * more than one item has this command ID, only the first will be
  4554. * used.
  4555. *
  4556. * inPropertyCreator:
  4557. * The property creator.
  4558. *
  4559. * inPropertyTag:
  4560. * The property tag.
  4561. *
  4562. * outSize:
  4563. * On exit, contains the size of the property data.
  4564. *
  4565. * Availability:
  4566. * Mac OS X: in version 10.0 and later in Carbon.framework
  4567. * CarbonLib: in CarbonLib 1.0 and later
  4568. * Non-Carbon CFM: not available
  4569. }
  4570. function GetMenuCommandPropertySize( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; var outSize: ByteCount ): OSStatus; external name '_GetMenuCommandPropertySize';
  4571. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4572. {
  4573. * SetMenuCommandProperty()
  4574. *
  4575. * Summary:
  4576. * Sets property data for a menu item with a specified command ID.
  4577. *
  4578. * Mac OS X threading:
  4579. * Not thread safe
  4580. *
  4581. * Parameters:
  4582. *
  4583. * inMenu:
  4584. * The menu in which to begin searching for the item. Pass NULL to
  4585. * begin searching with the root menu. The search will descend
  4586. * into all submenus of this menu.
  4587. *
  4588. * inCommandID:
  4589. * The command ID of the menu item that will receive the property.
  4590. * If more than one item has this command ID, only the first will
  4591. * be modified.
  4592. *
  4593. * inPropertyCreator:
  4594. * The property creator.
  4595. *
  4596. * inPropertyTag:
  4597. * The property tag.
  4598. *
  4599. * inPropertySize:
  4600. * The size of the property data, in bytes.
  4601. *
  4602. * inPropertyData:
  4603. * The address of the property data.
  4604. *
  4605. * Availability:
  4606. * Mac OS X: in version 10.0 and later in Carbon.framework
  4607. * CarbonLib: in CarbonLib 1.0 and later
  4608. * Non-Carbon CFM: not available
  4609. }
  4610. function SetMenuCommandProperty( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType; inPropertySize: ByteCount; inPropertyData: {const} UnivPtr ): OSStatus; external name '_SetMenuCommandProperty';
  4611. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4612. {
  4613. * RemoveMenuCommandProperty()
  4614. *
  4615. * Summary:
  4616. * Removes a property from a menu item with a specified command ID.
  4617. *
  4618. * Mac OS X threading:
  4619. * Not thread safe
  4620. *
  4621. * Parameters:
  4622. *
  4623. * inMenu:
  4624. * The menu in which to begin searching for the item. Pass NULL to
  4625. * begin searching with the root menu. The search will descend
  4626. * into all submenus of this menu.
  4627. *
  4628. * inCommandID:
  4629. * The command ID of the menu item from which the property will be
  4630. * removed. If more than one item has this command ID, only the
  4631. * first will be modified.
  4632. *
  4633. * inPropertyCreator:
  4634. * The property creator.
  4635. *
  4636. * inPropertyTag:
  4637. * The property tag.
  4638. *
  4639. * Availability:
  4640. * Mac OS X: in version 10.0 and later in Carbon.framework
  4641. * CarbonLib: in CarbonLib 1.0 and later
  4642. * Non-Carbon CFM: not available
  4643. }
  4644. function RemoveMenuCommandProperty( inMenu: MenuRef; inCommandID: MenuCommand; inPropertyCreator: OSType; inPropertyTag: OSType ): OSStatus; external name '_RemoveMenuCommandProperty';
  4645. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4646. {
  4647. * CopyMenuItemData()
  4648. *
  4649. * Summary:
  4650. * Returns multiple attributes of a menu item at once.
  4651. *
  4652. * Discussion:
  4653. * This function is used to retrieve many attributes of a menu item
  4654. * simultaneously; for example, it might be used by a menu
  4655. * definition function that needs to know how to draw a menu item.
  4656. * It is more efficient to use this function than to use the
  4657. * accessor functions for the individual attributes of the menu.
  4658. * This function returns a copy of the data in the menu, so any data
  4659. * in the MenuItemDataRec that is dynamically allocated (for
  4660. * example, the CFString item text) should be released by the caller.
  4661. *
  4662. * Mac OS X threading:
  4663. * Not thread safe
  4664. *
  4665. * Parameters:
  4666. *
  4667. * inMenu:
  4668. * The menu from which to copy data. If inIsCommandID is true, you
  4669. * may pass NULL for this parameter to search for an item in the
  4670. * root menu; if inIsCommandID is false, this parameter must be a
  4671. * valid MenuRef.
  4672. *
  4673. * inItem:
  4674. * The item or command ID from which to copy data.
  4675. *
  4676. * inIsCommandID:
  4677. * Indicates whether inItem is a MenuItemIndex or MenuCommand. If
  4678. * inIsCommandID is true, the inItem parameter is interpreted as a
  4679. * menu command ID, and data is copied from the first item in the
  4680. * menu with that command ID. If inIsCommandID is false, the
  4681. * inItem parameter is interpreted as a menu item index, and data
  4682. * is copied for that item in the specified menu.
  4683. *
  4684. * ioData:
  4685. * Data is copied from the item and placed here. On entry, the
  4686. * whichData field of this structure should be initialized to
  4687. * indicate which data the caller would like returned. Individual
  4688. * fields of the MenuItemDataRec structure may require
  4689. * pre-initialization also; see the individual MenuItemDataFlags
  4690. * documentation for details.
  4691. *
  4692. * Availability:
  4693. * Mac OS X: in version 10.0 and later in Carbon.framework
  4694. * CarbonLib: in CarbonLib 1.1 and later
  4695. * Non-Carbon CFM: not available
  4696. }
  4697. function CopyMenuItemData( inMenu: MenuRef { can be NULL }; inItem: MenuItemID; inIsCommandID: Boolean; ioData: MenuItemDataPtr ): OSStatus; external name '_CopyMenuItemData';
  4698. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4699. {
  4700. * SetMenuItemData()
  4701. *
  4702. * Summary:
  4703. * Sets multiple attributes of a menu item at once.
  4704. *
  4705. * Discussion:
  4706. * This function is used to set many attributes of a menu item
  4707. * simultaneously. It is more efficient to use this function than to
  4708. * use the accessor functions for the individual attributes of the
  4709. * menu.
  4710. *
  4711. * Mac OS X threading:
  4712. * Not thread safe
  4713. *
  4714. * Parameters:
  4715. *
  4716. * inMenu:
  4717. * The menu to modify.
  4718. *
  4719. * inItem:
  4720. * The item or command ID to modify.
  4721. *
  4722. * inIsCommandID:
  4723. * Indicates whether inItem is a MenuItemIndex or MenuCommand. If
  4724. * inIsCommandID is true, the inItem parameter is interpreted as a
  4725. * menu command ID, and the first item in the menu with that
  4726. * command ID. is modified. If inIsCommandID is false, the inItem
  4727. * parameter is interpreted as a menu item index, and the item
  4728. * with that index in the specified menu is modified.
  4729. *
  4730. * inData:
  4731. * The data to set. The caller should set the whichData field of
  4732. * this structure to indicate which data should be set. Only the
  4733. * fields of the structure corresponding to the non-zero whichData
  4734. * flags must be initialized; other fields are ignored.
  4735. *
  4736. * Availability:
  4737. * Mac OS X: in version 10.0 and later in Carbon.framework
  4738. * CarbonLib: in CarbonLib 1.1 and later
  4739. * Non-Carbon CFM: not available
  4740. }
  4741. function SetMenuItemData( inMenu: MenuRef; inItem: MenuItemID; inIsCommandID: Boolean; const (*var*) inData: MenuItemDataRec ): OSStatus; external name '_SetMenuItemData';
  4742. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4743. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4744. { ¥ Dynamic menu item support (available in CarbonLib 1.1 and Mac OS X) }
  4745. { Dynamic menu item support allows a menu item to be redrawn while the menu is open }
  4746. { and visible to the user. Carbon contains automatic support for dynamic items based }
  4747. { on keyboard modifier state. If you need to implement your own variable item state }
  4748. { based on other system state, you can use these APIs to implement it. }
  4749. { To use the built-in support for dynamic items, you should create a menu containing }
  4750. { several contiguous items with the same command key but different text and modifier }
  4751. { keys. For example, you might have: }
  4752. { Close cmd-W }
  4753. { Close All cmd-option-W }
  4754. { The Menu Manager automatically determines a dynamic menu group using the base }
  4755. { command key of a dynamic menu item ('W' in this case). Only a single item from }
  4756. { a dynamic group is visible at any time; the other items are hidden. The Menu }
  4757. { Manager uses the current keyboard modifiers to determine which item is visible. }
  4758. { It is also possible to have a dynamic menu item group that does not have command }
  4759. { keys, but only modifiers; for example, in the Finder's View menu, the Clean Up }
  4760. { and Clean Up Selection items have no command key, but are a dynamic menu item }
  4761. { group that changes visibility based on the Option modifier key. }
  4762. { In this example, in your MENU resource, you would create the Close and Close All }
  4763. { items and give them each the letter 'W' as the command key; using an associated }
  4764. { xmnu resource, you would specify kMenuOptionModifier as the modifier for the }
  4765. { Close All item. You can do the same thing using InterfacerBuilder and nib-based }
  4766. { menus. }
  4767. { After loading your menu from the resource, you must set the kMenuItemAttrDynamic }
  4768. { flag for each dynamic item. In this example, you would use: }
  4769. { ChangeMenuItemAttributes( menu, kCloseItem, kMenuItemAttrDynamic, 0 ); }
  4770. { ChangeMenuItemAttributes( menu, kCloseAllItem, kMenuItemAttrDynamic, 0 ); }
  4771. { The Menu Manager will now automatically display the correct item depending on }
  4772. { whether the Option key is pressed. The result from MenuSelect will be the item }
  4773. { number of the item that was visible when the menu closed. }
  4774. { Note that: }
  4775. { - If you use InterfacerBuilder, you can set the kMenuItemAttrDynamic attribute }
  4776. { directly in the menu object in the nib, using the Inspector window for the }
  4777. { menu. You don't need to add the attribute after creating the menu. }
  4778. { - If your application requires Mac OS X 10.2 or CarbonLib 1.6 or later, you }
  4779. { can also use a version-one-format 'xmnu' resource, which allows settting }
  4780. { the menu item attributes in the 'xmnu'. Using a version one resource, you }
  4781. { can include the kMenuItemAttrDynamic attribute in the resource rather than }
  4782. { adding it after creating the menu. }
  4783. { If the Menu Manager's built-in support is not sufficient, you can also change the }
  4784. { attributes of an item yourself and use the UpdateInvalidMenuItems API to cause }
  4785. { the menu to redraw. Changes to a menu item (changing text, command key, style, }
  4786. { etc.) that occur while the menu is open will cause the menu item to be invalidated, }
  4787. { but not redrawn. If you need to invalidate the item explicitly yourself, perhaps }
  4788. { because you have a custom MDEF that depends on state not accessed using Menu }
  4789. { Manager APIs, you can use the InvalidateMenuItems API. UpdateInvalidMenuItems will }
  4790. { scan the menu for invalid items and redraw each, clearing its invalid flag }
  4791. { afterwards. }
  4792. { If you need to change menu contents based on modifier key state without using the }
  4793. { built-in support in the Menu Manager, we recommend that you install a Carbon event }
  4794. { handler on your menu for the [kEventClassKeyboard, kEventRawKeyModifiersChanged] }
  4795. { event. Modifier key events are passed to the currently open menu before being sent }
  4796. { to the user focus target. }
  4797. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4798. {
  4799. * IsMenuItemInvalid()
  4800. *
  4801. * Summary:
  4802. * Determines if a menu item is invalid and should be redrawn.
  4803. *
  4804. * Mac OS X threading:
  4805. * Not thread safe
  4806. *
  4807. * Parameters:
  4808. *
  4809. * inMenu:
  4810. * The menu whose item to examine.
  4811. *
  4812. * inItem:
  4813. * The item to examine.
  4814. *
  4815. * Availability:
  4816. * Mac OS X: in version 10.0 and later in Carbon.framework
  4817. * CarbonLib: in CarbonLib 1.1 and later
  4818. * Non-Carbon CFM: not available
  4819. }
  4820. function IsMenuItemInvalid( inMenu: MenuRef; inItem: MenuItemIndex ): Boolean; external name '_IsMenuItemInvalid';
  4821. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4822. {
  4823. * InvalidateMenuItems()
  4824. *
  4825. * Summary:
  4826. * Invalidates a group of menu items so that they will be redrawn
  4827. * when UpdateInvalidMenuItems is next called.
  4828. *
  4829. * Discussion:
  4830. * Menu items are automatically invalidated when their contents are
  4831. * changed using Menu Manager APIs while the menu is open. However,
  4832. * you might need to use this API if you have a custom MDEF that
  4833. * draws using state not contained in the menu.
  4834. *
  4835. * Mac OS X threading:
  4836. * Not thread safe
  4837. *
  4838. * Parameters:
  4839. *
  4840. * inMenu:
  4841. * The menu whose items to invalidate.
  4842. *
  4843. * inFirstItem:
  4844. * The first item to invalidate.
  4845. *
  4846. * inNumItems:
  4847. * The number of items to invalidate.
  4848. *
  4849. * Availability:
  4850. * Mac OS X: in version 10.0 and later in Carbon.framework
  4851. * CarbonLib: in CarbonLib 1.1 and later
  4852. * Non-Carbon CFM: not available
  4853. }
  4854. function InvalidateMenuItems( inMenu: MenuRef; inFirstItem: MenuItemIndex; inNumItems: ItemCount ): OSStatus; external name '_InvalidateMenuItems';
  4855. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4856. {
  4857. * UpdateInvalidMenuItems()
  4858. *
  4859. * Summary:
  4860. * Redraws the invalid items of an open menu.
  4861. *
  4862. * Discussion:
  4863. * It is not necessary to use UpdateInvalidMenuItems if you are
  4864. * using Carbon's built-in support for dynamic items based on
  4865. * modifier key state. However, if you are modifying items
  4866. * dynamically using your own implementation, you should call
  4867. * UpdateInvalidMenuItems after completing your modifications for a
  4868. * single menu. It will redraw any items that have been marked as
  4869. * invalid, and clear the invalid flag for those items.
  4870. *
  4871. * Mac OS X threading:
  4872. * Not thread safe
  4873. *
  4874. * Parameters:
  4875. *
  4876. * inMenu:
  4877. * The menu to update.
  4878. *
  4879. * Availability:
  4880. * Mac OS X: in version 10.0 and later in Carbon.framework
  4881. * CarbonLib: in CarbonLib 1.1 and later
  4882. * Non-Carbon CFM: not available
  4883. }
  4884. function UpdateInvalidMenuItems( inMenu: MenuRef ): OSStatus; external name '_UpdateInvalidMenuItems';
  4885. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4886. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4887. { ¥ÊStandard font menu (Carbon and later) }
  4888. { These APIs allow you to create and use the standard font menu. }
  4889. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4890. const
  4891. kHierarchicalFontMenuOption = $00000001;
  4892. {
  4893. * CreateStandardFontMenu()
  4894. *
  4895. * Mac OS X threading:
  4896. * Not thread safe
  4897. *
  4898. * Availability:
  4899. * Mac OS X: in version 10.0 and later in Carbon.framework
  4900. * CarbonLib: in CarbonLib 1.0 and later
  4901. * Non-Carbon CFM: not available
  4902. }
  4903. function CreateStandardFontMenu( menu: MenuRef; afterItem: MenuItemIndex; firstHierMenuID: MenuID; options: OptionBits; outHierMenuCount: ItemCountPtr { can be NULL } ): OSStatus; external name '_CreateStandardFontMenu';
  4904. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4905. {
  4906. * UpdateStandardFontMenu()
  4907. *
  4908. * Mac OS X threading:
  4909. * Not thread safe
  4910. *
  4911. * Availability:
  4912. * Mac OS X: in version 10.0 and later in Carbon.framework
  4913. * CarbonLib: in CarbonLib 1.0 and later
  4914. * Non-Carbon CFM: not available
  4915. }
  4916. function UpdateStandardFontMenu( menu: MenuRef; outHierMenuCount: ItemCountPtr { can be NULL } ): OSStatus; external name '_UpdateStandardFontMenu';
  4917. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4918. {
  4919. * GetFontFamilyFromMenuSelection()
  4920. *
  4921. * Mac OS X threading:
  4922. * Not thread safe
  4923. *
  4924. * Availability:
  4925. * Mac OS X: in version 10.0 and later in Carbon.framework
  4926. * CarbonLib: in CarbonLib 1.0 and later
  4927. * Non-Carbon CFM: not available
  4928. }
  4929. function GetFontFamilyFromMenuSelection( menu: MenuRef; item: MenuItemIndex; var outFontFamily: FMFontFamily; var outStyle: FMFontStyle ): OSStatus; external name '_GetFontFamilyFromMenuSelection';
  4930. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  4931. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4932. { ¥ Contextual Menu routines and constants }
  4933. { available with Conxtextual Menu extension 1.0 and later }
  4934. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  4935. { Gestalt Selector for classic 68K apps only. }
  4936. { CFM apps should weak link and check the symbols. }
  4937. const
  4938. gestaltContextualMenuAttr = $636D6E75 (* 'cmnu' *);
  4939. gestaltContextualMenuUnusedBit = 0;
  4940. gestaltContextualMenuTrapAvailable = 1;
  4941. gestaltContextualMenuHasAttributeAndModifierKeys = 2; { Contextual Menu Manager supports keyContextualMenuAttributes and keyContextualMenuModifiers }
  4942. gestaltContextualMenuHasUnicodeSupport = 3; { Contextual Menu Manager supports typeUnicodeText and typeCFStringRef }
  4943. {
  4944. * Summary:
  4945. * Values indicating what kind of help the application supports
  4946. }
  4947. const
  4948. {
  4949. * The application does not support any help. The Menu Manager will
  4950. * put an appropriate help string into the contextual menu and
  4951. * disable the Help item.
  4952. }
  4953. kCMHelpItemNoHelp = 0;
  4954. {
  4955. * The application supports Apple Guide help. The Menu Manager will
  4956. * put the name of the main Guide file into the contextual menu and
  4957. * enable the Help item.
  4958. }
  4959. kCMHelpItemAppleGuide = 1;
  4960. {
  4961. * The application supports some other form of help. In this case,
  4962. * the application must also pass a valid string into the
  4963. * inHelpItemString parameter of ContextualMenuSelect. This string
  4964. * will be the text of the Help item in the contextual menu, and the
  4965. * Help item will be enabled.
  4966. }
  4967. kCMHelpItemOtherHelp = 2;
  4968. {
  4969. * The application does not support any help. The Menu Manager will
  4970. * remove the Help item from the contextual menu. This constant is
  4971. * available in Mac OS X and CarbonLib 1.6, and later; however, in
  4972. * CarbonLib it is translated to kCMHelpItemNoHelp, and the Help item
  4973. * is only disabled, not removed.
  4974. }
  4975. kCMHelpItemRemoveHelp = 3;
  4976. {
  4977. * Summary:
  4978. * Values indicating what was chosen from a contextual menu
  4979. }
  4980. const
  4981. {
  4982. * The user did not choose an item from the contextual menu and the
  4983. * application should do no further processing of the event.
  4984. }
  4985. kCMNothingSelected = 0;
  4986. {
  4987. * The user chose one of the application's items from the menu. The
  4988. * application can examine the outMenuID and outMenuItem parameters
  4989. * of ContextualMenuSelect to see what the menu selection was, and it
  4990. * should then handle the selection appropriately.
  4991. }
  4992. kCMMenuItemSelected = 1;
  4993. {
  4994. * The user chose the Help item from the menu. The application should
  4995. * open an Apple Guide database to a section appropriate for the
  4996. * selection. If the application supports some other form of help, it
  4997. * should be presented instead.
  4998. }
  4999. kCMShowHelpSelected = 3;
  5000. {
  5001. * Summary:
  5002. * AERecord keywords used by the ExamineContext method of a
  5003. * Contextual Menu plugin to specify menu item contents.
  5004. }
  5005. const
  5006. {
  5007. * Specifies the text of an item in a contextual menu. Data for this
  5008. * parameter can be in one of several formats. In Mac OS 7/8/9.x and
  5009. * Mac OS X 10.0 and 10.1, typeChar and typeIntlText are supported.
  5010. * In Mac OS X 10.2 and later, typeStyledText, typeAEText,
  5011. * typeUnicodeText, and typeCFStringRef are also supported. If you
  5012. * provide data as typeCFStringRef, the Contextual Menu Manager will
  5013. * automatically release the CFStringRef once the menu has been
  5014. * displayed. If you need the CFStringRef to have a longer timetime,
  5015. * your plugin should retain the CFStringRef before inserting it into
  5016. * the AERecord.
  5017. }
  5018. keyContextualMenuName = $706E616D (* 'pnam' *);
  5019. {
  5020. * Specifies the command ID of an item in a contextual menu. Data for
  5021. * this parameter should be typeLongInteger.
  5022. }
  5023. keyContextualMenuCommandID = $636D6364 (* 'cmcd' *);
  5024. {
  5025. * Specifies a contextual menu item with a submenu. Typically used
  5026. * with AEPutKeyDesc to add an entire AEDesc containing the submenu
  5027. * as the data for the parameter.
  5028. }
  5029. keyContextualMenuSubmenu = $636D7362 (* 'cmsb' *);
  5030. {
  5031. * Specifies the menu item attributes of an item in a contextual
  5032. * menu. Data for this parameter should be typeLongInteger. Available
  5033. * in Mac OS X 10.2 and later.
  5034. }
  5035. keyContextualMenuAttributes = $636D6174 (* 'cmat' *);
  5036. {
  5037. * Specifies the modifier keys of an item in a contextual menu (see
  5038. * kMenuShiftModifier, kMenuControlModifier, etc.) Data for this
  5039. * parameter should be typeLongInteger. Using this parameter together
  5040. * with the keyContextualMenuAttributes parameter, it is possible to
  5041. * create a contextual menu with dynamic items which change according
  5042. * to the modifier keys pressed by the user. Available in Mac OS X
  5043. * 10.2 and later.
  5044. }
  5045. keyContextualMenuModifiers = $636D6D64 (* 'cmmd' *);
  5046. {
  5047. * InitContextualMenus()
  5048. *
  5049. * Summary:
  5050. * Adds the current process to the system registry of contextual
  5051. * menu clients.
  5052. *
  5053. * Discussion:
  5054. * On Mac OS 8.x and 9.x, your program should call the
  5055. * InitContextualMenus function early in your startup code to
  5056. * register your application as a contextual menu client. If you do
  5057. * not register your program, some system-level functions may
  5058. * respond as though your program does not use contextual menus. Not
  5059. * registering your program may also cause
  5060. * ProcessIsContextualMenuClient to return an incorrect value. On
  5061. * Mac OS X, it is not necessary to call InitContextualMenus.
  5062. *
  5063. * Mac OS X threading:
  5064. * Not thread safe
  5065. *
  5066. * Availability:
  5067. * Mac OS X: in version 10.0 and later in Carbon.framework
  5068. * CarbonLib: in CarbonLib 1.0 and later
  5069. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  5070. }
  5071. function InitContextualMenus: OSStatus; external name '_InitContextualMenus';
  5072. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5073. {
  5074. * IsShowContextualMenuClick()
  5075. *
  5076. * Summary:
  5077. * Determines whether a particular EventRecord could invoke a
  5078. * contextual menu.
  5079. *
  5080. * Discussion:
  5081. * Applications should call IsShowContextualMenuClick when they
  5082. * receive non-null events. If IsShowContextualMenuClick returns
  5083. * true, your application should generate its own menu and Apple
  5084. * Event descriptor (AEDesc), and then call ContextualMenuSelect to
  5085. * display and track the contextual menu, and then handle the user's
  5086. * choice. Some users may choose to use a two-button mouse with
  5087. * their Macintosh computer. This API does not return true for a
  5088. * right-click unless the mouse manufacturer has provided driver
  5089. * software that returns a control-left click in place of a right
  5090. * click. For proper recognition of a right-click gesture, you must
  5091. * use the IsShowContextualMenuEvent API.
  5092. *
  5093. * Mac OS X threading:
  5094. * Not thread safe
  5095. *
  5096. * Parameters:
  5097. *
  5098. * inEvent:
  5099. * The event to examine.
  5100. *
  5101. * Result:
  5102. * Returns true if the application should display a contextual menu,
  5103. * false if not.
  5104. *
  5105. * Availability:
  5106. * Mac OS X: in version 10.0 and later in Carbon.framework
  5107. * CarbonLib: in CarbonLib 1.0 and later
  5108. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  5109. }
  5110. function IsShowContextualMenuClick( const (*var*) inEvent: EventRecord ): Boolean; external name '_IsShowContextualMenuClick';
  5111. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5112. {
  5113. * IsShowContextualMenuEvent()
  5114. *
  5115. * Summary:
  5116. * Determines whether a particular EventRef could invoke a
  5117. * contextual menu.
  5118. *
  5119. * Discussion:
  5120. * This API is similar to IsShowContextualMenuClick, but takes a
  5121. * Carbon EventRef as its parameter instead of an EventRecord.
  5122. * EventRecords cannot express a right-mouse-click, but EventRefs
  5123. * can, so this API will return true for a right- click where
  5124. * IsShowContextualMenuClick will not.
  5125. *
  5126. * In Mac OS X 10.3 and earlier, this API always returned false if
  5127. * the event kind was not kEventMouseDown,
  5128. * kEventWindowClickContentRgn, kEventWindowClickStructureRgn, or
  5129. * kEventWindowHandleContentClick. In Mac OS X 10.4 and later, this
  5130. * API no longer requires a specific event kind; it only requires
  5131. * that the event contain kEventParamMouseButton and
  5132. * kEventParamKeyModifiers parameters.
  5133. *
  5134. * Mac OS X threading:
  5135. * Not thread safe
  5136. *
  5137. * Parameters:
  5138. *
  5139. * inEvent:
  5140. * The event to examine.
  5141. *
  5142. * Result:
  5143. * Returns true if the application should display a contextual menu,
  5144. * false if not.
  5145. *
  5146. * Availability:
  5147. * Mac OS X: in version 10.0 and later in Carbon.framework
  5148. * CarbonLib: in CarbonLib 1.1 and later
  5149. * Non-Carbon CFM: not available
  5150. }
  5151. function IsShowContextualMenuEvent( inEvent: EventRef ): Boolean; external name '_IsShowContextualMenuEvent';
  5152. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5153. {
  5154. * ContextualMenuSelect()
  5155. *
  5156. * Summary:
  5157. * Displays a contextual menu.
  5158. *
  5159. * Discussion:
  5160. * If IsShowContextualMenuClick returns true, you should call the
  5161. * ContextualMenuSelect API after generating your own menu and
  5162. * preparing an Apple Event descriptor (AEDesc) that describes the
  5163. * item for which your application is displaying a contextual menu.
  5164. * This descriptor may contain an object specifier or raw data and
  5165. * will be passed to all contextual menu plug-ins. The system will
  5166. * add other items before displaying the contextual menu, and it
  5167. * will remove those items before returning, leaving the menu in its
  5168. * original state. After all the system commands are added, the
  5169. * contextual menu is displayed and tracked. If the user selects one
  5170. * of the system items, it is handled by the system and the call
  5171. * returns as though the user didn't select anything from the menu.
  5172. * If the user selects any other item (or no item at all), the Menu
  5173. * Manager passes back appropriate values in the parameters
  5174. * outUserSelectionType, outMenuID, and outMenuItem. Your
  5175. * application should provide visual feedback indicating the item
  5176. * that was clicked upon. For example, a click on an icon should
  5177. * highlight the icon, while a click on editable text should not
  5178. * eliminate the current selection. If the outUserSelectionType
  5179. * parameter contains kCMMenuItemSelected, you should look at the
  5180. * outMenuID and outMenuItem parameters to determine what menu item
  5181. * the user chose and handle it appropriately. If the user selected
  5182. * kCMHelpItemSelected, you should open the proper Apple Guide
  5183. * sequence or other form of custom help.
  5184. *
  5185. * Mac OS X threading:
  5186. * Not thread safe
  5187. *
  5188. * Parameters:
  5189. *
  5190. * inMenu:
  5191. * A menu containing application commands to display. The caller
  5192. * creates this menu based on the current context, the mouse
  5193. * location, and the current selection (if it was the target of
  5194. * the mouse). If you pass nil, only system commands will be
  5195. * displayed. The menu should be added to the menu list as a
  5196. * pop-up menu (using the InsertMenu function).
  5197. *
  5198. * inGlobalLocation:
  5199. * The location (in global coordinates) of the mouse near which
  5200. * the menu is to be displayed.
  5201. *
  5202. * inReserved:
  5203. * Reserved for future use. Pass false for this parameter.
  5204. *
  5205. * inHelpType:
  5206. * An identifier specifying the type of help to be provided by the
  5207. * application; see kCMHelpItem constants.
  5208. *
  5209. * inHelpItemString:
  5210. * A string containing the text to be displayed for the help menu
  5211. * item. This string is unused unless you also pass the constant
  5212. * kCMHelpItemOtherHelp in the inHelpType parameter.
  5213. *
  5214. * inSelection:
  5215. * An object specifier for the current selection. This allows he
  5216. * system to examine the selection and add special system commands
  5217. * accordingly. Passing a value of nil indicates that no selection
  5218. * should be examined, and most likely, no special system actions
  5219. * will be included.
  5220. *
  5221. * outUserSelectionType:
  5222. * On exit, the value indicates what the user selected from the
  5223. * contextual menu; see kCMNothingSelected, kCMMenuItemSelected,
  5224. * and kCMShowHelpSelected.
  5225. *
  5226. * outMenuID:
  5227. * On exit, if outUserSelectionType is set to kCMMenuItemSelected,
  5228. * the value is set to the menu ID of the chosen item.
  5229. *
  5230. * outMenuItem:
  5231. * On exit, if outUserSelectionType is set to kCMMenuItemSelected,
  5232. * the value is set to the menu item chosen.
  5233. *
  5234. * Result:
  5235. * An OSStatus result code. ContextualMenuSelect returns the result
  5236. * code userCanceledErr and sets outUserSelectionType to
  5237. * kCMNothingSelected to indicate that the user did not select
  5238. * anything from the contextual menu and no further processing is
  5239. * needed.
  5240. *
  5241. * Availability:
  5242. * Mac OS X: in version 10.0 and later in Carbon.framework
  5243. * CarbonLib: in CarbonLib 1.0 and later
  5244. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  5245. }
  5246. 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';
  5247. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5248. {
  5249. * ProcessIsContextualMenuClient()
  5250. *
  5251. * Summary:
  5252. * Determines whether the specified process is a contextual menu
  5253. * client.
  5254. *
  5255. * Discussion:
  5256. * On Mac OS 9, this API consults a global table of all processes
  5257. * that have registered with the Contextual Menu Manager by calling
  5258. * InitContextualMenus. On Mac OS X, this API ignores the inPSN
  5259. * parameter and always returns whether the current process is
  5260. * registered with the Contextual Menu Manager.
  5261. *
  5262. * Mac OS X threading:
  5263. * Not thread safe
  5264. *
  5265. * Parameters:
  5266. *
  5267. * inPSN:
  5268. * The process to examine.
  5269. *
  5270. * Result:
  5271. * Whether the specified process (or, on Mac OS X, the current
  5272. * process) is registered with the Contextual Menu Manager.
  5273. *
  5274. * Availability:
  5275. * Mac OS X: in version 10.0 and later in Carbon.framework
  5276. * CarbonLib: in CarbonLib 1.0 and later
  5277. * Non-Carbon CFM: in ContextualMenu 1.0 and later
  5278. }
  5279. function ProcessIsContextualMenuClient( var inPSN: ProcessSerialNumber ): Boolean; external name '_ProcessIsContextualMenuClient';
  5280. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5281. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  5282. { Contextual Menu Plugin Interface }
  5283. { For Mac OS X 10.1, we support a new type of Contextual Menu Plugin: the CFPlugIn }
  5284. { based plugin. Each plugin must be in a CFPlugIn in the Contextual Menu Items }
  5285. { folder in one of these paths: }
  5286. { /System/Library/Contextual Menu Items/ }
  5287. { /Library/Contextual Menu Items/ }
  5288. { ~/Library/Contextual Menu Items/ }
  5289. { It must export the following functions using the following interface or a C++ }
  5290. { interface inheriting from IUnknown and including similar functions. }
  5291. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  5292. (*
  5293. { The Contextual Menu Manager will only load CFPlugIns of type kContextualMenuTypeID }
  5294. #define kContextualMenuTypeID ( CFUUIDGetConstantUUIDWithBytes( NULL, \
  5295. 0x2F, 0x65, 0x22, 0xE9, 0x3E, 0x66, 0x11, 0xD5, \
  5296. 0x80, 0xA7, 0x00, 0x30, 0x65, 0xB3, 0x00, 0xBC ) )
  5297. { 2F6522E9-3E66-11D5-80A7-003065B300BC }
  5298. { Contextual Menu Plugins must implement this Contexual Menu Plugin Interface }
  5299. #define kContextualMenuInterfaceID ( CFUUIDGetConstantUUIDWithBytes( NULL, \
  5300. 0x32, 0x99, 0x7B, 0x62, 0x3E, 0x66, 0x11, 0xD5, \
  5301. 0xBE, 0xAB, 0x00, 0x30, 0x65, 0xB3, 0x00, 0xBC ) )
  5302. { 32997B62-3E66-11D5-BEAB-003065B300BC }
  5303. #define CM_IUNKNOWN_C_GUTS \
  5304. void *_reserved; \
  5305. SInt32 (*QueryInterface)(void *thisPointer, CFUUIDBytes iid, void ** ppv); \
  5306. UInt32 (*AddRef)(void *thisPointer); \
  5307. UInt32 (*Release)(void *thisPointer)
  5308. { The function table for the interface }
  5309. type
  5310. ContextualMenuInterfaceStruct = record
  5311. CM_IUNKNOWN_C_GUTS;
  5312. OSStatus ( *ExamineContext )(
  5313. void* thisInstance,
  5314. const AEDesc* inContext,
  5315. AEDescList* outCommandPairs );
  5316. OSStatus ( *HandleSelection )(
  5317. void* thisInstance,
  5318. AEDesc* inContext,
  5319. SInt32 inCommandID );
  5320. void ( *PostMenuCleanup )(
  5321. void* thisInstance );
  5322. end;
  5323. *)
  5324. {
  5325. * CMPluginExamineContext()
  5326. *
  5327. * Availability:
  5328. * Implemented by client
  5329. }
  5330. function CMPluginExamineContext( thisInstance: UnivPtr; const (*var*) inContext: AEDesc; var outCommandPairs: AEDescList ): OSStatus; external name '_CMPluginExamineContext';
  5331. {
  5332. * CMPluginHandleSelection()
  5333. *
  5334. * Availability:
  5335. * Implemented by client
  5336. }
  5337. function CMPluginHandleSelection( thisInstance: UnivPtr; var inContext: AEDesc; inCommandID: SInt32 ): OSStatus; external name '_CMPluginHandleSelection';
  5338. {
  5339. * CMPluginPostMenuCleanup()
  5340. *
  5341. * Availability:
  5342. * Implemented by client
  5343. }
  5344. procedure CMPluginPostMenuCleanup( thisInstance: UnivPtr ); external name '_CMPluginPostMenuCleanup';
  5345. { previously in LowMem.h. This functions return the menu ID of the hilited menu }
  5346. {
  5347. * LMGetTheMenu()
  5348. *
  5349. * Mac OS X threading:
  5350. * Not thread safe
  5351. *
  5352. * Availability:
  5353. * Mac OS X: in version 10.0 and later in Carbon.framework
  5354. * CarbonLib: in CarbonLib 1.0 and later
  5355. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5356. }
  5357. function LMGetTheMenu: MenuID; external name '_LMGetTheMenu';
  5358. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5359. {
  5360. * newmenu()
  5361. *
  5362. * Availability:
  5363. * Mac OS X: not available
  5364. * CarbonLib: not available
  5365. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  5366. }
  5367. {
  5368. * appendmenu()
  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. * insertmenuitem()
  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. * menuselect()
  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. * setmenuitemtext()
  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. * getmenuitemtext()
  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. #if OLDROUTINENAMES
  5409. #define AddResMenu(theMenu, theType) AppendResMenu(theMenu, theType)
  5410. #define InsMenuItem(theMenu, itemString, afterItem) InsertMenuItem(theMenu, itemString, afterItem)
  5411. #define DelMenuItem( theMenu, item ) DeleteMenuItem( theMenu, item )
  5412. #if TARGET_OS_MAC
  5413. #define SetItem MacSetItem
  5414. #define GetItem MacGetItem
  5415. #endif
  5416. #define MacSetItem(theMenu, item, itemString) SetMenuItemText(theMenu, item, itemString)
  5417. #define MacGetItem(theMenu, item, itemString) GetMenuItemText(theMenu, item, itemString)
  5418. #define GetMHandle(menuID) GetMenuHandle(menuID)
  5419. #define DelMCEntries(menuID, menuItem) DeleteMCEntries(menuID, menuItem)
  5420. #define DispMCInfo(menuCTbl) DisposeMCInfo(menuCTbl)
  5421. #if CALL_NOT_IN_CARBON
  5422. #define addresmenu(menu, data) appendresmenu(menu, data)
  5423. #define getitem(menu, item, itemString) getmenuitemtext(menu, item, itemString)
  5424. #define setitem(menu, item, itemString) setmenuitemtext(menu, item, itemString)
  5425. #define insmenuitem(theMenu, itemString, afterItem) insertmenuitem(theMenu, itemString, afterItem)
  5426. #endif
  5427. #endif { OLDROUTINENAMES }
  5428. *)
  5429. { Getters }
  5430. {
  5431. * GetMenuID()
  5432. *
  5433. * Mac OS X threading:
  5434. * Not thread safe
  5435. *
  5436. * Availability:
  5437. * Mac OS X: in version 10.0 and later in Carbon.framework
  5438. * CarbonLib: in CarbonLib 1.0 and later
  5439. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5440. }
  5441. function GetMenuID( menu: MenuRef ): MenuID; external name '_GetMenuID';
  5442. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5443. {
  5444. * GetMenuWidth()
  5445. *
  5446. * Mac OS X threading:
  5447. * Not thread safe
  5448. *
  5449. * Availability:
  5450. * Mac OS X: in version 10.0 and later in Carbon.framework
  5451. * CarbonLib: in CarbonLib 1.0 and later
  5452. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5453. }
  5454. function GetMenuWidth( menu: MenuRef ): SInt16; external name '_GetMenuWidth';
  5455. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5456. {
  5457. * GetMenuHeight()
  5458. *
  5459. * Mac OS X threading:
  5460. * Not thread safe
  5461. *
  5462. * Availability:
  5463. * Mac OS X: in version 10.0 and later in Carbon.framework
  5464. * CarbonLib: in CarbonLib 1.0 and later
  5465. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5466. }
  5467. function GetMenuHeight( menu: MenuRef ): SInt16; external name '_GetMenuHeight';
  5468. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5469. {
  5470. * GetMenuTitle()
  5471. *
  5472. * Mac OS X threading:
  5473. * Not thread safe
  5474. *
  5475. * Availability:
  5476. * Mac OS X: in version 10.0 and later in Carbon.framework
  5477. * CarbonLib: in CarbonLib 1.0 and later
  5478. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5479. }
  5480. function GetMenuTitle( menu: MenuRef; var title: Str255 ): StringPtr; external name '_GetMenuTitle';
  5481. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5482. {
  5483. * GetMenuDefinition()
  5484. *
  5485. * Mac OS X threading:
  5486. * Not thread safe
  5487. *
  5488. * Availability:
  5489. * Mac OS X: in version 10.0 and later in Carbon.framework
  5490. * CarbonLib: in CarbonLib 1.0 and later
  5491. * Non-Carbon CFM: not available
  5492. }
  5493. function GetMenuDefinition( menu: MenuRef; outDefSpec: MenuDefSpecPtr ): OSStatus; external name '_GetMenuDefinition';
  5494. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5495. { Setters }
  5496. {
  5497. * SetMenuID()
  5498. *
  5499. * Mac OS X threading:
  5500. * Not thread safe
  5501. *
  5502. * Availability:
  5503. * Mac OS X: in version 10.0 and later in Carbon.framework
  5504. * CarbonLib: in CarbonLib 1.0 and later
  5505. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5506. }
  5507. procedure SetMenuID( menu: MenuRef; menuID_: MenuID ); external name '_SetMenuID';
  5508. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5509. {
  5510. * SetMenuWidth()
  5511. *
  5512. * Mac OS X threading:
  5513. * Not thread safe
  5514. *
  5515. * Availability:
  5516. * Mac OS X: in version 10.0 and later in Carbon.framework
  5517. * CarbonLib: in CarbonLib 1.0 and later
  5518. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5519. }
  5520. procedure SetMenuWidth( menu: MenuRef; width: SInt16 ); external name '_SetMenuWidth';
  5521. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5522. {
  5523. * SetMenuHeight()
  5524. *
  5525. * Mac OS X threading:
  5526. * Not thread safe
  5527. *
  5528. * Availability:
  5529. * Mac OS X: in version 10.0 and later in Carbon.framework
  5530. * CarbonLib: in CarbonLib 1.0 and later
  5531. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5532. }
  5533. procedure SetMenuHeight( menu: MenuRef; height: SInt16 ); external name '_SetMenuHeight';
  5534. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5535. {
  5536. * SetMenuTitle()
  5537. *
  5538. * Mac OS X threading:
  5539. * Not thread safe
  5540. *
  5541. * Availability:
  5542. * Mac OS X: in version 10.0 and later in Carbon.framework
  5543. * CarbonLib: in CarbonLib 1.0 and later
  5544. * Non-Carbon CFM: in CarbonAccessors.o 1.0 and later
  5545. }
  5546. function SetMenuTitle( menu: MenuRef; const (*var*) title: Str255 ): OSStatus; external name '_SetMenuTitle';
  5547. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5548. {
  5549. * SetMenuDefinition()
  5550. *
  5551. * Mac OS X threading:
  5552. * Not thread safe
  5553. *
  5554. * Availability:
  5555. * Mac OS X: in version 10.0 and later in Carbon.framework
  5556. * CarbonLib: in CarbonLib 1.0 and later
  5557. * Non-Carbon CFM: not available
  5558. }
  5559. function SetMenuDefinition( menu: MenuRef; const (*var*) defSpec: MenuDefSpec ): OSStatus; external name '_SetMenuDefinition';
  5560. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  5561. end.