Jump to content

[REL] Static Window v2


Recommended Posts

Hi all.

Static CeGUI window.

With this resource you can add to your server static window.

What this window can?

- Align of window name (left, right, center).

- Close button.

- Change colors of titlebar, window titlename and frame of window (with alpha).

- Attach any gui elements to frame of window or on titlebar

- New design of static window. See screenes for more.

Updates:

- Added color schemes. With resource available 3 schemes. "default", "default-red" and "staticwin"

- Added quad angles.

Functions and Events information:

Functions:

guiCreateStaticWindow(int WinID, int PosX, int PosY, int Width, int Height, string TitleText [, string TextAlign, bool CloseButton, bool Movable, bool Sizable, bool QuadAngles]) 

Argumets:

  • WinID - Static Window Identification
  • PosX, PosY - Screen Position of window
  • Width, Height - Window Size
  • TitleText - Title text
    Optional:
  • TextAlign - Align of title text [Default: "left"]
  • CloseButton - Enable/Disable close button [Default: false]
  • Movable - Enable/Disable moving window [Default: true]
  • Sizable - Enable/Disable resize window [Default: false]
  • QuadAngles - Enable/Disable quad angles [Default: false]

Create static window

Returns: Central frame {gui-staticimage}

guiStaticWindowCreateColorScheme(string SchemeName [, int TitleRed, int TitleGreen, int TitleBlue, int TitleAlpha, int FrameRed, int FrameGreen, int FrameBlue, int FrameAlpha, int TextRed, int TextGreen, int TextBlue, string/font TextFont, string TextAlign, bool CloseButton, bool QuadAngles]) 

Arguments:

  • SchemeName - Color Scheme Identification
    Optional:
  • TitleRed, TitleGreen, TitleBlue, TitleAlpha - Title Bar color [Default: 255, 255, 255, 255]
  • FrameRed, FrameGreen, FrameBlue, FrameAlpha - Frame color [Default: 255, 255, 255, 204]
  • TextRed, TextGreen, TextBlue - Title Bar Text color [Default: 0, 0, 0]
  • TextFont - Title Bar Text font (Standart GUI Font) [Default: "default-normal"]
  • TextAlign - Title Bar Text align [Default: "center"]
  • CloseButton - Enable/Disable close button [Default: false]
  • QuadAngles - Enable/Disable quad angles [Default: false]

Create custom color scheme for Static Windows

guiStaticWindowSetColorScheme(int WinID, string SchemeName) 

Apply color scheme for Static Window

guiStaticWindowSetQuadAngles(int WinID, string Type, bool Quad) 

Types:

  • left-top - Top Left window corner
  • left-bottom - Bottom Left window corner
  • right-top - Top Right window corner
  • right-bottom - Bottom Right window corner
  • left - Left Top and Bottom window corners
  • right - Right Top and Bottom window corners
  • top - Left and Right Top window corners
  • bottom - Left and Right Bottom window corners
  • all - All window corners
    Arguments:
  • Type - Corners (see `Types)
  • Quad - Quad corners
    Set Static Window Quad Corners
    guiStaticWindowSetPosition(int WinID, int PosX, int PosY) 
    


    Set new position to Static Window

    guiStaticWindowSetSize(int WinID, int Width, int Height) 
    


    Set new size to Static Window

    guiStaticWindowSetVisible(int WinID, bool Visibility) 
    


    Set Static Window visibility

    guiStaticWindowSetAlpha(int WinID, int Alpha) 
    


    Set Static Window alpha level

    guiStaticWindowSetText(int WinID, string Text) 
    


    Set Static Window Title Bar text

    guiStaticWindowSetTextColor(int WinID, int Red, int Green, int Blue) 
    


    Set Static Window Title Bar text color (rgb 0-255)

    guiStaticWindowSetColor(int WinID, int Red, int Green, int Blue [, int Alpha]) 
    


    Set Static Window all-frame color (rgba 0-255)

    guiStaticWindowSetTitleColor(int WinID, int Red, int Green, int Blue [, int Alpha]) 
    


    Set Static Window Title Bar color (rgba 0-255)

    guiStaticWindowSetTitleFont(int WinID, string/gui-font Font) 
    


    Set Static Window Title Bar text font

    guiStaticWindowSetMovable(int WinID, bool Movable) 
    


    Set Static Window Movable

    guiStaticWindowSetSizable(int WinID, bool Sizable) 
    


    Set Static Window Sizable

    guiStaticWindowSetTextAlign(int WinID, string Align) 
    


    Set Static Window Title Bar text align

    guiStaticWindowCloseButtonSetVisible(int WinID, bool Visibility) 
    


    Set Static Window Close Button visible

    guiStaticWindowCloseButtonSetEnabled(int WinID, bool Enable) 
    


    Set Static Window Close Button enabled

    guiStaticWindowSetCloseButtonColor(int WinID, int Red, int Green, int Blue [, int Alpha]) 
    


    Set Static Window Close Button color

    guiStaticWindowResetCloseButtonColor(int WinID) 
    


    Reset Static Window Close Button color (Sets to red color)

    guiStaticWindowSetMinSize(int WinID, int MinWidth, int MinHeight) 
    


    Set Static Window Minimal Size

    guiStaticWindowSetMaxSize(int WinID, int MaxWidth, int MaxHeight) 
    


    Set Static Window Maximal Size

    guiStaticWindowGetPosition(int WinID, bool Relative) 
    


    Get Static Window position
    Returns: 2 Integers - Position X and Position Y {int, int}

    guiStaticWindowGetSize(int WinID, bool Relative) 
    


    Get Static Window full size
    Returns: 2 Integers - Width and Height {int, int}

    guiStaticWindowGetFrameSize(int WinID, bool Relative) 
    


    Get Static Window frame size
    Returns: 2 Integers - Width and Height {int, int}

    guiStaticWindowGetVisible(int WinID) 
    


    Get Static Window Visibility
    Returns: Static Window Visibility {bool}

    guiStaticWindowGetTitleBar(int WinID) 
    


    Get Static Window titlebar
    Returns: Static Window Title Bar text element {gui-label}

    guiStaticWindowGetWindow(int WinID) 
    


    Get Static Window frame
    Returns: Static Window central frame {gui-staticimage}

    guiStaticWindowGetMovable(int WinID) 
    


    Get Static Window Movable
    Returns: Static Window Movable {bool}

    guiStaticWindowGetSizable(int WinID) 
    


    Get Static Window Sizable
    Returns: Static Window Sizable {bool}

    guiStaticWindowGetTitleColor(int WinID [, bool EnableHEXString]) 
    


    Get Static Window Title Bar color
    Returns: 4 ints or 1 string "AARRGGBB" (if EnableHEXString is true) {int, int, int, int}{string}

    guiStaticWindowGetColor(int WinID [, bool EnableHEXString]) 
    


    Get Static Window Frame color
    Returns: 4 ints RGBA or 1 string "AARRGGBB" (if EnableHEXString is true) {int, int, int, int}{string}

    guiStaticWindowGetText(int WinID) 
    


    Get Static Window Title Bar text
    Returns: Title Bar Text {string}

    guiStaticWindowGetTextColor(int WinID [, bool EnableHEXString]) 
    


    Get Static Window Title Bar text color
    Returns: 3 ints RGB or 1 string "RRGGBB" (if EnableHEXString is true) {int, int, int}{string}

    guiStaticWindowCloseButtonGetVisible(int WinID) 
    


    Get Static Window Close Button visible
    Returns: Visibility {bool}

    guiStaticWindowCloseButtonGetEnabled(int WinID) 
    


    Get Static Window Close Button enabled
    Returns: Enabling {bool}

    guiStaticWindowGetCloseButtonColor(int WinID [, bool EnableHEXString]) 
    


    Get Static Window Close Button color
    Returns: 4 ints RGBA or 1 string "AARRGGBB" (if EnableHEXString is true) {int, int, int, int}{string}

    guiStaticWindowGetMinSize(int WinID) 
    


    Get Static Window Minimal Size
    Returns: 2 ints of size {int, int}

    guiStaticWindowGetMaxSize(int WinID) 
    


    Get Static Window Maximal Size
    Returns: 2 ints of size {int, int}

    guiStaticWindowDestroy(int WinID) 
    


    Destroy Static Window
    Events:

  • onClientStaticWindowClose
    This triggers when Local Player click close button on static window
    Parameters:
int WinID 


Source: Local Player

  • onClientStaticWindowMove
    This triggers when Local Player move static window
    Parameters:
int WinID, int PositionX, int PositionY 

PositionX, PositionY - Static Window frame position on screen
Source: Local Player

  • onClientStaticWindowResize
    This triggers when Local Player resize static window
    Parameters:
int WinID, int Width, int Height 

Width, Height - Static Window frame size
Source: Local Player

Notes:

  • Do not use guiSetPosition on static window (titlebar and resizer not moving)
  • Do not use guiSetSize on static window (titlebar and resizer not sizing)
  • You can create any GUI element on titlebar of static window when you use in parent of element function guiStaticWindowGetTitleBar(int WinID)

Download:

GitHub

Community:

Old version (idk how update)

Screenshots:

JA6deJE.png

0Er9tMi.jpg

PTrr6Sf.png

KUwM1CP.jpg

Of latest version

xo5c0iS.png

jiVwFel.png

VVrR3B5.png

Example:

addEventHandler("onClientResourceStart", root, 
    function() 
        local font = guiCreateFont("bankgothic.ttf", 9) 
        guiStaticWindowCreates(192, 100, 200, 300, 170, "Hello", "center", false, false, true) 
        local test = guiStaticWindowCreates(193, 500, 100, 300, 290, "Hello", "left", true) 
        guiStaticWindowCreates(194, 900, 100, 300, 290, "Hello", "right", true, true, true) 
        guiStaticWindowSetAlpha(192, 0.7) 
        guiStaticWindowSetText(193, "Bye") 
        guiStaticWindowSetTextColor(193, 255, 0, 0) 
        guiStaticWindowSetColor(193, 100, 0, 0, 150) 
        guiStaticWindowSetTitleColor(193, 255, 255, 200, 180) 
        guiStaticWindowSetTitleColor(194, 0, 200, 0) 
        guiStaticWindowSetTitleFont(194, font) 
        guiStaticWindowSetMovable(193, true) 
        guiStaticWindowSetSizable(193, false) 
        local r, g, b, a = guiStaticWindowGetTitleColor(193) 
        local ghex = guiStaticWindowGetTitleColor(193, true) 
        outputDebugString(tostring(r).." "..tostring(g).." "..tostring(b).." "..tostring(a).." "..tostring(ghex)) 
        outputDebugString(tostring(guiStaticWindowGetMovable(193)).." "..tostring(guiStaticWindowGetSizable(193))) 
        local at, aat, laat, gunship = guiStaticWindowGetColor(193) 
        local lhex = guiStaticWindowGetColor(193, true) 
        outputDebugString(tostring(at).." "..tostring(aat).." "..tostring(laat).." "..tostring(gunship).." "..tostring(lhex)) 
        outputDebugString(tostring(guiStaticWindowGetText(193))) 
        local pi, mat, lopat = guiStaticWindowGetTextColor(193) 
        local mathpi = guiStaticWindowGetTextColor(193, true) 
        outputDebugString(tostring(pi).." "..tostring(mat).." "..tostring(lopat).." "..tostring(mathpi)) 
        guiStaticWindowSetTextAlign(193, "center") 
        guiStaticWindowCloseButtonSetVisible(193, true) 
        guiStaticWindowCloseButtonSetVisible(192, true) 
        guiStaticWindowCloseButtonSetEnabled(192, true) 
        outputDebugString(tostring(guiStaticWindowCloseButtonGetVisible(193)).." "..tostring(guiStaticWindowCloseButtonGetEnabled(192))) 
        guiStaticWindowSetVisible(192, false) 
        outputDebugString(tostring(guiStaticWindowGetVisible(192))) 
        guiStaticWindowSetMinSize(193, 100, 100) 
        guiStaticWindowSetMaxSize(193, 500, 500) 
        guiStaticWindowSetCloseButtonColor(194, 0, 255, 0, 255) 
        local af, taf, tap, lap = guiStaticWindowGetCloseButtonColor(193) 
        local ffaf = guiStaticWindowGetCloseButtonColor(193, true) 
        outputDebugString(tostring(af).." "..tostring(taf).." "..tostring(tap).." "..tostring(lap).." "..tostring(ffaf)) 
        local anothe = guiCreateStaticImage(0, 2, 16, 16, "els/but.png", false, guiStaticWindowGetTitleBar(192)) 
        guiSetProperty(anothe, "ImageColours", "tl:FFFFCC00 tr:FFFFCC00 bl:FFFFCC00 br:FFFFCC00") 
        local another = guiCreateStaticImage(20, 2, 16, 16, "els/but.png", false, guiStaticWindowGetTitleBar(192)) 
        guiSetProperty(another, "ImageColours", "tl:FF00FF00 tr:FF00FF00 bl:FF00FF00 br:FF00FF00") 
        if test == guiStaticWindowGetWindow(193) then outputDebugString("193 window return 193") end 
        guiCreateButton(0, 10, 100, 50, "Test", false, test) 
        guiCreateButton(0, 100, 100, 50, "Test 2", false, guiStaticWindowGetWindow(193)) 
        guiCreateMemo(110, 10, 120, 140, "Test", false, test) 
    end) 

Thanks all, and sorry for my bad english :)

Edited by Guest
Link to comment
  • 3 weeks later...

Great Job :wink:

Mhh . . . i dont know if is helpful the guiCreateStaticWindow because i can simply replace the window with image.

Maybe the custom gridList is a good idea.

Example :

Hex color from user name

Color gridlist

and other.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...