XIrc/src/main.c

105 lines
2.8 KiB
C

#include "headers.h"
int main(int argc, char **argv)
{
Widget shell, toplevel, tab_frame;
Widget toolbar, tabs;
Widget tb_file, tb_view, tb_oper, tb_help;
Widget menu_file, menu_view, menu_oper, menu_help;
Widget tab_gbox, tab_vpane, tab_textout, tab_userlist, tab_textin;
shell = XtInitialize("XIrc", "xirc", NULL, 0, &argc, argv);
toplevel = XtVaCreateManagedWidget("Top Level", gridboxWidgetClass, shell,
NULL);
toolbar = XawVaCreateSimpleMenuBar(toplevel, "Tool Bar", 4,
"File", "File Menu", &tb_file,
"View", "View Menu", &tb_view,
"Edit", "Edit Menu", &tb_oper,
"Help", "Help Menu", &tb_help);
menu_file = XawVaMakeSimpleMenu(tb_file, "File Menu", 2,
"Connect...", cb_errlog, "Connecting to: irc.libera.chat",
"Quit", cb_quit, EXIT_SUCCESS);
menu_view = XawVaMakeSimpleMenu(tb_view, "View Menu", 1,
"Show Log", cb_errlog, "Showing log!");
menu_oper = XawVaMakeSimpleMenu(tb_oper, "Edit Menu", 4,
"Join Channel", cb_errlog, "JOIN: foobaz",
"Privmsg", cb_errlog, "PRIVMSG: foobar",
"Whois", cb_errlog, "WHOIS: foobar",
"Ping", cb_errlog, "PING: foobar");
menu_help = XawVaMakeSimpleMenu(tb_help, "Help Menu", 1,
"About", cb_errlog, "Mockup of an IRC client GUI. WIP!");
tabs = XtVaCreateManagedWidget("Main Window", tabsWidgetClass, toplevel,
XtNgridx, 0,
XtNgridy, -1,
XtNweighty, 1,
NULL);
tab_frame = XtVaCreateManagedWidget("##secret-project", frameWidgetClass, tabs,
XtNshadowType, Trough,
XtNshadowWidth, 1,
NULL);
tab_gbox = XtVaCreateManagedWidget("Tab Gridbox", gridboxWidgetClass, tab_frame,
XtNgridHeight, 10,
NULL);
tab_vpane = XtVaCreateManagedWidget("Chat/List Pane", panedWidgetClass, tab_gbox,
XtNorientation, XtorientHorizontal,
XtNgridy, 0,
XtNweighty, 8,
NULL);
tab_userlist = XtVaCreateManagedWidget("User List", listWidgetClass, tab_vpane,
XtNverticalList, True,
XtNdefaultColumns, 1,
XtNforceColumns, True,
NULL);
tab_textout = XtVaCreateManagedWidget("Text Output", asciiTextWidgetClass, tab_vpane,
XtNtype, XawAsciiFile,
XtNstring, "/tmp/irc.txt",
XtNscrollVertical, XawtextScrollAlways,
XtNwrap, XawtextWrapWord,
NULL);
tab_textin = XtVaCreateManagedWidget("Text Input", asciiTextWidgetClass, tab_gbox,
XtNeditType, XawtextEdit,
XtNwrap, XawtextWrapLine,
XtNscrollVertical, XawtextScrollWhenNeeded,
XtNscrollHorizontal, XawtextScrollNever,
XtNgridy, 1,
XtNweighty, 2,
XtNweightx, 1,
NULL);
char *users[10];
users[0] = "foo";
users[1] = "bar";
users[2] = "baz";
users[3] = "alice";
users[4] = "bob";
users[5] = "ted";
users[6] = "mallory";
users[7] = "eve";
users[8] = "eren";
users[9] = NULL;
XawListChange(tab_userlist, (const char **) users, 0, 0, 0);
XtRealizeWidget(shell);
XtMainLoop();
}