00001 #ifndef SCBPAGES_H_ 00002 #define SCBPAGES_H_ 00003 00004 /* 00005 * File Name : scbpages.h 00006 * 00007 * Description: Scribble library macros 00008 */ 00009 00010 /* 00011 * This file is part of liberscribble. 00012 * 00013 * liberscribble is free software: you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation, either version 2 of the License, or 00016 * (at your option) any later version. 00017 * 00018 * liberscribble is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 */ 00026 00027 /** 00028 * Copyright (C) 2008 iRex Technologies B.V. 00029 * All rights reserved. 00030 */ 00031 00032 00033 //---------------------------------------------------------------------------- 00034 // Include Files 00035 //---------------------------------------------------------------------------- 00036 00037 // system include files, between < > 00038 #include <glib.h> 00039 00040 // ereader include files, between < > 00041 00042 // local include files, between " " 00043 #include "scbpage.h" 00044 00045 G_BEGIN_DECLS 00046 00047 00048 //---------------------------------------------------------------------------- 00049 // Definitions 00050 //---------------------------------------------------------------------------- 00051 00052 00053 //---------------------------------------------------------------------------- 00054 // Forward Declarations 00055 //---------------------------------------------------------------------------- 00056 00057 00058 //---------------------------------------------------------------------------- 00059 // Type Declarations 00060 //---------------------------------------------------------------------------- 00061 00062 typedef struct _ScbPages 00063 { 00064 GList * pages; /**< A list of scribble pages pointers */ 00065 } ScbPages; 00066 00067 typedef ScbPages * ScbPagesPtr; 00068 00069 00070 //---------------------------------------------------------------------------- 00071 // Global Constants 00072 //---------------------------------------------------------------------------- 00073 00074 00075 //============================================================================ 00076 // Public Functions 00077 //============================================================================ 00078 00079 // Construct a new pages list, the member pages in ScbPages structure 00080 // will be initialized 00081 // @param ptr the pointer of a ScbPages instance 00082 // @return return TRUE if construction succeeds 00083 gboolean erscribble_pages_new(ScbPagesPtr ptr); 00084 00085 // Free the list as well as all of the items 00086 // @param ptr the pointer of a ScbPages instance 00087 void erscribble_pages_free(ScbPagesPtr ptr); 00088 00089 // Add a page instance into the list 00090 // If the same page has been cached, return directly 00091 // @param pages the pointer of pages list 00092 // @param page the scribble page to be added 00093 // @return return TRUE if page exists in the list 00094 gboolean erscribble_pages_add_page(ScbPagesPtr pages, ScbPagePtr page); 00095 00096 // Detach a ScbPage instance from list without freeing the page 00097 // @param pages the pointer of pages list 00098 // @param id ID of the scribble page which needs to be detached 00099 // @return return the detached page instance 00100 ScbPagePtr erscribble_pages_detach_page(ScbPagesPtr pages, ScbPageIdPtr id); 00101 00102 // Remove a ScbPage instance from list and free the page 00103 // @param pages the pointer of pages list 00104 // @param id ID of the scribble page which needs to be freed 00105 void erscribble_pages_remove_page(ScbPagesPtr pages, ScbPageIdPtr id); 00106 00107 // Get the number of pages in a list 00108 // @param ptr the pointer of pages list 00109 // @return return the number of pages 00110 int erscribble_pages_get_count(ScbPagesPtr ptr); 00111 00112 // Get a scribble page by ID 00113 // @param pages the pointer of pages list 00114 // @param id ID of the scribble page for searching 00115 // @return return the needed page if it exists, otherwise return NULL 00116 ScbPagePtr erscribble_pages_get_page(ScbPagesPtr pages, ScbPageIdPtr id); 00117 00118 // Change the ID of a page that is in the page list 00119 // @param pages the pointer of pages list 00120 // @param oldId the original id of the page instance 00121 // @param newId the new id of the page instance 00122 // @return return TRUE if the id sucessfully changes, otherwise return FALSE 00123 gboolean erscribble_pages_change_page_id(ScbPagesPtr pages, ScbPageIdPtr oldId, 00124 ScbPageIdPtr newId); 00125 00126 // Dump the data of pages 00127 // This function can be used for debug 00128 void erscribble_pages_dump(ScbPagesPtr pages); 00129 00130 gboolean remove_oldest_page_data(ScbPagesPtr pages); 00131 00132 G_END_DECLS 00133 00134 #endif