Meta: Add files to repository
This commit is contained in:
parent
80a0428b66
commit
39198164cd
1029 changed files with 78311 additions and 0 deletions
5
Applets/Calendar.applet/Run.HC
Normal file
5
Applets/Calendar.applet/Run.HC
Normal file
|
@ -0,0 +1,5 @@
|
|||
Gui.App();
|
||||
|
||||
U0 Main() { Suspend; }
|
||||
|
||||
Main;
|
32
Applets/ClipManager.applet/Run.HC
Normal file
32
Applets/ClipManager.applet/Run.HC
Normal file
|
@ -0,0 +1,32 @@
|
|||
Gui.App();
|
||||
|
||||
Context2DWidget* clipmanager_icon = SystemTray.RegisterItem();
|
||||
|
||||
Context2D* ctx_clip_icon = Image.FileToContext2D("M:/Media/Themes/Umami/Icon/clipboard.png");
|
||||
|
||||
CopyRect2D(clipmanager_icon->ctx, 0, 0, ctx_clip_icon);
|
||||
|
||||
U0 Main()
|
||||
{
|
||||
I64 length = 0;
|
||||
I64 text_width = 0;
|
||||
while (1) {
|
||||
if (length < Clipboard.Length()) {
|
||||
CopyRect2D(clipmanager_icon->ctx, 0, 0, ctx_clip_icon);
|
||||
Rect2D(clipmanager_icon->ctx, 12, 12, 12, 12, Color(255, 0, 0));
|
||||
text_width = Print2D(NULL, Compositor.theme.font.sans, 0, 0,
|
||||
Color(255, 255, 255), , "%02d", Clipboard.Length());
|
||||
Print2D(clipmanager_icon->ctx, Compositor.theme.font.sans,
|
||||
11 + 6 - (text_width / 2), 13, Color(255, 255, 255), , "%02d",
|
||||
Clipboard.Length());
|
||||
Print2D(clipmanager_icon->ctx, Compositor.theme.font.sans,
|
||||
11 + 7 - (text_width / 2), 13, Color(255, 255, 255), , "%02d",
|
||||
Clipboard.Length());
|
||||
length = Clipboard.Length();
|
||||
Gui.Window.Refresh(Compositor.menubar.win);
|
||||
}
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
Main;
|
101
Applets/NetworkStatus.applet/Run.HC
Normal file
101
Applets/NetworkStatus.applet/Run.HC
Normal file
|
@ -0,0 +1,101 @@
|
|||
Gui.App();
|
||||
|
||||
U64 flags = WIN_FLAGS_MOVABLE | WIN_FLAGS_ICON | WIN_FLAGS_TITLE_BAR | WIN_FLAGS_CLOSE_BUTTON | WIN_FLAGS_SKIP;
|
||||
Window* win = Compositor.CreateWindow(Display.Width() - 240, 33, 240, 120, flags);
|
||||
Gui.Window.SetIcon(win, Image.FileToContext2D("window_icon_16x16.png"));
|
||||
Gui.Window.Hide(win);
|
||||
Gui.Window.SetTitle(win, "Network Status");
|
||||
|
||||
TextLabelWidget* status_label1 = Gui.CreateWidget(win, WIDGET_TYPE_LABEL, 16, 16, 192, 16);
|
||||
TextLabelWidget* status_label2 = Gui.CreateWidget(win, WIDGET_TYPE_LABEL, 16, 32, 192, 16);
|
||||
TextLabelWidget* status_label3 = Gui.CreateWidget(win, WIDGET_TYPE_LABEL, 16, 48, 192, 16);
|
||||
TextLabelWidget* status_label4 = Gui.CreateWidget(win, WIDGET_TYPE_LABEL, 16, 64, 192, 16);
|
||||
|
||||
TextLabelWidget* status_label5 = Gui.CreateWidget(win, WIDGET_TYPE_LABEL, 128, 16, 192, 16);
|
||||
TextLabelWidget* status_label6 = Gui.CreateWidget(win, WIDGET_TYPE_LABEL, 128, 32, 192, 16);
|
||||
TextLabelWidget* status_label7 = Gui.CreateWidget(win, WIDGET_TYPE_LABEL, 128, 48, 192, 16);
|
||||
TextLabelWidget* status_label8 = Gui.CreateWidget(win, WIDGET_TYPE_LABEL, 128, 64, 192, 16);
|
||||
Gui.Widget.SetFont(status_label1, "Eight Bit Dragon");
|
||||
Gui.Widget.SetFont(status_label2, "Eight Bit Dragon");
|
||||
Gui.Widget.SetFont(status_label3, "Eight Bit Dragon");
|
||||
Gui.Widget.SetFont(status_label4, "Eight Bit Dragon");
|
||||
Gui.Widget.SetFont(status_label5, "Eight Bit Dragon");
|
||||
Gui.Widget.SetFont(status_label6, "Eight Bit Dragon");
|
||||
Gui.Widget.SetFont(status_label7, "Eight Bit Dragon");
|
||||
Gui.Widget.SetFont(status_label8, "Eight Bit Dragon");
|
||||
|
||||
Context2DWidget* network_icon = SystemTray.RegisterItem();
|
||||
|
||||
Context2D* ctx_network_error = Image.FileToContext2D("M:/Media/Themes/Umami/Icon/status/network-error.png");
|
||||
Context2D* ctx_network_idle = Image.FileToContext2D("M:/Media/Themes/Umami/Icon/status/network-idle.png");
|
||||
Context2D* ctx_network_offline = Image.FileToContext2D(
|
||||
"M:/Media/Themes/Umami/Icon/status/network-offline.png");
|
||||
Context2D* ctx_network_rx = Image.FileToContext2D(
|
||||
"M:/Media/Themes/Umami/Icon/status/network-receive.png");
|
||||
Context2D* ctx_network_tx = Image.FileToContext2D(
|
||||
"M:/Media/Themes/Umami/Icon/status/network-transmit.png");
|
||||
Context2D* ctx_network_txrx = Image.FileToContext2D(
|
||||
"M:/Media/Themes/Umami/Icon/status/network-transmit-receive.png");
|
||||
Context2D* ctx_network_wireless_enc = Image.FileToContext2D(
|
||||
"M:/Media/Themes/Umami/Icon/status/network-wireless-encrypted.png");
|
||||
|
||||
U0 @networkstatus_show(Widget*)
|
||||
{
|
||||
|
||||
NetInfoRequest* req = @net_info_request;
|
||||
|
||||
win->flags &= ~WIN_FLAGS_SKIP;
|
||||
|
||||
U8 status_ipaddr[128];
|
||||
U8 status_netmask[128];
|
||||
U8 status_gateway[128];
|
||||
U8 status_dns1[128];
|
||||
|
||||
StrPrint(&status_ipaddr, "%d.%d.%d.%d", req->ipv4_address.u8[3], req->ipv4_address.u8[2],
|
||||
req->ipv4_address.u8[1], req->ipv4_address.u8[0]);
|
||||
StrPrint(&status_netmask, "%d.%d.%d.%d", req->ipv4_netmask.u8[3], req->ipv4_netmask.u8[2],
|
||||
req->ipv4_netmask.u8[1], req->ipv4_netmask.u8[0]);
|
||||
StrPrint(&status_gateway, "%d.%d.%d.%d", req->ipv4_gateway.u8[3], req->ipv4_gateway.u8[2],
|
||||
req->ipv4_gateway.u8[1], req->ipv4_gateway.u8[0]);
|
||||
StrPrint(&status_dns1, "%d.%d.%d.%d", req->dns_server_address.u8[3], req->dns_server_address.u8[2],
|
||||
req->dns_server_address.u8[1], req->dns_server_address.u8[0], req->dns_server_port);
|
||||
|
||||
Gui.Widget.SetText(status_label1, "IP address:");
|
||||
Gui.Widget.SetText(status_label2, "Subnet mask:");
|
||||
Gui.Widget.SetText(status_label3, "Gateway:");
|
||||
Gui.Widget.SetText(status_label4, "DNS Server:");
|
||||
|
||||
Gui.Widget.SetText(status_label5, &status_ipaddr);
|
||||
Gui.Widget.SetText(status_label6, &status_netmask);
|
||||
Gui.Widget.SetText(status_label7, &status_gateway);
|
||||
Gui.Widget.SetText(status_label8, &status_dns1);
|
||||
|
||||
Gui.Window.SetFocus(win);
|
||||
Gui.Window.Refresh(win);
|
||||
while (!Gui.Window.IsVisible(win))
|
||||
Compositor.ShowWindow(win);
|
||||
}
|
||||
|
||||
U0 @networkstatus_hide(Window*)
|
||||
{
|
||||
win->flags |= WIN_FLAGS_SKIP;
|
||||
Compositor.HideWindow(win);
|
||||
}
|
||||
|
||||
network_icon->ctx = ctx_network_error;
|
||||
Gui.Window.Refresh(Compositor.menubar.win);
|
||||
Gui.Window.SetCallback(win, "close", &@networkstatus_hide);
|
||||
|
||||
U0 Main()
|
||||
{
|
||||
Gui.Widget.SetCallback(network_icon, "clicked", &@networkstatus_show);
|
||||
while (1) {
|
||||
if (network_icon->ctx == ctx_network_error) {
|
||||
network_icon->ctx = ctx_network_idle;
|
||||
Gui.Window.Refresh(Compositor.menubar.win);
|
||||
}
|
||||
Sleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
Main;
|
BIN
Applets/NetworkStatus.applet/window_icon_16x16.png
Normal file
BIN
Applets/NetworkStatus.applet/window_icon_16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 613 B |
71
Applets/VolumeSlider.applet/Run.HC
Normal file
71
Applets/VolumeSlider.applet/Run.HC
Normal file
|
@ -0,0 +1,71 @@
|
|||
Gui.App();
|
||||
|
||||
Window* win = Compositor.CreateWindow(Display.Width(), 32, 256, 32,
|
||||
WIN_FLAGS_NOHILIGHT | WIN_FLAGS_SKIP);
|
||||
|
||||
Context2DWidget* volume_slider_icon = Gui.CreateWidget(win, WIDGET_TYPE_CONTEXT2D, 0, 0, 24, 24);
|
||||
volume_slider_icon->ctx = NewContext2D(24, 24);
|
||||
HorizontalSliderWidget* volume_slider = Gui.CreateWidget(win, WIDGET_TYPE_HORZ_SLIDER, 32, 4, 212, 24);
|
||||
volume_slider->max = 100;
|
||||
volume_slider->scroll = volume_slider->width;
|
||||
|
||||
Context2DWidget* tray_icon = SystemTray.RegisterItem();
|
||||
|
||||
Context2D* ctx_volume_muted = Image.FileToContext2D(
|
||||
"M:/Media/Themes/Umami/Icon/status/audio-volume-muted.png");
|
||||
Context2D* ctx_volume_low = Image.FileToContext2D(
|
||||
"M:/Media/Themes/Umami/Icon/status/audio-volume-low.png");
|
||||
Context2D* ctx_volume_medium = Image.FileToContext2D(
|
||||
"M:/Media/Themes/Umami/Icon/status/audio-volume-medium.png");
|
||||
Context2D* ctx_volume_high = Image.FileToContext2D(
|
||||
"M:/Media/Themes/Umami/Icon/status/audio-volume-high.png");
|
||||
|
||||
U0 @volumeslider_show(Widget*)
|
||||
{
|
||||
win->x = Display.Width() - 256;
|
||||
Compositor.ShowWindow(win);
|
||||
Gui.Window.SetFocus(win);
|
||||
}
|
||||
|
||||
U0 @volumeslider_change(Widget*)
|
||||
{
|
||||
I64 volume = Min(ToI64(volume_slider->scroll * 0.47), 100);
|
||||
Audio.mixer.left = volume;
|
||||
Audio.mixer.right = volume;
|
||||
Context2D* update_slider_icon = NULL;
|
||||
switch (volume) {
|
||||
case 0:
|
||||
update_slider_icon = ctx_volume_muted;
|
||||
break;
|
||||
case 1...24:
|
||||
update_slider_icon = ctx_volume_low;
|
||||
break;
|
||||
case 25...74:
|
||||
update_slider_icon = ctx_volume_medium;
|
||||
break;
|
||||
case 75...100:
|
||||
default:
|
||||
update_slider_icon = ctx_volume_high;
|
||||
break;
|
||||
}
|
||||
CopyRect2D(volume_slider_icon->ctx, 0, 0, update_slider_icon);
|
||||
CopyRect2D(tray_icon->ctx, 0, 0, update_slider_icon);
|
||||
Gui.Window.Refresh(Compositor.menubar.win);
|
||||
}
|
||||
@volumeslider_change(NULL);
|
||||
|
||||
U0 Main()
|
||||
{
|
||||
Gui.Window.SetTitle(win, "VolumeSlider");
|
||||
Compositor.HideWindow(win);
|
||||
Gui.Widget.SetCallback(tray_icon, "clicked", &@volumeslider_show);
|
||||
Gui.Widget.SetCallback(volume_slider, "change", &@volumeslider_change);
|
||||
|
||||
while (1) {
|
||||
if (Gui.Window.IsVisible(win) && Compositor.active_win != win)
|
||||
Compositor.HideWindow(win);
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
Main;
|
Loading…
Add table
Add a link
Reference in a new issue