Changeset 35 for trunk/src/gtk/MainView.cxx
- Timestamp:
- 04/12/06 05:27:57 (3 years ago)
- Files:
-
- 1 modified
-
trunk/src/gtk/MainView.cxx (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gtk/MainView.cxx
r34 r35 20 20 #include <IMainView.h> 21 21 #include <MainPter.h> 22 #include <DocumentPage.h> 22 23 #include "MainView.h" 23 24 … … 52 53 GtkWidget *toolBar = gtk_ui_manager_get_widget (m_UIManager, "/ToolBar"); 53 54 gtk_box_pack_start (GTK_BOX (m_MainBox), toolBar, FALSE, FALSE, 0); 55 // Create the page view 56 GtkWidget *pageView = createPageView (); 57 gtk_box_pack_start (GTK_BOX (m_MainBox), pageView, TRUE, TRUE, 0); 54 58 } 55 59 … … 82 86 MainView::promptPasswordDialog () 83 87 { 88 return g_strdup(""); 84 89 } 85 90 … … 154 159 MainView::showPage (DocumentPage *page) 155 160 { 161 gtk_image_set_from_pixbuf (GTK_IMAGE (m_PageView), NULL); 162 GdkPixbuf *pixbuf = getPixbufFromPage (page); 163 gtk_image_set_from_pixbuf (GTK_IMAGE (m_PageView), pixbuf); 164 gdk_pixbuf_unref (pixbuf); 156 165 } 157 166 … … 169 178 MainView::getGoToPageText (void) 170 179 { 180 return "1"; 171 181 } 172 182 … … 185 195 // GTK+ Functions. 186 196 //////////////////////////////////////////////////////////////// 197 198 GtkWidget * 199 MainView::createPageView () 200 { 201 GtkWidget *scrolledWindow = gtk_scrolled_window_new (NULL, NULL); 202 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledWindow), 203 GTK_POLICY_AUTOMATIC, 204 GTK_POLICY_AUTOMATIC); 205 m_PageView = gtk_image_new (); 206 gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledWindow), 207 m_PageView); 208 return scrolledWindow; 209 } 187 210 188 211 void … … 268 291 } 269 292 293 GdkPixbuf * 294 MainView::getPixbufFromPage (DocumentPage *page) 295 { 296 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data (page->getData (), 297 GDK_COLORSPACE_RGB, FALSE, 8, page->getWidth (), page->getHeight (), 298 page->getRowStride (), NULL, NULL); 299 300 return pixbuf; 301 } 302 270 303 //////////////////////////////////////////////////////////////// 271 304 // GTK+ Callbacks.
