diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-29 17:01:48 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-30 12:44:04 +0200 |
commit | ba520b9dbb911d32dd770f4548399b98dd80bd2c (patch) | |
tree | 6d4280522ee03fcaaea1a5e89522d12c3c547701 /libreofficekit | |
parent | af58bb8335416ac6416f7f4b6269337b2127ab08 (diff) |
gtktiledviewer: add part mode selector.
Change-Id: Ia1e78df1d833f9b0fbda0b78136590c9c960fa27
Diffstat (limited to 'libreofficekit')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index d74eb962e01b..a96e1e3f8f6c 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -151,6 +151,29 @@ void changePart( GtkWidget* pSelector, gpointer /* pItem */ ) lok_docview_set_part( LOK_DOCVIEW(pDocView), nPart ); } } + +void populatePartModeSelector( GtkComboBoxText* pSelector ) +{ + gtk_combo_box_text_append_text( pSelector, "Default" ); + gtk_combo_box_text_append_text( pSelector, "Slide" ); + gtk_combo_box_text_append_text( pSelector, "Notes" ); + gtk_combo_box_text_append_text( pSelector, "Combined (SlideNotes)" ); + gtk_combo_box_text_append_text( pSelector, "Embedded Objects" ); + gtk_combo_box_set_active( GTK_COMBO_BOX(pSelector), 0 ); +} + +void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ ) +{ + // Just convert directly back to the LibreOfficeKitPartMode enum. + // I.e. the ordering above should match the enum member ordering. + LibreOfficeKitPartMode ePartMode = + LibreOfficeKitPartMode( gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) ) ); + + if ( pDocView ) + { + lok_docview_set_partmode( LOK_DOCVIEW(pDocView), ePartMode ); + } +} #endif int main( int argc, char* argv[] ) @@ -207,11 +230,20 @@ int main( int argc, char* argv[] ) gtk_container_add( GTK_CONTAINER(pPartSelectorToolItem), pComboBox ); gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartSelectorToolItem, -1 ); g_signal_connect( G_OBJECT(pComboBox), "changed", G_CALLBACK(changePart), NULL ); -#endif GtkToolItem* pSeparator2 = gtk_separator_tool_item_new(); gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1); + GtkToolItem* pPartModeSelectorToolItem = gtk_tool_item_new(); + GtkWidget* pPartModeComboBox = gtk_combo_box_text_new(); + gtk_container_add( GTK_CONTAINER(pPartModeSelectorToolItem), pPartModeComboBox ); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 ); + g_signal_connect( G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), NULL ); +#endif + + GtkToolItem* pSeparator3 = gtk_separator_tool_item_new(); + gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator3, -1); + GtkToolItem* pEnableQuadView = gtk_toggle_tool_button_new(); gtk_tool_button_set_label( GTK_TOOL_BUTTON(pEnableQuadView), "Use Quad View" ); gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pEnableQuadView, -1 ); @@ -233,6 +265,7 @@ int main( int argc, char* argv[] ) // GtkComboBox requires gtk 2.24 or later #if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2 populatePartSelector( GTK_COMBO_BOX_TEXT(pComboBox), LOK_DOCVIEW(pDocView) ); + populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) ); #endif gtk_main(); |