Results 1 to 4 of 4

Thread: Custom for Panel

  1. #1
    Registered User
    Join Date
    Apr 2015
    Location
    France
    Posts
    93

    Custom for Panel

    Is it possible to make a custom for icon and image in Panel or Xpanel?

  2. #2
    creacon
    Join Date
    Nov 2005
    Location
    Belgium
    Posts
    1,299
    Do you mean if you can integrate an image in the panel or in the title bar?
    If you want to put an image in a panel you need to look at the "canvasl" control.

    creacon

  3. #3
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    7,891
    If you want to custom draw directly to panel you can use:

    PAN_USERDRAW
    Your panel draw callback.

    Code:
       typedef struct st_LWPanelFuncs {
          [...]
          DrawFuncs   *drawFuncs;
          [...]
       } LWPanelFuncs;
    Code:
       typedef struct st_DrawFuncs {
          void (*drawPixel)   (LWPanelID, int color, int x, int y);
          void (*drawRGBPixel)(LWPanelID, int r, int g, int b, int x, int y);
          void (*drawLine)    (LWPanelID, int color, int x1, int y1, int x2,
                                 int y2);
          void (*drawBox)     (LWPanelID, int color, int x, int y, int w,
                                 int h);
          void (*drawRGBBox)  (LWPanelID, int r, int g, int b, int x, int y,
                                 int w, int h);
          void (*drawBorder)  (LWPanelID, int indent, int x, int y, int w,
                                 int h);
          int  (*textWidth)   (LWPanelID, char *text);
          void (*drawText)    (LWPanelID, char *text, int color, int x,
                                 int y);
          const LWDisplayMetrics *(*dispMetrics)();
       } DrawFuncs;
    c = CANVAS_CTL( pf, pan, label, w, h )
    A bordered rectangle for convenient drawing. The width and height don't include the border, so the rectangle (0, 0, w-1, h-1) (relative to the control's HOTX and HOTY) lies inside the border.

    Read docs
    LWSDK/html/globals/panel.html
    search for keyword: draw

    also you can make OpenGL control with:

    c = OPENGL_CTL( pf, pan, label, width, height )
    This creates and initializes an OpenGL window. LWPanels takes care of the platform specific setup for the window. You can draw in this window using standard OpenGL function calls during your event and draw callbacks for the control.

  4. #4
    Registered User
    Join Date
    Apr 2015
    Location
    France
    Posts
    93
    Thanks all for your help.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •