static void 
hildon_color_chooser_size_allocate              (GtkWidget *widget, 
                                                 GtkAllocation *alloc)
{
    HildonColorChooserPrivate *priv = HILDON_COLOR_CHOOSER_GET_PRIVATE (widget);
    GtkBorder outer, inner;

    g_assert (priv);

    widget->allocation = *alloc;
    
    init_borders(widget, &inner, &outer);

    priv->hba.height = alloc->height - outer.top - outer.bottom;
    priv->hba.y = alloc->y + outer.top;
    priv->hba.width = inner.top;
    priv->hba.x = alloc->x + alloc->width - outer.right - inner.top;

    priv->spa.x = alloc->x + outer.left;
    priv->spa.y = alloc->y + outer.top;
    priv->spa.height = alloc->height - outer.top - outer.bottom;
    priv->spa.width = alloc->width - outer.left - outer.right - inner.top - inner.bottom;

    if (GTK_WIDGET_REALIZED (widget)) {
        gdk_window_move_resize (priv->event_window, 
                widget->allocation.x, 
                widget->allocation.y, 
                widget->allocation.width, 
                widget->allocation.height);
    }
}
static void
hildon_color_chooser_size_request               (GtkWidget *widget, 
                                                 GtkRequisition *req)
{
    GtkBorder inner, outer;

    init_borders (widget, &inner, &outer);

    req->width = inner.left + inner.top + inner.bottom + outer.left + outer.right;
    req->height = inner.right + outer.top + outer.bottom;
}
Esempio n. 3
0
Tile::Tile(int id, int ecount, vector<vec3> verts, vector<int> nbors) : Plane(id, verts[0], verts)
{
	edge_count = ecount;
	vertices = verts;
	neighbors = nbors;

	init_borders();

	material = new Material(vec3(0.5f, 0.4f, 0.3f), vec3(0.4f, 0.8f, 0.2f), vec3(0.8f), 100.0f);

	friction = 0.05f;

	init_gl();
}
int BC_DisplayInfo::get_bottom_border()
{
	init_borders();
	return bottom_border;
}
int BC_DisplayInfo::get_right_border()
{
	init_borders();
	return right_border;
}
int BC_DisplayInfo::get_left_border()
{
	init_borders();
	return left_border;
}
int BC_DisplayInfo::get_top_border()
{
	init_borders();
	return top_border;
}
Esempio n. 8
0
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
    RECT rc;
    HDC dc;
    PAINTSTRUCT ps;
    int n;

    switch (msg) {
    case WM_CREATE:
        GetClientRect(hwnd, &rc);
        init_borders(rc.right, rc.bottom);
        return 0;
    case WM_PAINT:
        dc = BeginPaint(hwnd, &ps);
        redraw(hwnd, dc);
        EndPaint(hwnd, &ps);
        return 0;
    case WM_SIZE:
        GetClientRect(hwnd, &rc);
        SX = rc.right;
        SY = rc.bottom;
        invalidate(hwnd);
        return 0;
    case WM_CLOSE:
        PostQuitMessage(0);
        return 0;
    case WM_KEYDOWN:
        switch (wparam) {
        case VK_RIGHT:
            shift(SX / 10.0, 0);
            invalidate(hwnd);
            break;
        case VK_LEFT:
            shift(- (SX / 10.0), 0);
            invalidate(hwnd);
            break;
        case VK_DOWN:
            shift(0, SY / 10.0);
            invalidate(hwnd);
            break;
        case VK_UP:
            shift(0, - (SY / 10.0));
            invalidate(hwnd);
            break;
        }
        return 0;
    case WM_CHAR:
        switch (wparam) {
        case '+':
            bigger();
            invalidate(hwnd);
            break;
        case '-':
            smaller();
            invalidate(hwnd);
            break;
        case ' ':
            func_index++;
            if (func_index == func_count) func_index = 0;
            calculate_func = funcs[func_index];
            invalidate(hwnd);
            break;
        case '\r':
            full_mode = !full_mode;
            init_functions ();
            invalidate (hwnd);
            break;
        }
        return 0;
    case WM_MOUSEWHEEL:
        n = (int16_t)(wparam >> 16) / 120;
        while (n > 0) {
            bigger();
            --n;
        }
        while (n < 0) {
            smaller();
            ++n;
        }
        invalidate(hwnd);
        return 0;
    case WM_LBUTTONDOWN:
        mousedown = TRUE;
        GetCursorPos(&cursor_pos);
        SetCapture(hwnd);
        SetCursor(LoadCursor(NULL, IDC_HAND));
        return 0;
    case WM_LBUTTONUP:
        mousedown = FALSE;
        ReleaseCapture();
        SetCursor(LoadCursor(NULL, IDC_ARROW));
        return 0;
    case WM_MOUSEMOVE:
        if (mousedown) {
            POINT p;
            GetCursorPos(&p);
            shift(cursor_pos.x - p.x, cursor_pos.y - p.y);
            cursor_pos = p;
            invalidate(hwnd);
        }
        break;
    }

    return DefWindowProc(hwnd, msg, wparam, lparam);
}