Panel_Obj *new_panel(QSP_ARG_DECL const char *name,int dx,int dy) { Panel_Obj *po; po = new_panel_obj(name); if( po == NULL ){ printf("ERROR creating new panel object!?\n"); return(po); } //fprintf(stderr,"panel obj created...\n"); #ifndef BUILD_FOR_OBJC SET_PO_WIDTH(po, dx); SET_PO_HEIGHT(po, dy); // This represents where we put the panel on the screen... // for X11, place near the upper left... SET_PO_X(po, 100); SET_PO_Y(po, 100); SET_PO_FLAGS(po, 0); // why not initialize the flags for IOS too? SET_GW_TYPE( PO_GW(po), GW_PANEL); #endif /* ! BUILD_FOR_OBJC */ SET_PO_CHILDREN(po, new_ios_list() ); // In IOS, we don't need to have a distinction // between viewers and panels, we can add controls // to viewers and images to panels. So we need // to have a stripped down version of new_panel // to set up an existing viewer for getting widgets. //sprintf(ERROR_STRING,"new_panel %s calling make_panel",PO_NAME(po)); //advise(ERROR_STRING); make_panel(QSP_ARG po,dx,dy); /* Xlib calls */ #ifdef BUILD_FOR_OBJC /* these fields are part of the associated Gen_Win, * and must be set after the call to make_panel * That means we can't use the flags field to * pass the hide_back_button flag... */ // for IOS, typically we use the whole screen // BUG - for nav_panels, we need to push down to clear // the nav bar! SET_PO_X(po, 0); SET_PO_Y(po, 0); SET_PO_FLAGS(po, 0); #endif /* BUILD_FOR_OBJC */ make_scrnobj_ctx_for_panel(QSP_ARG po); // This is where we place the first object SET_PO_CURR_X(po,OBJECT_GAP); SET_PO_CURR_Y(po,OBJECT_GAP); curr_panel=po; //fprintf(stderr,"new_panel DONE\n"); return(po); }
Nav_Panel *create_nav_panel(QSP_ARG_DECL const char *name) { Nav_Panel *np_p; #ifdef HAVE_MOTIF Panel_Obj *po; #endif np_p = new_nav_panel(QSP_ARG name); if( np_p == NO_NAV_PANEL ){ sprintf(ERROR_STRING, "create_nav_panel: error creating nav_panel \"%s\"!?",name); WARN(ERROR_STRING); return NO_NAV_PANEL; } SET_GW_TYPE( NAVP_GW(np_p), GW_NAV_PANEL ); #ifdef HAVE_MOTIF // BUG on iOS the panel size defaults to the whole screen... #define DEFAULT_NAV_PANEL_WIDTH 480 #define DEFAULT_NAV_PANEL_HEIGHT 720 // Now make a regular panel... // new_panel is supposed to push a scrnobj context... po = new_panel(QSP_ARG name, DEFAULT_NAV_PANEL_WIDTH, DEFAULT_NAV_PANEL_HEIGHT ); if( po == NO_PANEL_OBJ ){ WARN("Error creating panel for nav_panel!?"); // BUG clean up (delete np_p) return NULL; } //np_p->np_po = po; SET_NAVP_PANEL(np_p,po); SET_GW_TYPE(PO_GW(po),GW_NAV_PANEL_OBJ); #endif /* HAVE_MOTIF */ IOS_Item_Context *icp; icp = create_navgrp_context(QSP_ARG name ); // We need to push the context, and pop when we finish? // We don't push until we enter the navigation submenu... //fprintf(stderr,"create_nav_panel, pushing group context %s\n", //CTX_NAME(icp)); // PUSH_ITEM_CONTEXT(nav_group_itp, icp); SET_NAVP_GRP_CONTEXT(np_p, icp); icp = create_navitm_context(QSP_ARG name ); // PUSH_ITEM_CONTEXT(nav_item_itp, icp); SET_NAVP_ITM_CONTEXT(np_p, icp); // In motif, we don't have real nav panels (an iOS-ism) // So to emulate the functionality, we have to add // a "back" button... { Screen_Obj *bo; prepare_for_decoration(QSP_ARG NAVP_PANEL(np_p) ); // next 7 lines from get_parts, screen_objs.c bo = simple_object(QSP_ARG "Back"); if( bo == NO_SCREEN_OBJ ){ WARN("Error creating back button for nav_panel!?"); goto no_back_button; } SET_SOB_ACTION(bo, savestr("Pop_Nav")); // next 6 lines from mk_button, screen_objs.c SET_SOB_TYPE(bo, SOT_BUTTON); make_button(QSP_ARG bo); add_to_panel(curr_panel,bo); INC_PO_CURR_Y(curr_panel, BUTTON_HEIGHT + GAP_HEIGHT ); unprepare_for_decoration(SINGLE_QSP_ARG); } no_back_button: return np_p; } // create_nav_panel