wxString wxControl::GetControlLabel()
{
    ControlType* control = (ControlType*)GetObjectPtr();
    if(control==NULL)
        return wxEmptyString;
    return CtlGetLabel(control);
}
Beispiel #2
0
static void SetTriggerText(UInt16 selected)
{
	FormPtr frmP = FrmGetActiveForm();
	if (FormIsNot(frmP, FormReply)) return;
	char* str = (char *)CtlGetLabel ((ControlPtr) GetObjectPtr (frmP, TriggerGroup));	
	StrNCopy(str, GetDisplayString(selected), 19);
	CtlDrawControl((ControlPtr) GetObjectPtr (frmP, TriggerGroup));
}
Beispiel #3
0
/***********************************************************************
 *
 * FUNCTION:    RepeatSetDateTrigger
 *
 * DESCRIPTION: This routine sets the label of the trigger that displays
 *              the end date of a repeating appointment.
 *
 * PARAMETERS:  endDate	- date or -1 if no end date
 *
 * RETURNED:    nothing
 *
 * NOTES:
 *      This routine assumes that the memory allocated for the label of
 *      the due date trigger is large enough to hold the lagest posible
 *      label. This label's memory is reserved by initializing the label
 *      in the resource file.
 *
 ***********************************************************************/
static void RepeatSetDateTrigger (DateType endDate) {
  FormType* frm = FrmGetFormPtr(RepeatForm);
  ListType* lst = GetObjectPointer(frm, RepeatEndOnList);
  ControlType* ctl = GetObjectPointer(frm, RepeatEndOnTrigger);
  Char* label = (Char*)CtlGetLabel(ctl); /* OK to cast; we call CtlSetLabel */

  ASSERT(lst);
  ASSERT(ctl);
  ASSERT(label);

  if (DateToInt(endDate) == apptNoEndDate) {
    StrCopy(label, LstGetSelectionText(lst, repeatNoEndDateItem));
    LstSetSelection(lst, noEndDateItem);
  } else {
    /* Format the end date into a string. */
    DateToDOWDMFormat(endDate.month, endDate.day, endDate.year + firstYear,
		      PrefGetPreference(prefDateFormat), label);
    
    LstSetSelection(lst, repeatChooseDateItem);
  }
  
  CtlSetLabel(ctl, label);
}
Beispiel #4
0
/***********************************************************************
 *
 * FUNCTION:    RepeatSetUIValues
 *
 * DESCRIPTION: This routine sets the current repeat settings of the
 *              ui gadgets in the repeat dialog box
 *
 * PARAMETERS:  frm     - pointer to the Repeat Dialog
 *              repeatP - pointer to a RepeatInfoType structure.
 *
 * RETURNED:    nothing
 *
 ***********************************************************************/
void RepeatSetUIValues(FormType* frm, RepeatInfoType* repeatP) {
  UInt16 i;
  UInt16 id;
  UInt16 oldFreq;
  MemHandle freqH;
  Char* freqP = NULL;
  Boolean on = false;
  FieldType* fld = NULL;
  const Int8 startOfWeek = PrefGetPreference(prefWeekStartDay);

  /* Set the selection of the "repeat type" push button group. */
  id = repeatP->repeatType + RepeatNone;
  if (repeatP->repeatType > repeatMonthlyByDay)
    id--;
  FrmSetControlGroupSelection (frm, RepeatTypeGroup, id);


  /* Set the frequency field */
  if (repeatP->repeatType != repeatNone) {
    fld = GetObjectPointer(frm, RepeatFrequenceField);
    freqH = FldGetTextHandle(fld);
    if (freqH) {
      freqP = MemHandleLock(freqH);
      oldFreq = StrAToI(freqP);
    } else {
      freqH = MemHandleNew(maxFrequenceFieldLen);
      ASSERT(freqH);
      freqP = MemHandleLock(freqH);
      oldFreq = 0;
    }

    if (oldFreq != repeatP->repeatFrequency) {
      StrIToA(freqP, repeatP->repeatFrequency);
      FldSetTextHandle(fld, freqH);
      if (FrmVisible(frm)) {
	FldEraseField(fld);
	FldDrawField(fld);
      }
    }
    MemHandleUnlock (freqH);
  }

  /* Set the selection of the "repeat on" push button groups. */
  if (repeatP->repeatType == repeatWeekly) {
    /*
    ** If the appointment has a different start-day-of-week than
    ** the dialog-box's current start-day-of-week, rearrange the
    ** labels on the days-of-week push buttons.
    ** Note that this will only handle button-label shifts of one day.
    */
    if (startOfWeek != d.repeat_start_of_week) {
      const Char* sundayLabel = CtlGetLabel(GetObjectPointer(frm, RepeatDayOfWeek1PushButton));
      for (id = RepeatDayOfWeek1PushButton; id < RepeatDayOfWeek7PushButton; id++)
	CtlSetLabel(GetObjectPointer(frm, id), CtlGetLabel(GetObjectPointer(frm, id + 1)));

      CtlSetLabel(GetObjectPointer(frm, RepeatDayOfWeek7PushButton), sundayLabel);
      d.repeat_start_of_week = startOfWeek;
    }

    /* Turn on the push buttons for the days the appointment repeats on. */
    for (i = 0; i < daysInWeek; i++) {
      on = ((repeatP->repeatOn & (1 << i) ) != 0);
      id = RepeatDayOfWeek1PushButton +
	((i - startOfWeek + daysInWeek) % daysInWeek);
      CtlSetValue(GetObjectPointer(frm, id), on);
    }
  }

  /* Set the selection of the "repeat by" push button groups. */
  if (repeatP->repeatType == repeatMonthlyByDate)
    FrmSetControlGroupSelection(frm, RepeatByGroup, RepeatByDatePushButton);
  else
    FrmSetControlGroupSelection(frm, RepeatByGroup, RepeatByDayPushButton);
  
  /* Set the "end on" trigger label and popup list selection. */
  if (repeatP->repeatType != repeatNone)
    RepeatSetDateTrigger(repeatP->repeatEndDate);
}
Beispiel #5
0
static Boolean URLFormDoCommand(UInt16 command)
{
    GlobalsPtr  gP = GetGlobals();
    Boolean     handled = false;

    if (!gP)
        return false;

    switch (command) {
        // Menus
        // Control Objects
        case kURLOpenButton:
            {
                Char    *navigationText = FldGetTextPtr(GetObjectPtr(kURLField));
                Boolean openInNewTab = false;
                
                if (navigationText && StrLen(navigationText)) {
                    if (gP->navigationOpen) {
                        MemPtrFree(gP->navigationOpen);
                    }
                    gP->navigationOpen = StrDup(navigationText);
                    
                    if (CtlGetValue(GetObjectPtr(kURLOpenInNewTabCheckbox))) {
                        openInNewTab = true;
                    }
                    
                    FrmReturnToForm(0);
                    if (openInNewTab) {
                        FrmUpdateForm(kMainForm, frmUpdateNewTab);
                    }
                    FrmUpdateForm(kMainForm, URLFormDetermineRequestType(navigationText));
                }
            }
            break;
        case kURLCancelButton:
            FrmReturnToForm(0);
            break;
        // Handle inserting text using the insert buttons, or list.
        case kWWWPushButton:
        case kCOMPushButton:
        case kORGPushButton:
        case kNETPushButton:
        case kSlashPushButton:
        case kDotPushButton:
        case kHTMLPushButton:
            {
                FieldPtr    urlFldP         = GetObjectPtr(kURLField);
                const Char  *buttonLabelP   = CtlGetLabel(GetObjectPtr(command));
                
                FldInsert(urlFldP, buttonLabelP, StrLen(buttonLabelP));
                CtlSetValue(GetObjectPtr(command), 0);
                
                handled = true;
            }
            break;
        case kMoreTrigger:
            {
                ListPtr     moreListP   = GetObjectPtr(kMoreList);
                FieldPtr    urlFldP     = GetObjectPtr(kURLField);
                Int16       selection   = LstPopupList(moreListP);
                
                if (selection >= 0) {
                    const Char  *selectionP = LstGetSelectionText(moreListP, selection);
                
                    FldInsert(urlFldP, selectionP, StrLen(selectionP));
                }
                handled = true;
            }
            break;
        // Default
        default:
            break;
    }

    return handled;
}