コード例 #1
0
HippoCanvasStyle *
hippo_canvas_context_get_style (HippoCanvasContext *context)
{
    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), NULL);
    
    return HIPPO_CANVAS_CONTEXT_GET_IFACE(context)->get_style(context);
}
コード例 #2
0
HippoAnimationManager *
hippo_canvas_context_get_animation_manager (HippoCanvasContext *context)
{
    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), NULL);
    
    return HIPPO_CANVAS_CONTEXT_GET_IFACE(context)->get_animation_manager(context);
}
コード例 #3
0
PangoFontDescription *
hippo_canvas_context_get_font (HippoCanvasContext *context)
{
    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), NULL);
    
    return HIPPO_CANVAS_CONTEXT_GET_IFACE(context)->get_font(context);
}
コード例 #4
0
ファイル: HippoCanvas.cpp プロジェクト: nihed/magnetism
HippoCanvas::HippoCanvas()
    : canvasWidthReq_(0), canvasHeightReq_(0), canvasX_(0), canvasY_(0), hscrollNeeded_(false), vscrollNeeded_(false),
      hscrollbarPolicy_(HIPPO_SCROLLBAR_NEVER), vscrollbarPolicy_(HIPPO_SCROLLBAR_NEVER),
      containsMouse_(false), pointer_(HIPPO_CANVAS_POINTER_UNSET), lastMoveX_(-1), lastMoveY_(-1)
{
    HippoCanvasContextWin *context;

    setClassName(L"HippoCanvasClass");
    setClassStyle(CS_HREDRAW | CS_VREDRAW);
    setTitle(L"Canvas");

    context = hippo_canvas_context_win_new(this);
    context_ = context;
    g_object_unref((void*) context); // lose the extra reference
    g_assert(HIPPO_IS_CANVAS_CONTEXT(context_));

    hscroll_ = new HippoScrollbar();
    hscroll_->Release(); // lose extra ref
    hscroll_->setOrientation(HIPPO_ORIENTATION_HORIZONTAL);

    vscroll_ = new HippoScrollbar();
    vscroll_->Release();
    
    hscroll_->setParent(this);
    vscroll_->setParent(this);

    tooltip_ = new HippoToolTip();
    tooltip_->Release();
}
コード例 #5
0
PangoLayout*
hippo_canvas_context_create_layout(HippoCanvasContext *context)
{
    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), NULL);

    return HIPPO_CANVAS_CONTEXT_GET_IFACE(context)->create_layout(context);
}
コード例 #6
0
double
hippo_canvas_context_get_resolution (HippoCanvasContext *context)
{
    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), 96.);
    
    return HIPPO_CANVAS_CONTEXT_GET_IFACE(context)->get_resolution(context);
}
コード例 #7
0
cairo_surface_t*
hippo_canvas_context_load_image(HippoCanvasContext *context,
                                const char         *image_name)
{
    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), NULL);

    return HIPPO_CANVAS_CONTEXT_GET_IFACE(context)->load_image(context, image_name);
}
コード例 #8
0
guint32
hippo_canvas_context_get_color(HippoCanvasContext *context,
                               HippoStockColor     color)
{
    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), 0);

    return HIPPO_CANVAS_CONTEXT_GET_IFACE(context)->get_color(context, color);
}
コード例 #9
0
void
hippo_canvas_context_unregister_widget_item (HippoCanvasContext *context,
                                             HippoCanvasItem    *item)
{
    g_return_if_fail(HIPPO_IS_CANVAS_CONTEXT(context));
    g_return_if_fail(HIPPO_IS_CANVAS_ITEM(item));
    
    HIPPO_CANVAS_CONTEXT_GET_IFACE(context)->unregister_widget_item(context, item);
}
コード例 #10
0
cairo_surface_t*
hippo_canvas_context_create_surface(HippoCanvasContext *context,
                                    cairo_content_t     content,
                                    int                 width,
                                    int                 height)
{
    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), NULL);

    return HIPPO_CANVAS_CONTEXT_GET_IFACE(context)->create_surface(context, content, width, height);
}
コード例 #11
0
ファイル: HippoCanvas.cpp プロジェクト: nihed/magnetism
static void
hippo_canvas_context_win_unregister_widget_item (HippoCanvasContext *context,
                                                 HippoCanvasItem    *item)
{
    HippoCanvasContextWin *canvas_win = HIPPO_CANVAS_CONTEXT_WIN(context);

    g_return_if_fail(HIPPO_IS_CANVAS_CONTEXT(context));

    remove_control_item(canvas_win, item);
}
コード例 #12
0
void
hippo_canvas_context_translate_to_widget(HippoCanvasContext *context,
                                         HippoCanvasItem    *item,
                                         int                *x_p,
                                         int                *y_p)
{
    g_return_if_fail(HIPPO_IS_CANVAS_CONTEXT(context));
    g_return_if_fail(HIPPO_IS_CANVAS_ITEM(item));
    
    HIPPO_CANVAS_CONTEXT_GET_IFACE(context)->translate_to_widget(context, item, x_p, y_p);
}
コード例 #13
0
ファイル: HippoCanvas.cpp プロジェクト: nihed/magnetism
static cairo_surface_t*
hippo_canvas_context_win_load_image(HippoCanvasContext *context,
                                    const char         *image_name)
{
    /* HippoCanvasContextWin *canvas_win = HIPPO_CANVAS_CONTEXT_WIN(context); */

    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), NULL);

    cairo_surface_t *surface = hippo_image_factory_get(image_name);
    if (surface)
        cairo_surface_reference(surface);
    return surface;
}
コード例 #14
0
void
hippo_canvas_context_affect_font_desc(HippoCanvasContext     *context,
                                      PangoFontDescription   *font_desc)
{
    HippoCanvasContextIface *iface;
    
    g_return_if_fail(HIPPO_IS_CANVAS_CONTEXT(context));
    
    iface = HIPPO_CANVAS_CONTEXT_GET_IFACE(context);
    
    if (iface->affect_font_desc)
        (* iface->affect_font_desc) (context, font_desc);
}
コード例 #15
0
void
hippo_canvas_context_affect_color(HippoCanvasContext     *context,
                                  guint32                *color_rgba_p)
{
    HippoCanvasContextIface *iface;
    
    g_return_if_fail(HIPPO_IS_CANVAS_CONTEXT(context));

    iface = HIPPO_CANVAS_CONTEXT_GET_IFACE(context);

    if (iface->affect_color)
        (* iface->affect_color) (context, color_rgba_p);
}
コード例 #16
0
ファイル: HippoCanvas.cpp プロジェクト: nihed/magnetism
static HippoCanvasContextWin*
hippo_canvas_context_win_new(HippoCanvas *canvas)
{
    HippoCanvasContextWin *context_win;

    context_win = HIPPO_CANVAS_CONTEXT_WIN(g_object_new(HIPPO_TYPE_CANVAS_CONTEXT_WIN, NULL));
    g_assert(HIPPO_IS_CANVAS_CONTEXT(context_win));

    // don't ref it, since it owns us, it would create a cycle
    context_win->canvas = canvas;
    
    return context_win;
}
コード例 #17
0
ファイル: HippoCanvas.cpp プロジェクト: nihed/magnetism
static PangoLayout*
hippo_canvas_context_win_create_layout(HippoCanvasContext *context)
{
    HippoCanvasContextWin *canvas_win;
    PangoLayout *layout;

    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), NULL);

    canvas_win = HIPPO_CANVAS_CONTEXT_WIN(context);

    layout = pango_layout_new(canvas_win->pango);

    return layout;
}
コード例 #18
0
void
HippoCanvas::createChildren()
{
    hscroll_->create();
    vscroll_->create();

    tooltip_->setForWindow(window_);
    tooltip_->create();

    // this should register any embedded controls, set their parents,
    // which as a side effect should create them all
    if (root_ != (HippoCanvasItem*) NULL) {
        g_assert(HIPPO_IS_CANVAS_CONTEXT(context_));
        hippo_canvas_item_set_context(root_, HIPPO_CANVAS_CONTEXT(context_));
    }
}
コード例 #19
0
static guint32
hippo_canvas_context_win_get_color(HippoCanvasContext *context,
                                   HippoStockColor     color)
{
    HippoCanvasContextWin *canvas_win = HIPPO_CANVAS_CONTEXT_WIN(context);
    
    g_return_val_if_fail(HIPPO_IS_CANVAS_CONTEXT(context), 0);

    switch (color) {
    case HIPPO_STOCK_COLOR_BG_NORMAL:
        // FIXME use real system color - GetThemeColor?
        return 0x777777ff;
    case HIPPO_STOCK_COLOR_BG_PRELIGHT:
        // FIXME use real system color
        return 0x999999ff;
    }

    g_warning("unknown stock color %d", color);
    return 0;
}
コード例 #20
0
ファイル: HippoCanvas.cpp プロジェクト: nihed/magnetism
static void
hippo_canvas_context_win_translate_to_widget(HippoCanvasContext *context,
                                             HippoCanvasItem    *item,
                                             int                *x_p,
                                             int                *y_p)
{
    HippoCanvasContextWin *canvas_win;

    g_return_if_fail(HIPPO_IS_CANVAS_CONTEXT(context));

    canvas_win = HIPPO_CANVAS_CONTEXT_WIN(context);

    /* convert coords of root canvas item to coords of
     * the HWND
     */
    int cx, cy;
    canvas_win->canvas->getCanvasOrigin(&cx, &cy);

    if (x_p)
        *x_p += cx;
    if (y_p)
        *y_p += cy;
}
コード例 #21
0
void
HippoCanvas::setRoot(HippoCanvasItem *item)
{
    if (root_ == item)
        return;

    rootRequestChanged_.disconnect();
    rootPaintNeeded_.disconnect();

    root_ = item;
    if (item) {
        rootRequestChanged_.connect(G_OBJECT(item), "request-changed",
            slot(this, &HippoCanvas::onRootRequestChanged));
        rootPaintNeeded_.connect(G_OBJECT(item), "paint-needed",
            slot(this, &HippoCanvas::onRootPaintNeeded));
        rootTooltipChanged_.connect(G_OBJECT(item), "tooltip-changed",
            slot(this, &HippoCanvas::onRootTooltipChanged));
        if (isCreated()) {
            g_assert(HIPPO_IS_CANVAS_CONTEXT(context_));
            hippo_canvas_item_set_context(item, HIPPO_CANVAS_CONTEXT(context_));
        }
    }
    markRequestChanged();
}