Skip to content

Instantly share code, notes, and snippets.

@lighth7015
Last active July 3, 2021 20:42
Show Gist options
  • Save lighth7015/918e43be2c7c06e7e8a2ce7ae9bf8966 to your computer and use it in GitHub Desktop.
Save lighth7015/918e43be2c7c06e7e8a2ce7ae9bf8966 to your computer and use it in GitHub Desktop.
Signin dialog
import "ecere"
import "PasswordBox"
import "skinbtn"
class SignIn : Window
{
caption = $"Welcome";
background = { r = 253, g = 250, b = 240 };
borderStyle = fixed;
hasMinimize = true;
hasClose = true;
tabCycle = true;
font = { "Source Sans Pro", 12 };
size = { 448, 346 };
anchor = { horz = -99, vert = -57 };
fileName = $"Sign-on";
isActiveClient = true;
moveable = true;
Label label5
{
this, size = { 321, 95 }, position = { 112, 8 };
void OnRedraw(Surface surface)
{
Label::OnRedraw(surface);
}
};
SkinBtn skinBtn3 { this, caption = $"Sign On", size = { 73, 31 }, position = { 360, 280 } };
SkinBtn skinBtn2
{
this, caption = $"Help", size = { 51, 31 }, position = { 306, 280 };
bool NotifyClicked(Button button, int x, int y, Modifiers mods)
{
return true;
}
};
SkinBtn button1 { this, caption = $"Setup", size = { 68, 31 }, position = { 112, 280 } };
SkinBtn skinBtn1 { this, caption = $"Profile Manager", size = { 119, 31 }, position = { 184, 280 } };
Label label4 { this, caption = $"Password", font = { "Source Sans Pro", 12, bold = true }, size = { 225, 23 }, position = { 184, 176 } };
Label label3
{
this, caption = $"Select Account Name", font = { "Source Sans Pro", 12, bold = true }, size = { 217, 23 }, position = { 184, 112 };
bool NotifyActivate(Window window, bool active, Window previous)
{
return true;
}
};
Label label1 { this, background = { r = 0, g = 99, b = 149 }, 1, size = { 106, 325 }, position = { } };
Label label2 { label1, this, $"Version 1.0", foreground = white, font = { "Source Sans Pro", 12, bold = true }, size = { 82, 21 }, position = { 16, 296 } };
DropBox accountBox { this, caption = $"loginIdPicker", font = { "Source Sans Pro", 9 }, size = { 222, 19 }, position = { 184, 136 }, rowHeight = 25 };
PasswordBox passwordBox { this, caption = $"aaaaa", size = { 222, 19 }, position = { 184, 200 }, textHorzScroll = false };
}
import "ecere"
class SkinBtn: public Button {
Color buttonFace { r = 0, g = 99, b = 149 };
public:
void OnRedraw(Surface surface)
{
int offset = 4.5;
int tw = 0, th = 0;
int sw = (clientSize.w - 2 * offset) / 3;
int sh = (clientSize.h - 2 * offset) / 3;
surface.background = parent.background;
surface.Clear(colorAndDepth);
surface.background = gray;
surface.foreground = white;
surface.Area(offset, offset, size.w - 2, size.h - 2);
surface.background = buttonState == ButtonState::down? buttonFace: gray;
if (buttonState == ButtonState::down) {
surface.Rectangle(offset - 1, offset - 1, size.w, size.h);
surface.Area(offset - 1, offset - 1, size.w, size.h);
}
else {
surface.Rectangle(0, 0, size.w - offset, size.h - offset);
surface.Area(offset - 1, offset - 1, size.w, size.h);
surface.background = buttonFace;
surface.Area(1, 1, size.w - offset, size.h - offset);
}
if (caption) {
surface.TextExtent(caption, strlen(text), &tw, &th);
int sx = ((size.w - tw) / offset) + offset,
sy = size.h - th - offset;
if (buttonState == ButtonState::down) {
sx += (offset / 2); sy += (offset / 2);
}
surface.WriteText(sx, sy, caption, strlen(caption));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment