JFLib

plat/apple_ios_pad.rs (Apple)#

Source: lib/plat/apple_ios_pad.rs

apple_ios_pad -- the iPad's parts of iOS's host (docs/APPLE.md AP9): the app's menus in the menu bar
of iPadOS, the pointer of a trackpad or mouse without a button, its wheel and pinch, and the test
aids of plattest --test ipad

  is_pad() -> bool                 the device is an iPad (UIUserInterfaceIdiomPad)
  sysmenu_supported() / sysmenu_window_row() / sysmenu_set()   plat::sysmenu on the iPad
  app_methods() / view_methods()   (apple_ios.rs register) the app delegate's menu methods, JFView's
                                   actions of the recognizers
  add_recognizers(view)            (apple_ios.rs vc_load_view) hover, wheel and pinch on JFView
  ios_pad_*                        (tests, any thread) window sizes, the keyboard, turning, the menus
                                   built with a stand-in for UIKit's builder, the pointer's paths
                                   without a pointer; on the main thread

The menus: UIKit asks the app delegate (a UIResponder) for the main menu (buildMenuWithBuilder:).
With menus of the app the system's File, Edit, Format and View menus go and the app's follow the
application menu, before Window, as on the Mac (apple_mac_app.rs).  Every row is a UICommand, with
a key equivalent a UIKeyCommand, whose action jfSysMenu: goes up the responder chain to the app
delegate; its propertyList is the row's id.  Separators become inline groups (UIMenu has none).
sysmenu_set asks for a rebuild; iPadOS builds when it needs the menu (the bar revealed, Command
held), never without input.  iPadOS 26 shows the menus in its menu bar (a swipe down from the top
edge or the pointer there reveals it), every iPadOS shows the rows with a key while Command is
held.  The window keeps its own menu row (sysmenu_window_row, the user's decision of 2026-11-19):
the bar of iPadOS hides until it is revealed, the row stays the way for the finger.  The iPhone
has no menu bar: unsupported there.

The pointer: a UIHoverGestureRecognizer moves the mouse without a button (the Apple Pencil's hover
on the iPads that have it: a pen without pressure), a UIPanGestureRecognizer that takes no touches,
only scroll events, turns a trackpad's two fingers and a mouse wheel into E_WHEEL (WHEEL_PIXELS,
as the Mac's trackpad), a UIPinchGestureRecognizer for the indirect pointer alone turns a
trackpad's pinch into Ctrl + wheel (as macOS).  None of them takes or delays a finger.
  • struct IosMenuRow one row as UIKit holds it (tests)

    • label: String
    • id: u32 -- the id of its command (0: a submenu or a row without action)
    • disabled: bool
    • checked: bool
    • key: String -- the key equivalent's input (UIKit's names for special keys) and its UIKeyModifierFlags
    • key_flags: isize
    • sub: usize -- the rows of a submenu (0: none)
    • sep_before: bool -- a separator (an inline group's border) comes before it
  • struct IosPadView what the host shows (ios_pad_view): sizes in points unless named px

    • pad: bool -- the device is an iPad
    • scene: (f64, f64) -- the window scene's bounds (the window iPadOS gave the app), the window's, JFView's
    • window: (f64, f64)
    • view: (f64, f64)
    • safe: (f64, f64, f64, f64) -- the safe area's insets of the root view: top, left, bottom, right
    • canvas: (i32, i32) -- the canvas in px as last sent (E_RESIZE) and its px per point
    • scale: f64
    • screen_scale: f64 -- the screen's own scale
    • orientation: isize -- the interface orientation of the scene (UIInterfaceOrientation: 1 portrait .. 4 landscape)
    • window_row: bool -- the app's menus in the window row stay (sysmenu_window_row)
    • shown: (i32, i32) -- the size of the last picture shown (px)
    • keyboard: bool -- the on-screen keyboard is asked for (JFView first responder)
    • last_wheel: (u8, u8, u32) -- the last E_WHEEL the wheel or the pinch sent: btn, mods, data
    • gpu: Option<IosGpuLayer> -- the GPU's layer (apple_ios_gpu.rs): made, shown, its drawable's size (px) and frame (points)
  • struct IosGpuLayer the GPU's layer as the host has it (IosPadView::gpu)

    • shown: bool
    • drawable: (f64, f64)
    • frame: (f64, f64)
  • fn ios_pad_view() -> Option<IosPadView> (tests, any thread) the host's sizes now; None without UIKit's host

  • fn ios_pad_window(w: f64, h: f64) -> bool (tests, any thread) the window's frame inside its scene in points, as Split View, Slide Over or Stage Manager would give it (w or h 0: the scene's whole bounds again) -> false without the host

  • fn ios_pad_rotate(landscape: bool) -> bool (tests, any thread) the scene turned to landscape (true) or portrait, as the user turning the iPad would (requestGeometryUpdateWithPreferences:) -> false without the host

  • fn ios_text_size(category: Option<&str>) -> bool (tests, any thread) the text size of the system as the user would set it (Settings, Display & Text Size): the window's trait override of preferredContentSizeCategory ("XXL": the size after the default "Large"; None: the override gone, the system's again) -> false without the host or before iOS 17 (no trait overrides)

  • fn ios_dark(dark: Option<bool>) -> bool (tests, any thread) dark (Some(true)) or light for the window, as the user's setting would be (overrideUserInterfaceStyle); None: the system's again -> false without the host

  • fn ios_pad_keyboard(show: bool) -> bool (tests, any thread) the on-screen keyboard as a tap into a text box brings it (JFView first responder) or "Done" hides it -> false without the host

  • fn ios_pad_menu_build() -> Option<Vec<String>> (tests, any thread) the main menu built as UIKit would, with a stand-in for its UIMenuBuilder (iPadOS builds its own only when the menu is needed: the bar revealed, Command held, a key of a hardware keyboard -- none of which a test without input can bring): it starts with the system's menus (application, File, Edit, Format, View, Window, Help) and answers what the build asks; the app's menus, rows and commands are UIKit's own objects -> the identifiers of the top level after the build (ios_pad_menus reads the rows), None without the host

  • struct IosPadMenus the main menu after the last build (ios_pad_menus)

    • builds: u32 -- builds so far (UIKit's and ios_pad_menu_build's), rebuilds sysmenu_set asked UIKit for
    • rebuilds: u32
    • system_gone: bool -- the system's File, Edit, Format and View menus went
    • menus: Vec<(String, Vec<IosMenuRow>)> -- the app's menus with their rows as the builder holds them
  • fn ios_pad_menus() -> IosPadMenus (tests, any thread) the main menu after the last build

  • fn ios_pad_menu_choose(menu: usize, row: usize) -> bool (tests, any thread) choose row row of the app's menu menu as the menu bar does: its action goes up the responder chain from the first responder -> false: no such row, or no one took it

  • enum IosPadPointer what the tests feed in where a pointer would (ios_pad_pointer)

    • Hover { x: f64, y: f64, pen: Option<(i32, i32)> } -- the pointer (pen: the pencil's hover with this tilt) over the view without a button at (x, y) points; Leave: it left the view
    • Leave
    • Scroll { dx: f64, dy: f64, x: f64, y: f64 } -- two fingers on the trackpad move the content by (dx, dy) points at (x, y)
    • Pinch { m: f64, x: f64, y: f64 } -- a trackpad's pinch: the scale changed by m (0.1 = 10 % larger)
  • fn ios_pad_pointer(p: IosPadPointer) -> bool (tests, any thread) the recognizers' paths with the values a pointer would give (the simulator has no pointer of its own to drive) -> false without the host

Source: docs/API.md in the JFLib repository.