Menus.pas 246 KB

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