Changeset 127 for trunk/desktop/class_c/wpfolder.c
- Timestamp:
- Nov 29, 2006, 9:17:22 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/desktop/class_c/wpfolder.c
r122 r127 63 63 #include "desktoptypes.h" 64 64 65 /* Gui stuff */ 66 #include "nomguitk.h" 67 #include "nomfolderwindow.h" 68 65 69 /* Enum for the folder store */ 66 70 enum … … 85 89 return store; 86 90 } 87 88 static void89 itemActivated (GtkIconView *icon_view,90 GtkTreePath *tree_path,91 gpointer user_data)92 {93 DosBeep(1500, 100);94 }95 96 /*97 Check if the right button click was within a certain time. That means98 the user released the button again within a short time period. On OS/299 a context menu will display after the user released the button not when100 the user pressed it.101 */102 #define CTXT_MENU_BUTTON_DELAY 250103 static gboolean104 fldr_checkContextButton(GdkEventButton *event)105 {106 static guint guiTime=0;107 108 /* Right mouse button */109 if (event->button != 3)110 return FALSE;111 112 /* Ignore double-clicks and triple-clicks */113 if(event->type == GDK_BUTTON_PRESS)114 guiTime=event->time;115 116 if(event->type == GDK_BUTTON_RELEASE)117 {118 if(event->time-guiTime<CTXT_MENU_BUTTON_DELAY)119 return TRUE;120 }121 122 return FALSE;123 }124 125 static gboolean126 fldr_handleButtonEvent (GtkWidget *widget, GdkEventButton *event, gpointer user_data)127 {128 if(fldr_checkContextButton(event))129 {130 DosBeep(5000, 100);131 /* This is the folder object not the object on which a click occured */132 WPObject *wpObject=(WPObject*)user_data;133 if(nomIsObj(wpObject)){134 nomPrintf("%s: %x->%s\n", __FUNCTION__, wpObject, wpObject->mtab->nomClassName);135 }136 #if 0137 if(!somIsObj(wpObject))138 return TRUE;139 140 /* ptlPopupPt is NULLHANDLE because GTK automatically pick a useful position for the popup141 menu. */142 _wpDisplayMenu(wpObject, NULLHANDLE, (HWND) widget, NULLHANDLE, 0, (ULONG) 0);143 return TRUE;144 #endif145 }146 147 return FALSE;148 }149 150 91 151 92 static BOOL … … 230 171 231 172 /* pszPath contains the fully qualified path (checked with WPS) */ 232 NOM_Scope CORBA_boolean NOMLINK impl_WPFolder_wpPopulate(WPFolder* nomSelf, const CORBA_unsigned_long ulReserved, const CORBA_char * pszPath, const CORBA_boolean fFoldersOnly, CORBA_Environment *ev) 173 NOM_Scope CORBA_boolean NOMLINK impl_WPFolder_wpPopulate(WPFolder* nomSelf, const CORBA_unsigned_long ulReserved, 174 const CORBA_char * pszPath, const CORBA_boolean fFoldersOnly, 175 CORBA_Environment *ev) 233 176 { 234 177 WPFolderData* nomThis=WPFolderGetData(nomSelf); … … 369 312 370 313 /* 371 This method creates the folder window it doesn't quer iesany files or creates314 This method creates the folder window it doesn't query any files or creates 372 315 models and stuff. 373 316 */ 374 317 NOM_Scope gpointer NOMLINK impl_WPFolder_wpCreateFolderWindow(WPFolder* nomSelf, CORBA_Environment *ev) 375 318 { 376 /* WPFolderData* nomThis=WPFolderGetData(nomSelf); */ 377 GtkWidget* window; 378 GtkWidget *vbox; 379 GtkWidget *sw; 380 GtkWidget *icon_view; 381 GtkWidget *tool_bar; 382 GtkToolItem *up_button; 319 NOMFolderWindow * nomFldrWindow; 383 320 PPRIVFOLDERDATA priv; 384 385 321 WPFolderData *nomThis = WPFolderGetData(nomSelf); 386 322 387 /* Folder toplevel window. */388 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);389 /* Set title */390 // gtk_window_set_title (GTK_WINDOW (window), gcPath);391 gtk_window_set_title (GTK_WINDOW (window), "");392 /* FIXME: Set default size of folder frame. Will later use a stored value */393 gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);394 395 vbox = gtk_vbox_new (FALSE, 0);396 gtk_container_add (GTK_CONTAINER (window), vbox);397 398 /* Create and pack the toolbar */399 tool_bar = gtk_toolbar_new ();400 gtk_box_pack_start (GTK_BOX (vbox), tool_bar, FALSE, FALSE, 0); /* Don't expand the toolbar vertically if sized */401 402 /* Parent button */403 up_button = gtk_tool_button_new_from_stock (GTK_STOCK_GO_UP);404 gtk_tool_item_set_is_important (up_button, TRUE);405 /* Disable button */406 gtk_widget_set_sensitive (GTK_WIDGET (up_button), FALSE);407 /* Put it into the toolbar */408 gtk_toolbar_insert (GTK_TOOLBAR (tool_bar), up_button, -1);409 410 sw = gtk_scrolled_window_new (NULL, NULL);411 /* Drawing style */412 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),413 GTK_SHADOW_ETCHED_IN);414 /* Show scrollbars only if necessary */415 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),416 GTK_POLICY_AUTOMATIC,417 GTK_POLICY_AUTOMATIC);418 /* Pack it into the vbox with size adjusting to the vbox */419 gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);420 /* Create an icon view without model */421 icon_view = gtk_icon_view_new ();422 /* Allow multiple selection in icon view */423 gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_view),424 GTK_SELECTION_MULTIPLE);425 /* Connect to the "item_activated" signal */426 g_signal_connect (icon_view, "item-activated",427 G_CALLBACK (itemActivated), nomSelf);428 /* This is for kb binding only */429 #if 0430 g_signal_connect (GTK_WIDGET(icon_view), "popup-menu",431 G_CALLBACK (fldr_cbPopupMenu), nomSelf);432 #endif433 /* Handle mouse buttons */434 g_signal_connect (GTK_WIDGET(icon_view), "button-press-event",435 G_CALLBACK (fldr_handleButtonEvent), nomSelf);436 g_signal_connect (GTK_WIDGET(icon_view), "button-release-event",437 G_CALLBACK (fldr_handleButtonEvent), nomSelf);438 439 #if 0440 /* Connect to the "clicked" signal of the "Up" tool button */441 g_signal_connect (up_button, "clicked",442 G_CALLBACK (up_clicked), store);443 #endif444 /* Add icon view as child to the scroll window created earlier */445 gtk_container_add (GTK_CONTAINER (sw), icon_view);446 323 priv=(PPRIVFOLDERDATA)_privFolderData; 447 priv->gtkIconView=icon_view; 448 449 gtk_widget_grab_focus (icon_view); 450 451 gtk_widget_show_all (window); 452 453 return window; 454 } 455 456 457 458 459 324 325 nomFldrWindow=NOMFolderWindowNew(); 326 327 #warning !!!!! This is only for testing !!!!! 328 priv->gtkIconView=NOMFolderWindow_getContainerHandle(nomFldrWindow, ev); 329 330 NOMFolderWindow_show(nomFldrWindow, ev); 331 332 return NOMFolderWindow_getWindowHandle(nomFldrWindow, ev);; 333 } 334 335 336 337 338
Note:
See TracChangeset
for help on using the changeset viewer.