本文整理汇总了C++中CAIRO_CONTAINER函数的典型用法代码示例。如果您正苦于以下问题:C++ CAIRO_CONTAINER函数的具体用法?C++ CAIRO_CONTAINER怎么用?C++ CAIRO_CONTAINER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CAIRO_CONTAINER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cd_do_select_last_first_entry_in_listing
void cd_do_select_last_first_entry_in_listing (gboolean bLast)
{
myData.pListing->fPreviousOffset = myData.pListing->fCurrentOffset;
GList *e = myData.pListing->pCurrentEntry;
int i;
if (bLast)
{
e = g_list_last (myData.pListing->pEntries);
i = myData.pListing->iNbEntries - 1;
while (e->prev != NULL && ((CDEntry *)(e->data))->bHidden)
{
e = e->prev;
i --;
}
}
else
{
e = myData.pListing->pEntries;
i = 0;
while (e->next != NULL && ((CDEntry *)(e->data))->bHidden)
{
e = e->next;
i ++;
}
}
myData.pListing->pCurrentEntry = e;
myData.pListing->fAimedOffset = i * (myDialogs.dialogTextDescription.iSize + 2);
myData.pListing->iCurrentEntryAnimationCount = NB_STEPS_FOR_CURRENT_ENTRY;
myData.pListing->iScrollAnimationCount = NB_STEPS_FOR_SCROLL;
myData.pListing->iTitleOffset = 0;
myData.pListing->sens = 1;
cairo_dock_launch_animation (CAIRO_CONTAINER (myData.pListing));
cairo_dock_redraw_container (CAIRO_CONTAINER (myData.pListing));
}
示例2: on_leave_desklet
static gboolean on_leave_desklet (GtkWidget* pWidget,
GdkEventCrossing* pEvent,
CairoDesklet *pDesklet)
{
//g_print ("%s (%d, %p, %d;%d)\n", __func__, pDesklet->container.bInside, pEvent, iMouseX, iMouseY);
int iMouseX, iMouseY;
if (pEvent != NULL)
{
iMouseX = pEvent->x;
iMouseY = pEvent->y;
}
else
{
gldi_container_update_mouse_position (CAIRO_CONTAINER (pDesklet));
iMouseX = pDesklet->container.iMouseX;
iMouseY = pDesklet->container.iMouseY;
}
if (gtk_bin_get_child (GTK_BIN (pDesklet->container.pWidget)) != NULL && iMouseX > 0 && iMouseX < pDesklet->container.iWidth && iMouseY > 0 && iMouseY < pDesklet->container.iHeight) // en fait on est dans un widget fils, donc on ne fait rien.
{
return FALSE;
}
pDesklet->container.bInside = FALSE;
Icon *pPointedIcon = cairo_dock_get_pointed_icon (pDesklet->icons);
if (pPointedIcon != NULL)
pPointedIcon->bPointed = FALSE;
gtk_widget_queue_draw (pWidget); // redessin des boutons.
gboolean bStartAnimation = FALSE;
gldi_object_notify (pDesklet, NOTIFICATION_LEAVE_DESKLET, pDesklet, &bStartAnimation);
if (bStartAnimation)
cairo_dock_launch_animation (CAIRO_CONTAINER (pDesklet));
return FALSE;
}
示例3: cd_do_select_prev_next_entry_in_listing
void cd_do_select_prev_next_entry_in_listing (gboolean bNext)
{
CDEntry *pEntry;
myData.pListing->fPreviousOffset = myData.pListing->fCurrentOffset;
GList *e = myData.pListing->pCurrentEntry;
if (bNext)
{
do
{
e = cairo_dock_get_next_element (e, myData.pListing->pEntries);
pEntry = e->data;
} while (e != myData.pListing->pCurrentEntry && pEntry->bHidden);
}
else
{
do
{
e = cairo_dock_get_previous_element (e, myData.pListing->pEntries);
pEntry = e->data;
} while (e != myData.pListing->pCurrentEntry && pEntry->bHidden);
}
myData.pListing->pCurrentEntry = e;
myData.pListing->fAimedOffset += (bNext ? 1:-1) * (myDialogs.dialogTextDescription.iSize + 2);
myData.pListing->iCurrentEntryAnimationCount = NB_STEPS_FOR_CURRENT_ENTRY;
myData.pListing->iScrollAnimationCount = NB_STEPS_FOR_SCROLL;
myData.pListing->iTitleOffset = 0;
myData.pListing->sens = 1;
cairo_dock_launch_animation (CAIRO_CONTAINER (myData.pListing));
cairo_dock_redraw_container (CAIRO_CONTAINER (myData.pListing));
}
示例4: cd_drop_indicator_update_dock
gboolean cd_drop_indicator_update_dock (gpointer pUserData, CairoDock *pDock, gboolean *bContinueAnimation)
{
CDDropIndicatorData *pData = CD_APPLET_GET_MY_DOCK_DATA (pDock);
if (pData == NULL)
return GLDI_NOTIFICATION_LET_PASS;
pData->iDropIndicatorOffset += myConfig.iSpeed;
if (pData->iDropIndicatorOffset > 2*myData.dropIndicator.iHeight)
pData->iDropIndicatorOffset -= 2*myData.dropIndicator.iHeight;
double dt = cairo_dock_get_animation_delta_t (CAIRO_CONTAINER (pDock));
pData->iDropIndicatorRotation += myConfig.fRotationSpeed * 360. * dt/1e3;
if (pDock->bCanDrop)
{
pData->fAlphaHover -= delta_alpha;
*bContinueAnimation = TRUE;
}
else
{
pData->fAlpha -= delta_alpha;
if (!pDock->bIsDragging)
pData->fAlphaHover -= delta_alpha;
if (pData->fAlpha <= 0 && pData->fAlphaHover <= 0)
{
g_free (pData);
pData = NULL;
CD_APPLET_SET_MY_DOCK_DATA (pDock, NULL);
}
else
*bContinueAnimation = TRUE;
}
GdkRectangle rect = {(int) pDock->container.iMouseX - myData.dropIndicator.iWidth/2,
(int) (pDock->container.bDirectionUp ? 0 : pDock->iActiveHeight - 2*myData.dropIndicator.iHeight),
(int) myData.dropIndicator.iWidth,
(int) 2*myData.dropIndicator.iHeight};
if (! pDock->container.bIsHorizontal)
{
rect.x = (int) (pDock->container.bDirectionUp ? pDock->container.iHeight - pDock->iActiveHeight : pDock->iActiveHeight - 2*myData.dropIndicator.iHeight);
rect.y = (int) pDock->container.iMouseX - myData.dropIndicator.iWidth/2;
rect.width = (int) 2*myData.dropIndicator.iHeight;
rect.height = (int) myData.dropIndicator.iWidth;
}
//g_print ("rect (%d;%d) (%dx%d)\n", rect.x, rect.y, rect.width, rect.height);
if (rect.width > 0 && rect.height > 0)
{
cairo_dock_redraw_container_area (CAIRO_CONTAINER (pDock), &rect);
}
if (pData && pData->fAlphaHover > 0)
{
Icon *pIcon = cairo_dock_get_pointed_icon (pDock->icons);
if (pIcon != NULL)
cairo_dock_redraw_icon (pIcon);
}
return GLDI_NOTIFICATION_LET_PASS;
}
示例5: cd_do_show_listing
void cd_do_show_listing (void)
{
if (myData.pListing == NULL)
{
myData.pListing = cd_do_create_listing ();
cairo_dock_register_notification_on_container (CAIRO_CONTAINER (myData.pListing),
CAIRO_DOCK_UPDATE_DEFAULT_CONTAINER,
(CairoDockNotificationFunc) cd_do_update_listing_notification,
CAIRO_DOCK_RUN_AFTER,
NULL);
cairo_dock_register_notification_on_container (CAIRO_CONTAINER (myData.pListing),
CAIRO_DOCK_RENDER_DEFAULT_CONTAINER,
(CairoDockNotificationFunc) cd_do_render_listing_notification,
CAIRO_DOCK_RUN_AFTER,
NULL);
if (myData.pScoobySurface == NULL)
{
cairo_t* pSourceContext = cairo_dock_create_context_from_container (CAIRO_CONTAINER (g_pMainDock));
myData.pScoobySurface = cairo_dock_create_surface_from_image_simple (MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE,
pSourceContext,
2 * (myDialogs.dialogTextDescription.iSize + 2),
2 * (myDialogs.dialogTextDescription.iSize + 2));
cairo_destroy (pSourceContext);
}
if (myData.pActiveButtonSurface == NULL)
{
g_print ("load button : %dx%d\n", myDialogs.dialogTextDescription.iSize + 2, myData.pListing->container.iWidth);
cairo_t* pSourceContext = cairo_dock_create_context_from_container (CAIRO_CONTAINER (g_pMainDock));
myData.pActiveButtonSurface = cairo_dock_create_surface_from_image_simple (MY_APPLET_SHARE_DATA_DIR"/active-button.svg",
pSourceContext,
(myData.pListing->container.iWidth - (myDialogs.dialogTextDescription.iSize + 2) * 3) / 3,
myDialogs.dialogTextDescription.iSize + 2);
myData.pInactiveButtonSurface = cairo_dock_create_surface_from_image_simple (MY_APPLET_SHARE_DATA_DIR"/inactive-button.svg",
pSourceContext,
(myData.pListing->container.iWidth - (myDialogs.dialogTextDescription.iSize + 2) * 3) / 3,
myDialogs.dialogTextDescription.iSize + 2);
cairo_destroy (pSourceContext);
}
}
else
{
gtk_widget_show (myData.pListing->container.pWidget);
int iWidth = _listing_compute_width (pListing);
int iHeight = _listing_compute_height (pListing);
if (myData.pListing->container.iWidth != iWidth || myData.pListing->container.iHeight != iHeight)
{
gtk_window_resize (GTK_WINDOW (myData.pListing->container.pWidget),
iWidth,
iHeight);
}
_place_listing (myData.pListing);
cairo_dock_redraw_container (CAIRO_CONTAINER (myData.pListing));
}
}
示例6: rendering_free_caroussel_data
void rendering_free_caroussel_data (CairoDesklet *pDesklet)
{
cairo_dock_remove_notification_func_on_container (CAIRO_CONTAINER (pDesklet), CAIRO_DOCK_UPDATE_DESKLET, (CairoDockNotificationFunc) on_update_desklet, NULL);
cairo_dock_remove_notification_func_on_container (CAIRO_CONTAINER (pDesklet), CAIRO_DOCK_MOUSE_MOVED, (CairoDockNotificationFunc) on_mouse_move, NULL);
CDCarousselParameters *pCaroussel = (CDCarousselParameters *) pDesklet->pRendererData;
if (pCaroussel == NULL)
return ;
g_free (pCaroussel);
pDesklet->pRendererData = NULL;
}
示例7: _cairo_dock_set_dialog_input_shape
static void _cairo_dock_set_dialog_input_shape (CairoDialog *pDialog)
{
if (pDialog->pShapeBitmap != NULL)
cairo_region_destroy (pDialog->pShapeBitmap);
pDialog->pShapeBitmap = gldi_container_create_input_shape (CAIRO_CONTAINER (pDialog),
0,
0,
1,
1); // workaround a bug in X with fully transparent window => let 1 pixel ON.
gldi_container_set_input_shape (CAIRO_CONTAINER (pDialog), pDialog->pShapeBitmap);
}
示例8: on_expose_listing
static gboolean on_expose_listing (GtkWidget *pWidget, GdkEventExpose *pExpose, CDListing *pListing)
{
if (g_bUseOpenGL && pListing->container.glContext)
{
GdkGLContext *pGlContext = gtk_widget_get_gl_context (pWidget);
GdkGLDrawable *pGlDrawable = gtk_widget_get_gl_drawable (pWidget);
if (!gdk_gl_drawable_gl_begin (pGlDrawable, pGlContext))
return FALSE;
if (pExpose->area.x + pExpose->area.y != 0)
{
glEnable (GL_SCISSOR_TEST);
glScissor ((int) pExpose->area.x,
(int) (pListing->container.bIsHorizontal ? pListing->container.iHeight : pListing->container.iWidth) -
pExpose->area.y - pExpose->area.height, // lower left corner of the scissor box.
(int) pExpose->area.width,
(int) pExpose->area.height);
}
cairo_dock_notify_on_container (CAIRO_CONTAINER (pListing), CAIRO_DOCK_RENDER_DEFAULT_CONTAINER, pListing, NULL);
glDisable (GL_SCISSOR_TEST);
if (gdk_gl_drawable_is_double_buffered (pGlDrawable))
gdk_gl_drawable_swap_buffers (pGlDrawable);
else
glFlush ();
gdk_gl_drawable_gl_end (pGlDrawable);
}
else
{
cairo_t *pCairoContext;
if (pExpose->area.x > 0 || pExpose->area.y > 0)
{
double fColor[4] = {0., 0., 0., 0.};
pCairoContext = cairo_dock_create_drawing_context_on_area (CAIRO_CONTAINER (pListing), &pExpose->area, fColor);
}
else
{
pCairoContext = cairo_dock_create_drawing_context (CAIRO_CONTAINER (pListing));
}
cairo_dock_notify_on_container (CAIRO_CONTAINER (pListing), CAIRO_DOCK_RENDER_DEFAULT_CONTAINER, pListing, pCairoContext);
cairo_destroy (pCairoContext);
}
return FALSE;
}
示例9: init_object
static void init_object (GldiObject *obj, gpointer attr)
{
CairoDesklet *pDesklet = (CairoDesklet*)obj;
CairoDeskletAttr *pAttributes = (CairoDeskletAttr*)attr;
g_return_if_fail (pAttributes->pIcon != NULL);
gldi_desklet_init_internals (pDesklet);
// attach the main icon
Icon *pIcon = pAttributes->pIcon;
pDesklet->pIcon = pIcon;
cairo_dock_set_icon_container (pIcon, pDesklet);
if (CAIRO_DOCK_IS_APPLET (pIcon))
gtk_window_set_title (GTK_WINDOW (pDesklet->container.pWidget), pIcon->pModuleInstance->pModule->pVisitCard->cModuleName);
// configure the desklet
gldi_desklet_configure (pDesklet, pAttributes);
// load buttons images
if (s_pRotateButtonBuffer.pSurface == NULL)
{
_load_desklet_buttons ();
}
// register the new desklet
s_pDeskletList = g_list_prepend (s_pDeskletList, pDesklet);
// start the appearance animation
if (! cairo_dock_is_loading ())
{
pDesklet->container.fRatio = 0.1;
pDesklet->bGrowingUp = TRUE;
cairo_dock_launch_animation (CAIRO_CONTAINER (pDesklet));
}
}
示例10: cd_rendering_calculate_max_dock_size_3D_plane
void cd_rendering_calculate_max_dock_size_3D_plane (CairoDock *pDock)
{
pDock->pFirstDrawnElement = cairo_dock_calculate_icons_positions_at_rest_linear (pDock->icons, pDock->fFlatDockWidth, pDock->iScrollOffset);
pDock->iMaxDockHeight = (int) ((1 + g_fAmplitude) * pDock->iMaxIconHeight + g_fReflectSize) + g_iconTextDescription.iSize + g_iDockLineWidth + g_iFrameMargin;
double hi = g_fReflectSize + g_iFrameMargin;
double fInclinationOnHorizon = 0, fExtraWidth = 0;
pDock->iMaxDockWidth = ceil (cairo_dock_calculate_max_dock_width (pDock, pDock->pFirstDrawnElement, pDock->fFlatDockWidth, 1., fExtraWidth));
fInclinationOnHorizon = 0.5 * pDock->iMaxDockWidth / iVanishingPointY;
pDock->iDecorationsHeight = hi + (pDock->iMaxIconHeight + g_iFrameMargin) / sqrt (1 + fInclinationOnHorizon * fInclinationOnHorizon);
fExtraWidth = cairo_dock_calculate_extra_width_for_trapeze (pDock->iDecorationsHeight, fInclinationOnHorizon, g_iDockRadius, g_iDockLineWidth);
cd_debug ("iMaxDockWidth <- %d; fInclinationOnHorizon <- %.2f; fExtraWidth <- %.2f", pDock->iMaxDockWidth, fInclinationOnHorizon, fExtraWidth);
pDock->iMaxDockWidth = ceil (cairo_dock_calculate_max_dock_width (pDock, pDock->pFirstDrawnElement, pDock->fFlatDockWidth, 1., fExtraWidth));
cd_debug ("pDock->iMaxDockWidth <- %d", pDock->iMaxDockWidth);
pDock->iDecorationsWidth = pDock->iMaxDockWidth;
pDock->iMinDockWidth = pDock->fFlatDockWidth + fExtraWidth;
pDock->iMinDockHeight = g_iDockLineWidth + g_iFrameMargin + g_fReflectSize + pDock->iMaxIconHeight;
if (my_pFlatSeparatorSurface[0] == NULL && (my_iDrawSeparator3D == CD_FLAT_SEPARATOR || my_iDrawSeparator3D == CD_PHYSICAL_SEPARATOR))
cd_rendering_load_flat_separator (CAIRO_CONTAINER (g_pMainDock));
}
示例11: _cd_do_execute_command
static void _cd_do_execute_command (CDEntry *pEntry)
{
gchar *cCommand = g_strdup_printf ("%s/calc.sh '%s'", MY_APPLET_SHARE_DATA_DIR, myData.sCurrentText->str);
gchar *cResult = cairo_dock_launch_command_sync (cCommand);
g_free (cCommand);
if (cResult != NULL && strcmp (cResult, "0") != 0)
{
g_print (" resultat du calcul : '%s'\n", cResult);
GtkClipboard *pClipBoard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
gtk_clipboard_set_text (pClipBoard, cResult, -1);
Icon *pIcon = cairo_dock_get_dialogless_icon ();
cairo_dock_show_temporary_dialog_with_icon (D_("The value %s has been copied into the clipboard."),
pIcon,
CAIRO_CONTAINER (g_pMainDock),
3000,
MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE,
cResult);
}
else // le calcul n'a rien donne, on execute sans chercher.
{
g_print (" pas un calcul => on execute '%s'\n", myData.sCurrentText->str);
cairo_dock_launch_command (myData.sCurrentText->str);
}
g_free (cResult);
}
示例12: reload
static void reload (CairoConfigIndicators *pPrevIndicators, CairoConfigIndicators *pIndicators)
{
CairoDock *pDock = g_pMainDock;
double fMaxScale = cairo_dock_get_max_scale (pDock);
cairo_t* pCairoContext = cairo_dock_create_context_from_window (CAIRO_CONTAINER (pDock));
if (cairo_dock_strings_differ (pPrevIndicators->cIndicatorImagePath, pIndicators->cIndicatorImagePath) ||
pPrevIndicators->bLinkIndicatorWithIcon != pIndicators->bLinkIndicatorWithIcon ||
pPrevIndicators->fIndicatorRatio != pIndicators->fIndicatorRatio)
{
cairo_dock_load_task_indicator (myTaskBar.bShowAppli && myTaskBar.bMixLauncherAppli ? pIndicators->cIndicatorImagePath : NULL, pCairoContext, fMaxScale, pIndicators->fIndicatorRatio);
}
if (cairo_dock_strings_differ (pPrevIndicators->cActiveIndicatorImagePath, pIndicators->cActiveIndicatorImagePath) ||
pPrevIndicators->iActiveCornerRadius != pIndicators->iActiveCornerRadius ||
pPrevIndicators->iActiveLineWidth != pIndicators->iActiveLineWidth ||
cairo_dock_colors_differ (pPrevIndicators->fActiveColor, pIndicators->fActiveColor))
{
cairo_dock_load_active_window_indicator (pCairoContext,
pIndicators->cActiveIndicatorImagePath,
fMaxScale,
pIndicators->iActiveCornerRadius,
pIndicators->iActiveLineWidth,
pIndicators->fActiveColor);
}
if (cairo_dock_strings_differ (pPrevIndicators->cClassIndicatorImagePath, pIndicators->cClassIndicatorImagePath))
{
cairo_dock_load_class_indicator (myTaskBar.bShowAppli && myTaskBar.bGroupAppliByClass ? pIndicators->cClassIndicatorImagePath : NULL, pCairoContext, fMaxScale);
}
cairo_destroy (pCairoContext);
cairo_dock_redraw_root_docks (FALSE); // main dock inclus.
}
示例13: cairo_dock_set_class_use_xicon
gboolean cairo_dock_set_class_use_xicon (const gchar *cClass, gboolean bUseXIcon)
{
CairoDockClassAppli *pClassAppli = cairo_dock_get_class (cClass);
g_return_val_if_fail (pClassAppli!= NULL, FALSE);
if (pClassAppli->bUseXIcon == bUseXIcon) // rien a faire.
return FALSE;
GList *pElement;
Icon *pAppliIcon;
cairo_t *pCairoContext = cairo_dock_create_context_from_window (CAIRO_CONTAINER (g_pMainDock));
for (pElement = pClassAppli->pAppliOfClass; pElement != NULL; pElement = pElement->next)
{
pAppliIcon = pElement->data;
if (bUseXIcon)
{
cd_message ("%s prend l'icone de X", pAppliIcon->acName);
}
else
{
cd_message ("%s n'utilise plus l'icone de X", pAppliIcon->acName);
}
cairo_dock_fill_one_icon_buffer (pAppliIcon, pCairoContext, (1 + g_fAmplitude), g_pMainDock->bHorizontalDock, TRUE, g_pMainDock->bDirectionUp);
}
cairo_destroy (pCairoContext);
return TRUE;
}
示例14: cd_do_set_status
void cd_do_set_status (const gchar *cStatus)
{
g_free (myData.cStatus);
myData.cStatus = g_strdup (cStatus);
if (myData.pListing)
cairo_dock_redraw_container (CAIRO_CONTAINER (myData.pListing));
}
示例15: cd_do_select_nth_entry_in_listing
void cd_do_select_nth_entry_in_listing (int iNumEntry)
{
myData.pListing->fPreviousOffset = myData.pListing->fCurrentOffset;
int i = MIN (iNumEntry, myData.pListing->iNbEntries - 1);
myData.pListing->pCurrentEntry = g_list_nth (myData.pListing->pEntries, i);
myData.pListing->fAimedOffset = i * (myDialogs.dialogTextDescription.iSize + 2);
myData.pListing->iCurrentEntryAnimationCount = NB_STEPS_FOR_CURRENT_ENTRY;
myData.pListing->iScrollAnimationCount = NB_STEPS_FOR_SCROLL;
myData.pListing->iTitleOffset = 0;
myData.pListing->sens = 1;
cairo_dock_launch_animation (CAIRO_CONTAINER (myData.pListing));
cairo_dock_redraw_container (CAIRO_CONTAINER (myData.pListing));
}