webc v0.0.11
Write and deploy websites using the C Programming Language.
Loading...
Searching...
No Matches
webc-ui.h File Reference
#include "webc-core.h"
Include dependency graph for webc-ui.h:

Go to the source code of this file.

Data Structures

struct  Accordion
 
struct  CarouselItem
 
struct  ChatBubble
 
struct  Button
 
struct  NavLink
 
struct  CodeLine
 
struct  Footer
 

Macros

#define DAISY_COLOR_PRIMARY   "primary"
 
#define DAISY_COLOR_PRIMARY_CONTENT   "primary-content"
 
#define DAISY_COLOR_SECONDARY   "secondary"
 
#define DAISY_COLOR_SECONDARY_CONTENT   "secondary-content"
 
#define DAISY_COLOR_ACCENT   "accent"
 
#define DAISY_COLOR_ACCENT_CONTENT   "accent-content"
 
#define DAISY_COLOR_NEUTRAL   "neutral"
 
#define DAISY_COLOR_NEUTRAL_CONTENT   "neutral-content"
 
#define DAISY_COLOR_BASE_100   "base-100"
 
#define DAISY_COLOR_BASE_200   "base-200"
 
#define DAISY_COLOR_BASE_300   "base-300"
 
#define DAISY_COLOR_INFO   "info"
 
#define DAISY_COLOR_INFO_CONTENT   "info-content"
 
#define DAISY_COLOR_SUCCESS   "success"
 
#define DAISY_COLOR_SUCCESS_CONTENT   "success-content"
 
#define DAISY_COLOR_WARNING   "warning"
 
#define DAISY_COLOR_WARNING_CONTENT   "warning-content"
 
#define DAISY_COLOR_ERROR   "error"
 
#define DAISY_COLOR_ERROR_CONTENT   "error-content"
 
#define DAISY_SIZE_XS   "xs"
 
#define DAISY_SIZE_SM   "sm"
 
#define DAISY_SIZE_MD   "md"
 
#define DAISY_SIZE_LG   "lg"
 
#define SECURE_STR(s)   ((s == NULL) ? "NULL" : s)
 
#define DAISYUI_LINK
 
#define TAILWINDCSS_SCRIPT(buffer)    WEBC_PlainText(buffer, "<script src=\"https://cdn.tailwindcss.com\"></script>");
 

Enumerations

enum  AvatarType {
  AVATAR_DEFAULT , AVATAR_CIRCLE , AVATAR_RING , AVATAR_PRESENCE_ONLINE ,
  AVATAR_PRESENCE_OFFLINE
}
 
enum  BadgeType { BADGE_DEFAULT , BADGE_OUTLINE }
 
enum  CarouselType {
  CAROUSEL_DEFAULT , CAROUSEL_CENTER , CAROUSEL_END , CAROUSEL_FULL_WIDTH ,
  CAROUSEL_HALF_WIDTH , CAROUSEL_FULL_BLEED , CAROUSEL_INDICATOR_BUTTONS , CAROUSEL_NEXT_PREV ,
  CAROUSEL_VERTICAL
}
 
enum  ChatBubbleType { CHAT_BUBBLE_DEFAULT , CHAT_BUBBLE_IMAGE , CHAT_BUBBLE_FULL , CHAT_BUBBLE_HEADER_FOOTER }
 
enum  AlertType {
  ALERT_DEFAULT = 0 , ALERT_INFO = 1 , ALERT_SUCCESS = 2 , ALERT_WARNING = 3 ,
  ALERT_ERROR = 4
}
 
enum  ButtonType {
  BUTTON_DEFAULT , BUTTON_OUTLINE , BUTTON_RESPONSIVE , BUTTON_WIDE ,
  BUTTON_GLASS , BUTTON_SQUARE , BUTTON_CIRCLE , BUTTON_ICON ,
  BUTTON_LOADING , BUTTON_LOADING_TEXT
}
 
enum  LoadingType {
  LOADING_SPINNER , LOADING_DOTS , LOADING_RING , LOADING_BALL ,
  LOADING_BAR , LOADING_INFINITY
}
 

Functions

int is_valid_daisy_size (Cstr size)
 
int is_valid_daisy_color (Cstr color)
 
void append_class_attr (char **class, Cstr attr)
 
WEBCAPI void WEBC_DaisyAccordion (char **buffer, Accordion accordion, int open)
 
WEBCAPI void WEBC_DaisyAvatar (char **buffer, AvatarType type, Cstr img_src, Cstr placeholder, size_t width)
 
WEBCAPI void WEBC_DaisyBadge (char **buffer, BadgeType type, Cstr color, Cstr text)
 
WEBCAPI void WEBC_DaisyCarousel (char **buffer, CarouselType type, size_t width, CarouselItem items[], size_t item_count)
 
WEBCAPI void WEBC_DaisyChatBubble (char **buffer, ChatBubbleType type, ChatBubble bubble, int left)
 
WEBCAPI void WEBC_DaisyCollapse (char **buffer, Cstr title, Cstr contents)
 
WEBCAPI void WEBC_DaisyAlert (char **buffer, AlertType type, Cstr text)
 
WEBCAPI void WEBC_DaisyButton (char **buffer, ButtonType type, Button button)
 
WEBCAPI void WEBC_DaisyCheckbox (char **buffer, Cstr label, Cstr color)
 
WEBCAPI void WEBC_DaisyNavbarSidebar (char **buffer, Cstr title, NavLink navbar_items[], size_t navbar_items_count, NavLink sidebar_items[], size_t sidebar_items_count, BlockContents page_content)
 
WEBCAPI void WEBC_DaisyDropdown (char **buffer, Cstr title, NavLink items[], size_t count)
 
WEBCAPI void WEBC_DaisyLoading (char **buffer, LoadingType type, Cstr size)
 
WEBCAPI void WEBC_DaisyFileInput (char **buffer, Cstr color)
 
WEBCAPI void WEBC_DaisyIndicator (char **buffer, Cstr text, BlockContents toplaceon)
 
WEBCAPI void WEBC_DaisyTextInput (char **buffer, int password, Cstr placeholder, Cstr icon)
 
WEBCAPI void WEBC_DaisyCode (char **buffer, Cstr color, CodeLine code[], size_t count)
 
WEBCAPI void WEBC_DaisyModal (char **buffer, Cstr id, Cstr title, Cstr content)
 
WEBCAPI void WEBC_DaisyPagination (char **buffer, size_t from, size_t to, size_t checked)
 
WEBCAPI void WEBC_DaisyProgress (char **buffer, size_t width, Cstr color, size_t value, size_t max)
 
WEBCAPI void WEBC_DaisyRadio (char **buffer, Cstr group_name, Cstr color, int checked)
 
WEBCAPI void WEBC_DaisyRange (char **buffer, size_t min, size_t max, size_t value, size_t step, Cstr size, Cstr color)
 
WEBCAPI void WEBC_DaisySelect (char **buffer, Cstr title, char *options[], size_t count, Cstr color)
 
WEBCAPI void WEBC_DaisyTextarea (char **buffer, Cstr placeholder, Cstr color, Cstr size)
 
WEBCAPI void WEBC_DaisyThemeController (char **buffer)
 
WEBCAPI void WEBC_DaisyToast (char **buffer, Cstr text, Cstr color)
 
WEBCAPI void WEBC_DaisyToggle (char **buffer, int checked, Cstr color, Cstr size)
 
WEBCAPI void WEBC_DaisyTooltip (char **buffer, Cstr tooltip, Cstr location, int open, Cstr color, BlockContents toplaceon)
 
WEBCAPI void WEBC_DaisyFooter (char **buffer, Footer footer)
 

Detailed Description

MIT License

Copyright (c) 2024 Konstantinos Despoinidis (and other contributors)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author
KDesp73 (Konstantinos Despoinidis)
Version
0.0.3

Macro Definition Documentation

◆ DAISYUI_LINK

#define DAISYUI_LINK
Value:
WEBC_MakeTag(LINK, \
WEBC_MakeAttribute(ATTR_HREF, "https://cdn.jsdelivr.net/npm/daisyui@4.12.10/dist/full.min.css"), \
WEBC_MakeAttribute(ATTR_REL, "stylesheet"), \
WEBC_MakeAttribute(ATTR_TYPE, "text/css"), \
NULL \
) \
)
WEBCAPI Tag * WEBC_MakeTag(Cstr name, AttributeList attributes)
WEBCAPI Attribute * WEBC_MakeAttribute(AttributeName name, Cstr value)
WEBCAPI AttributeList WEBC_MakeAttributeList(Attribute *first,...)

Function Documentation

◆ WEBC_DaisyAccordion()

WEBCAPI void WEBC_DaisyAccordion ( char ** buffer,
Accordion accordion,
int open )

◆ WEBC_DaisyAlert()

WEBCAPI void WEBC_DaisyAlert ( char ** buffer,
AlertType type,
Cstr text )

◆ WEBC_DaisyAvatar()

WEBCAPI void WEBC_DaisyAvatar ( char ** buffer,
AvatarType type,
Cstr img_src,
Cstr placeholder,
size_t width )

◆ WEBC_DaisyBadge()

WEBCAPI void WEBC_DaisyBadge ( char ** buffer,
BadgeType type,
Cstr color,
Cstr text )

◆ WEBC_DaisyButton()

WEBCAPI void WEBC_DaisyButton ( char ** buffer,
ButtonType type,
Button button )

◆ WEBC_DaisyCarousel()

WEBCAPI void WEBC_DaisyCarousel ( char ** buffer,
CarouselType type,
size_t width,
CarouselItem items[],
size_t item_count )

https://daisyui.com/components/carousel/

Set width to 0 for full width

◆ WEBC_DaisyChatBubble()

WEBCAPI void WEBC_DaisyChatBubble ( char ** buffer,
ChatBubbleType type,
ChatBubble bubble,
int left )

◆ WEBC_DaisyCheckbox()

WEBCAPI void WEBC_DaisyCheckbox ( char ** buffer,
Cstr label,
Cstr color )

https://daisyui.com/components/checkbox/

Set color to NULL to use default color

◆ WEBC_DaisyCode()

WEBCAPI void WEBC_DaisyCode ( char ** buffer,
Cstr color,
CodeLine code[],
size_t count )

◆ WEBC_DaisyCollapse()

WEBCAPI void WEBC_DaisyCollapse ( char ** buffer,
Cstr title,
Cstr contents )

◆ WEBC_DaisyDropdown()

WEBCAPI void WEBC_DaisyDropdown ( char ** buffer,
Cstr title,
NavLink items[],
size_t count )

◆ WEBC_DaisyFileInput()

WEBCAPI void WEBC_DaisyFileInput ( char ** buffer,
Cstr color )

◆ WEBC_DaisyIndicator()

WEBCAPI void WEBC_DaisyIndicator ( char ** buffer,
Cstr text,
BlockContents toplaceon )

◆ WEBC_DaisyLoading()

WEBCAPI void WEBC_DaisyLoading ( char ** buffer,
LoadingType type,
Cstr size )

https://daisyui.com/components/loading/

Parameters
size[xs | sm | md | lg]

◆ WEBC_DaisyModal()

WEBCAPI void WEBC_DaisyModal ( char ** buffer,
Cstr id,
Cstr title,
Cstr content )

https://daisyui.com/components/modal/

call <id>.showModal() to open the dialog call <id>.close() to close it In case if NULL id, id is set to "my_modal"

◆ WEBC_DaisyNavbarSidebar()

WEBCAPI void WEBC_DaisyNavbarSidebar ( char ** buffer,
Cstr title,
NavLink navbar_items[],
size_t navbar_items_count,
NavLink sidebar_items[],
size_t sidebar_items_count,
BlockContents page_content )

https://daisyui.com/components/drawer/

Set sidebar_items to NULL or sidebar_items_counte to 0, to use navbar_content in both cases

◆ WEBC_DaisyPagination()

WEBCAPI void WEBC_DaisyPagination ( char ** buffer,
size_t from,
size_t to,
size_t checked )

https://daisyui.com/components/pagination/

Parameters
fromLower limit
toUpper limit (non inclusive)
checkedInitial active index (from <= checked < to)

◆ WEBC_DaisyProgress()

WEBCAPI void WEBC_DaisyProgress ( char ** buffer,
size_t width,
Cstr color,
size_t value,
size_t max )

https://daisyui.com/components/progress/

Set max to 0 to enable indeterminate progress

◆ WEBC_DaisyRadio()

WEBCAPI void WEBC_DaisyRadio ( char ** buffer,
Cstr group_name,
Cstr color,
int checked )

◆ WEBC_DaisyRange()

WEBCAPI void WEBC_DaisyRange ( char ** buffer,
size_t min,
size_t max,
size_t value,
size_t step,
Cstr size,
Cstr color )

https://daisyui.com/components/range/

Set step to 0 for smooth range

Parameters
size[xs | sm | md | lg]

◆ WEBC_DaisySelect()

WEBCAPI void WEBC_DaisySelect ( char ** buffer,
Cstr title,
char * options[],
size_t count,
Cstr color )

◆ WEBC_DaisyTextarea()

WEBCAPI void WEBC_DaisyTextarea ( char ** buffer,
Cstr placeholder,
Cstr color,
Cstr size )

https://daisyui.com/components/textarea/

Parameters
size[xs | sm | md | lg]

◆ WEBC_DaisyTextInput()

WEBCAPI void WEBC_DaisyTextInput ( char ** buffer,
int password,
Cstr placeholder,
Cstr icon )

https://daisyui.com/components/input/

Parameters
iconThe svg html (viewBox should be "0 0 16 16")

◆ WEBC_DaisyThemeController()

WEBCAPI void WEBC_DaisyThemeController ( char ** buffer)

◆ WEBC_DaisyToast()

WEBCAPI void WEBC_DaisyToast ( char ** buffer,
Cstr text,
Cstr color )

◆ WEBC_DaisyToggle()

WEBCAPI void WEBC_DaisyToggle ( char ** buffer,
int checked,
Cstr color,
Cstr size )

◆ WEBC_DaisyTooltip()

WEBCAPI void WEBC_DaisyTooltip ( char ** buffer,
Cstr tooltip,
Cstr location,
int open,
Cstr color,
BlockContents toplaceon )