Copy data from the clipboard
typedef char PhClipType[8]; PhClipboardHdr *PhClipboardRead(unsigned short ig, PhClipType type);
ph
This function copies the clipboard data in that matches type from the Photon clipboard, and returns a pointer to the data populated in a PhClipboardWrite structure.
This callback reads data from the clipboard, and pastes it in a PtText widget named text:
int paste_from_clip( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo ) { int *cursor, ig, insertion_pt; PhClipboardHdr *ptr; ig=PhInputGroup(cbinfo->event); PtGetResource(ABW_text, Pt_ARG_CURSOR_POSITION, &cursor, 0); insertion_pt=*cursor; if (ptr=PhClipboardRead(ig,Ph_CLIPBOARD_TYPE_TEXT)) { PtTextModifyText(ABW_text, insertion_pt, insertion_pt, insertion_pt, ptr->data, utf8strblen( ptr->data, ptr->length, NULL ) ); free(ptr->data); free(ptr); } PtContainerGiveFocus(ABW_text,NULL); return(Pt_CONTINUE); }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PhClipboardCopyString(), PhClipboardHdr, PhClipboardPasteString(), PhClipboardWrite