Ignore:
Timestamp:
Feb 11, 2007, 4:52:34 PM (19 years ago)
Author:
cinc
Message:

Started drag and drop implementation. Some dox additions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/desktop/class_c/wpfolder.c

    r224 r237  
    1616* The Initial Developer of the Original Code is
    1717* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
    18 * Portions created by the Initial Developer are Copyright (C) 2005-2006
     18* Portions created by the Initial Developer are Copyright (C) 2005-2007
    1919* the Initial Developer. All Rights Reserved.
    2020*
     
    341341           
    342342            wpFldrWindow=WPFolder_wpCreateFolderWindow(nomSelf, NULLHANDLE);
    343             WPFolderWindow_wpSetWPObject(wpFldrWindow, (WPObject*)nomSelf, NULLHANDLE);
    344343           
    345344            /* Insert it into inuse list */
     
    470469}
    471470
    472 /*
     471enum{
     472  WPOBJECT_TARGET_PATH,
     473  WPOBJECT_TARGET_OBJECT,
     474  WPOBJECT_TARGET_STRING
     475};
     476
     477static GtkTargetEntry targetEntries[]=
     478{
     479  {"WPObject-path", 0, WPOBJECT_TARGET_PATH},
     480  {"WPObject", 0, WPOBJECT_TARGET_OBJECT},
     481  {"STRING", 0, WPOBJECT_TARGET_STRING},
     482};
     483
     484static void fldrDragDataReceived(GtkWidget * widget, GdkDragContext* dragContext, int x, int y, GtkSelectionData *seldata,
     485                          guint info, guint uiTime, gpointer ptrUserData)
     486{
     487  DosBeep(5000, 100);
     488  g_message("%s", __FUNCTION__);
     489  return;
     490}
     491
     492
     493
     494
     495static void fldrDragDataGet(GtkWidget * widget, GdkDragContext* dragContext, GtkSelectionData *seldata,
     496                    guint uiInfo, guint t, gpointer ptrUserData)
     497{
     498  DosBeep(100, 100);
     499  g_message("%s", __FUNCTION__);
     500  //  gtk_selection_data_set();
     501  return;
     502}
     503
     504
     505#if 0
     506/**
     507   Get the WPFolder object from a container widget (icon view). If the object can't be queried
     508   NULL is returned.
     509   Note that this function checks if the pointer points to a NOMObject so a call to
     510   nomIsObj() is not necessary.
     511 */
     512static PWPFolder fldrQueryWPFolderFromContainer(GtkWidget * wgtThis)
     513{
     514  GtkWidget* wgtToplevel;
     515  PWPFolder wpFolder;
     516
     517  if((wgtToplevel=gtk_widget_get_toplevel(wgtThis))==NULLHANDLE)
     518    return NULLHANDLE;
     519
     520  if(!GTK_WIDGET_TOPLEVEL(wgtToplevel))
     521    return NULLHANDLE;
     522
     523  wpFolder=(PWPFolder) g_object_get_data(G_OBJECT(wgtToplevel), NOMOBJECT_KEY_STRING);
     524  if(nomIsObj(wpFolder))
     525    return wpFolder;
     526
     527  return NULLHANDLE;
     528}
     529#endif
     530
     531
     532/**
    473533  This method creates the folder window it doesn't query any files or creates
    474534  models and stuff.
     
    479539  PPRIVFOLDERDATA priv;
    480540  WPFolderData *nomThis = WPFolderGetData(nomSelf);
    481 
     541 
    482542  priv=(PPRIVFOLDERDATA)_privFolderData;
    483543
    484544  wpFldrWindow=WPFolderWindowNew();
     545
     546  /* Save a pointer to the desktop folder object */
     547  WPFolderWindow_wpSetWPObject(wpFldrWindow, (WPObject*)nomSelf, NULLHANDLE);
    485548
    486549  /* Connect to the "item_activated" signal */
     
    489552
    490553  WPFolderWindow_wpSetWindowTitle(wpFldrWindow, WPFolder_wpQueryTitle(nomSelf, NULLHANDLE), NULLHANDLE);
     554
     555  /* Prepare drag and drop */
     556  gtk_drag_source_set(WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, NULLHANDLE), GDK_BUTTON3_MASK, targetEntries,
     557                      G_N_ELEMENTS(targetEntries) ,
     558                      GDK_ACTION_LINK|GDK_ACTION_COPY|GDK_ACTION_MOVE);
     559  gtk_drag_dest_set(WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, NULLHANDLE), GTK_DEST_DEFAULT_ALL, targetEntries, 1 ,
     560                      GDK_ACTION_LINK|GDK_ACTION_COPY|GDK_ACTION_MOVE);
     561  g_signal_connect(WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, NULLHANDLE),"drag_data_received",
     562                   G_CALLBACK(fldrDragDataReceived), NULL);
     563  g_signal_connect(WPFolderWindow_wpQueryContainerHandle(wpFldrWindow, NULLHANDLE),"drag_data_get",
     564                   G_CALLBACK(fldrDragDataGet), NULL);
    491565
    492566  /* Show the new window */
     
    572646
    573647
    574 
    575 
     648/* orbit-idl-c-stubs.c, cs_output_stub line 347 */
     649NOM_Scope gulong NOMLINK impl_WPFolder_wpDragOver(WPFolder* nomSelf, const gpointer containerHandle,
     650                                                  const gpointer pDragInfo, CORBA_Environment *ev)
     651{
     652/* WPFolderData* nomThis=WPFolderGetData(nomSelf); */
     653
     654  return GDK_ACTION_COPY;
     655 
     656#if 0
     657  /* orbit-idl-c-stubs.c, VoyagerWriteProtoForParentCall line 119 */
     658  WPFolder_wpDragOver_parent(nomSelf,  ev);
     659#endif
     660}
     661
     662
Note: See TracChangeset for help on using the changeset viewer.