示例#1
0
void
JXRadioGroup::SelectItem
	(
	const JIndex id
	)
{
	//assert( itsSelection != NULL );

	if (id != GetSelectedItem())
		{
		JXRadioButton* newButton = NULL;
		const JSize count = itsButtons->GetElementCount();
		for (JIndex i=1; i<=count; i++)
			{
			JXRadioButton* aButton = itsButtons->NthElement(i);
			if (aButton->GetID() == id)
				{
				newButton = aButton;
				break;
				}
			}
		assert( newButton != NULL );

		NewSelection(newButton);
		}
}
示例#2
0
/*----------------------------------------------------------------------
  TtaSelectString

  Selects a substring within a Text basic element. This substring is
  highlighted in all views where it can be displayed.

  Parameters:
  document: the document containing the string to be selected.
  textElement: the Text element containing the string to be selected.
  firstCharacter: position within the text element of the first character
  to be selected.
  lastCharacter: position within the text element of the last character
  to be selected.

  ----------------------------------------------------------------------*/
void  TtaSelectString (Document document, Element textElement,
                       int firstCharacter, int lastCharacter)
{
  DisplayMode         dispMode;

  UserErrorCode = 0;
  if (textElement == NULL)
    TtaError (ERR_invalid_parameter);
  else if (((PtrElement) textElement)->ElParent == NULL)
    TtaError (ERR_invalid_parameter);
  else if (!((PtrElement) textElement)->ElTerminal)
    TtaError (ERR_invalid_element_type);
  else if (((PtrElement) textElement)->ElLeafType != LtText &&
           ((PtrElement) textElement)->ElLeafType != LtSymbol &&
           ((PtrElement) textElement)->ElLeafType != LtPicture)
    TtaError (ERR_invalid_element_type);
  /* Checks the parameter document */
  else if (document < 1 || document > MAX_DOCUMENTS)
    TtaError (ERR_invalid_document_parameter);
  else if (LoadedDocument[document - 1] == NULL)
    TtaError (ERR_invalid_document_parameter);
  else
    {
      dispMode = TtaGetDisplayMode (document);
      if (dispMode == DisplayImmediately)
        {
          SelectString (LoadedDocument[document - 1],
                        (PtrElement) textElement, firstCharacter, lastCharacter);
        }
      else
        NewSelection (document, textElement, NULL, firstCharacter, lastCharacter);
    }
}
CFuiMBROS::CFuiMBROS(Tag idn, const char *filename)
:CFuiWindow(idn,filename,360,730,0)
{ strncpy(text,"3D-MODELS BROWSER",255);
  Mod   = 0;
  //---Allocate camera object -----------------------------
  oCam   = new CCameraObject();
  oCam->SetFBO(MBROS_WID,MBROS_HTR);
  oCam->MoveMouseIs(1);
  //--- Create the position labels -------------------------
  mPOS  =           new CFuiLabel (8,10,MBROS_WID, 18,this);
  AddChild('mpos',mPOS);
  //----Create Display Canvas  ----------------------------
  oDSP  =           new CFuiCanva (8,30,MBROS_WID,MBROS_HTR,this);
  AddChild('odsp',oDSP);
  oDSP->EraseCanvas();
  oDSP->RegisterCamera(oCam);
  //----Create Zoom Slider ---------------------------------
  zSLD  =           new CFuiSlider(8,300,MBROS_WID, 30,this); 
  AddChild('zsld',zSLD);
  //----Create Zoom Label ----------------------------------
  zLAB  =           new CFuiLabel (8,340,MBROS_WID, 20,this);
  AddChild('zlab',zLAB);
  //----Create Canva ---------------------------------------
  oINF  =           new CFuiCanva (8,370,MBROS_WID, 30,this);
  AddChild('oinf',oINF);
  //----Create the List box --------------------------------
  oWIN  =           new CFuiList  (8,440,MBROS_WID,200,this);
  oWIN->SetVScroll();
  AddChild('olst',oWIN);
  //---Create Total label ---------------------------------
  wTOT =            new CFuiLabel (8,650,MBROS_WID, 16,this);
  AddChild('wtot',wTOT);
  //---Create Object origin -------------------------------
  wOrg =            new CFuiLabel (8,670,MBROS_WID, 16,this);
  AddChild('worg',wOrg);
	//---ZB option ------------------------------------------
  wZbo  = new CFuiCheckBox(8,  690, 300,20,this);
  wZbo->IniState(0);
  AddChild('zbop',wZbo,"Flat object on ground (No ZB)");
  //----Create surface for windows ------------------------
  CFuiWindow::ReadFinished();
  //----Create object list --------------------------------
  Lin  = 0;
  wObj = 0;
  oBOX.SetParameters(this,'olst',0);
  globals->tcm->GetObjLines(&oBOX);
  oBOX.SortAndDisplay();
  //---Allocate a camera orbit ----------------------------
  sCam = new CCameraOrbit();
	//---Create application profile -------------------------
	ctx.prof	= MBROS_PROF;
	ctx.mode	= SLEW_RCAM;
  rcam			= globals->ccm->SetRabbitCamera(ctx,RABBIT_S_AND_C);			// Change camera
	//---Set focus on first object --------------------------
	NewSelection();
  ChangeZoom();
}
示例#4
0
void
JXRadioGroup::NewButton
	(
	JXRadioButton* button
	)
{
	itsButtons->Append(button);
	if (itsSelection == NULL)
		{
		NewSelection(button);
		}
}
//-----------------------------------------------------------------------
//  Notifications
//-----------------------------------------------------------------------
void  CFuiMBROS::NotifyChildEvent(Tag idm,Tag itm,EFuiEvents evn)
{ 
  switch (idm)  {
    case 'sysb':
      SystemHandler(evn);
      return;
		//--- Zoom is changing ------------------
    case 'zsld':
      ChangeZoom();
      return;
		//--- A new selection is occuring -------
    case 'olst':
      oBOX.VScrollHandler((U_INT)itm,evn);
      NewSelection();
      return;
		//--- The ZB option is modified ---------
		case 'zbop':
			ChangeZB();
			return;
  }
  return;
}
示例#6
0
/*----------------------------------------------------------------------
  TtaSelectElement

  Selects a single element. This element is highlighted in all views
  where it can be displayed. If it cannot be displayed in any existing
  view, a new view is eventually open for displaying it.
  Parameters:
  document: the document containing the element to be
  selected.
  selectedElement: the element to be selected. NULL for cancelling the
  selection in the document.
  ----------------------------------------------------------------------*/
void TtaSelectElement (Document document, Element selectedElement)
{
  DisplayMode         dispMode;

  UserErrorCode = 0;
  if (selectedElement && ((PtrElement) selectedElement)->ElParent == NULL)
    TtaError (ERR_invalid_parameter);
  /* Checks the parameter document */
  else if (document < 1 || document > MAX_DOCUMENTS)
    TtaError (ERR_invalid_document_parameter);
  else if (LoadedDocument[document - 1] == NULL)
    TtaError (ERR_invalid_document_parameter);
  else
    {
      dispMode = TtaGetDisplayMode (document);
      if (dispMode == DisplayImmediately)
        {
        if (selectedElement == NULL)
          /* Abort the selection */
          ResetSelection (LoadedDocument[document - 1]);
        else
          {
            SelectElement (LoadedDocument[document - 1],
                           (PtrElement) selectedElement, TRUE, FALSE, TRUE);
#ifdef _WX
            // update the status bar
            TtaSetStatusSelectedElement (document, 1, selectedElement);
#endif /* _WX */
          }
        }
      else
        {
          CancelSelection ();
          NewSelection (document, selectedElement, NULL, 0, 0);
        }
    }
}