harmony 鸿蒙oh_pasteboard.h
oh_pasteboard.h
Overview
Provides data structure, enum types, and APIs for accessing the system pasteboard.
Library: libpasteboard.so
File to include:
System capability: SystemCapability.MiscServices.Pasteboard
Since: 13
Related module: Pasteboard
Summary
Types
Name | Description |
---|---|
typedef enum Pasteboard_NotifyType Pasteboard_NotifyType | Defines an enum for the data change types of the pasteboard. |
typedef void(* Pasteboard_Notify) (void *context, Pasteboard_NotifyType type) | Defines a callback to be invoked when the pasteboard content changes. |
typedef void(* Pasteboard_Finalize) (void *context) | Defines a callback to be invoked to release the context when the pasteboard observer object is destroyed. |
typedef struct OH_PasteboardObserver OH_PasteboardObserver | Defines a struct for the pasteboard observer. |
typedef struct OH_Pasteboard OH_Pasteboard | Define a struct for the pasteboard object to operate the system pasteboard. |
typedef enum Pasteboard_FileConflictOptions Pasteboard_FileConflictOptions | Defines an enum for options for file copy conflicts. |
typedef enum Pasteboard_ProgressIndicator Pasteboard_ProgressIndicator | Defines an enum for progress indicator display options. You can choose whether to use the default progress indicator. |
typedef struct Pasteboard_ProgressInfo Pasteboard_ProgressInfo | Defines a struct for the progress information. This information is reported only when Pasteboard_ProgressIndicator is set to PASTEBOARD_NONE. |
typedef void (* OH_Pasteboard_ProgressListener)(Pasteboard_ProgressInfo* progressInfo) | Defines a callback function for obtaining the progress information. If the default progress indicator is not used, you can set this type to obtain the paste progress. |
typedef struct Pasteboard_GetDataParams Pasteboard_GetDataParams | Defines a struct for the pasteboard parameters required for displaying progress, including progress indicator options, destination path, and file conflict options. |
Enums
Name | Description |
---|---|
Pasteboard_NotifyType { [NOTIFY_LOCAL_DATA_CHANGE] = 1, [NOTIFY_REMOTE_DATA_CHANGE] = 2 } | Enumerates the data change types of the pasteboard. |
Pasteboard_FileConflictOptions { [PASTEBOARD_OVERWRITE] = 0, [PASTEBOARD_SKIP] = 1 } | Enumerates options for a file copy conflict. |
Pasteboard_ProgressIndicator { [PASTEBOARD_NONE] = 0, [PASTEBOARD_DEFAULT] = 1 } | Enumerates progress indicator types. |
Functions
Name | Description |
---|---|
OH_PasteboardObserver * OH_PasteboardObserver_Create () | Creates an OH_PasteboardObserver instance and a pointer to it. |
int OH_PasteboardObserver_Destroy (OH_PasteboardObserver *observer) | Destroys an OH_PasteboardObserver instance. |
int OH_PasteboardObserver_SetData (OH_PasteboardObserver *observer, void *context, const Pasteboard_Notify callback, const Pasteboard_Finalize finalize) | Sets a callback for the pasteboard observer. |
OH_Pasteboard * OH_Pasteboard_Create () | Creates an OH_Pasteboard instance and a pointer to it. |
void OH_Pasteboard_Destroy (OH_Pasteboard *pasteboard) | Destroys an OH_Pasteboard instance. |
int OH_Pasteboard_Subscribe (OH_Pasteboard *pasteboard, int type, const OH_PasteboardObserver *observer) | Subscribes to the pasteboard observer. |
int OH_Pasteboard_Unsubscribe (OH_Pasteboard *pasteboard, int type, const OH_PasteboardObserver *observer) | Unsubscribes from the pasteboard observer. |
bool OH_Pasteboard_IsRemoteData (OH_Pasteboard *pasteboard) | Checks whether the pasteboard data comes from remote devices. |
int OH_Pasteboard_GetDataSource (OH_Pasteboard *pasteboard, char *source, unsigned int len) | Obtains the pasteboard data source. |
bool OH_Pasteboard_HasType (OH_Pasteboard *pasteboard, const char *type) | Checks whether the pasteboard contains data of the specified type. |
bool OH_Pasteboard_HasData (OH_Pasteboard *pasteboard) | Checks whether the pasteboard contains data. |
OH_UdmfData * OH_Pasteboard_GetData (OH_Pasteboard *pasteboard, int *status) | Obtains data from the pasteboard. |
int OH_Pasteboard_SetData (OH_Pasteboard *pasteboard, OH_UdmfData *data) | Writes the unified data object to the pasteboard. |
int OH_Pasteboard_ClearData (OH_Pasteboard *pasteboard) | Clears data from the pasteboard. |
char ** OH_Pasteboard_GetMimeTypes (OH_Pasteboard *pasteboard, unsigned int *count) | Obtains the MIME type from the pasteboard. |
Pasteboard_GetDataParams *OH_Pasteboard_GetDataParams_Create(void) | Creates a Pasteboard_GetDataParams instance and a pointer to it. |
void OH_Pasteboard_GetDataParams_Destroy(Pasteboard_GetDataParams* params) | Destroys a Pasteboard_GetDataParams instance. |
void OH_Pasteboard_GetDataParams_SetProgressIndicator(Pasteboard_GetDataParams* params, Pasteboard_ProgressIndicator progressIndicator) | Sets the progress indication options in Pasteboard_GetDataParams. You can use the default progress indicator as required. |
void OH_Pasteboard_GetDataParams_SetDestUri(Pasteboard_GetDataParams* params, const char* destUri, uint32_t destUriLen) | Sets the destination path in Pasteboard_GetDataParams. |
void OH_Pasteboard_GetDataParams_SetFileConflictOptions(Pasteboard_GetDataParams* params, Pasteboard_FileConflictOptions option) | Sets the file copy conflict options in Pasteboard_GetDataParams. |
void OH_Pasteboard_GetDataParams_SetProgressListener(Pasteboard_GetDataParams* params, const OH_Pasteboard_ProgressListener listener) | Sets a progress listener in Pasteboard_GetDataParams. |
int OH_Pasteboard_ProgressInfo_GetProgress(Pasteboard_ProgressInfo* progressInfo) | Obtains the pasting progress using Pasteboard_ProgressInfo. |
void OH_Pasteboard_ProgressCancel(Pasteboard_GetDataParams* params) | Cancels an ongoing copy and paste task using Pasteboard_GetDataParams. |
OH_UdmfData* OH_Pasteboard_GetDataWithProgress(OH_Pasteboard* pasteboard, Pasteboard_GetDataParams* params, int* status) | Obtains the pasteboard data and pasting progress. Folders cannot be copied. |
int32_t OH_Pasteboard_GetChangeCount (OH_Pasteboard *pasteboard) | Obtains the number of times that the pasteboard data changes. |
你可能感兴趣的鸿蒙文章
0
赞
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦