Update library

New library window

git-svn-id: svn://kolibrios.org@6887 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2017-04-12 22:56:25 +00:00
parent 18deabebad
commit 61e1662b4e
22 changed files with 56 additions and 46 deletions

View File

@ -1,40 +1,21 @@
#define MEMSIZE 4096*10 #define MEMSIZE 4096*10
#include "../lib/io.h" #include "../lib/io.h"
#include "../lib/gui.h" #include "../lib/window.h"
window win1=0;
void main() void main()
{ {
word id;
dword file;
io.dir.load(0,DIR_ONLYREAL); io.dir.load(0,DIR_ONLYREAL);
loop() switch(WaitEvent()) win1.background = 0xFFFFFF;
{ win1.left = 200;
case evButton: win1.ondraw = #draw_window;
id=GetButtonID(); win1.create();
if (id==1) ExitProcess();
break;
case evKey:
GetKeys();
if (key_scancode == SCAN_CODE_ESC ) ExitProcess();
break;
case evReDraw:
draw_window();
break;
}
} }
void draw_window() void draw_window()
{ {
proc_info Form;
int i; int i;
DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0); for (i=0; i<io.dir.count; i++)WriteText(5,i*8+3,0x80,0xFF00FF,io.dir.position(i));
GetProcessInfo(#Form, SelfInfo);
for (i=0; i<io.dir.count; i++)
{
WriteText(5,i*8+3,0x80,0xFF00FF,io.dir.position(i));
}
DrawCaptButton(100, 10, 100, 22, 22, 0xCCCccc, 0x000000, "Button"); DrawCaptButton(100, 10, 100, 22, 22, 0xCCCccc, 0x000000, "Button");
WriteText(100,50,0x80,0,"Textline small"); WriteText(100,50,0x80,0,"Textline small");
WriteText(100,70,0x90,0,"Textline big"); WriteText(100,70,0x90,0,"Textline big");

View File

@ -1,7 +1,6 @@
//IO library //IO library
#ifndef INCLUDE_DATE_H #ifndef INCLUDE_DATE_H
#define INCLUDE_DATE_H #define INCLUDE_DATE_H
#print "[include <date.h>]\n"
#ifndef INCLUDE_STRING_H #ifndef INCLUDE_STRING_H
#include "../lib/strings.h" #include "../lib/strings.h"

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_DEBUG_H #ifndef INCLUDE_DEBUG_H
#define INCLUDE_DEBUG_H #define INCLUDE_DEBUG_H
#print "[include <debug.h>]\n"
#ifndef INCLUDE_STRING_H #ifndef INCLUDE_STRING_H
#include "../lib/strings.h" #include "../lib/strings.h"

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_GUI_H #ifndef INCLUDE_GUI_H
#define INCLUDE_GUI_H #define INCLUDE_GUI_H
#print "[include <gui.h>]\n"
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h" #include "../lib/kolibri.h"

View File

@ -22,7 +22,6 @@
#ifndef INCLUDE_IO_H #ifndef INCLUDE_IO_H
#define INCLUDE_IO_H #define INCLUDE_IO_H
#print "[include <io.h>]\n"
#ifndef INCLUDE_DATE_H #ifndef INCLUDE_DATE_H
#include "../lib/date.h" #include "../lib/date.h"

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_KEYBOARD_H #ifndef INCLUDE_KEYBOARD_H
#define INCLUDE_KEYBOARD_H #define INCLUDE_KEYBOARD_H
#print "[include <keyboard.h>]\n"
//ASCII KEYS //ASCII KEYS
#define ASCII_KEY_BS 008 #define ASCII_KEY_BS 008

View File

@ -2,7 +2,6 @@
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#define INCLUDE_KOLIBRI_H #define INCLUDE_KOLIBRI_H
#print "[include <kolibri.h>]\n"
#pragma option OST #pragma option OST
#pragma option ON #pragma option ON

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_LEXER_H #ifndef INCLUDE_LEXER_H
#define INCLUDE_LEXER_H #define INCLUDE_LEXER_H
#print "[include <lexer.h>]\n"
#ifndef INCLUDE_STRING_H #ifndef INCLUDE_STRING_H
#include "../lib/strings.h" #include "../lib/strings.h"

View File

@ -1,7 +1,6 @@
//list_box //list_box
#ifndef INCLUDE_LIST_BOX_H #ifndef INCLUDE_LIST_BOX_H
#define INCLUDE_LIST_BOX_H #define INCLUDE_LIST_BOX_H
#print "[include <list_box.h>]\n"
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h" #include "../lib/kolibri.h"

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_MEM_H #ifndef INCLUDE_MEM_H
#define INCLUDE_MEM_H #define INCLUDE_MEM_H
#print "[include <mem.h>]\n"
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h" #include "../lib/kolibri.h"

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_MOUSE_H #ifndef INCLUDE_MOUSE_H
#define INCLUDE_MOUSE_H #define INCLUDE_MOUSE_H
#print "[include <mouse.h>]\n"
//Button MOUSE //Button MOUSE
#define MOUSE_LEFT 001b #define MOUSE_LEFT 001b

View File

@ -1,7 +1,6 @@
//BOX_LIB - Asper //BOX_LIB - Asper
#ifndef INCLUDE_BOX_LIB_H #ifndef INCLUDE_BOX_LIB_H
#define INCLUDE_BOX_LIB_H #define INCLUDE_BOX_LIB_H
#print "[include <obj/box_lib.h>]\n"
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h" #include "../lib/kolibri.h"

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_CONSOLE_H #ifndef INCLUDE_CONSOLE_H
#define INCLUDE_CONSOLE_H #define INCLUDE_CONSOLE_H
#print "[include <obj/console.h]\n"
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h" #include "../lib/kolibri.h"

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_LIBHTTP_H #ifndef INCLUDE_LIBHTTP_H
#define INCLUDE_LIBHTTP_H #define INCLUDE_LIBHTTP_H
#print "[include <obj/http.h]\n"
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h" #include "../lib/kolibri.h"

View File

@ -1,7 +1,6 @@
//convert text characters //convert text characters
#ifndef INCLUDE_LIBICONV_H #ifndef INCLUDE_LIBICONV_H
#define INCLUDE_LIBICONV_H #define INCLUDE_LIBICONV_H
#print "[include <obj/iconv.h>]\n"
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h" #include "../lib/kolibri.h"

View File

@ -1,7 +1,6 @@
//Asper //Asper
#ifndef INCLUDE_LIBIMG_H #ifndef INCLUDE_LIBIMG_H
#define INCLUDE_LIBIMG_H #define INCLUDE_LIBIMG_H
#print "[include <obj/libimg_lib.h>]\n"
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h" #include "../lib/kolibri.h"

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_LIBINI_H #ifndef INCLUDE_LIBINI_H
#define INCLUDE_LIBINI_H #define INCLUDE_LIBINI_H
#print "[include <obj/libini.h>]\n"
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h" #include "../lib/kolibri.h"

View File

@ -1,7 +1,6 @@
//Asper //Asper
#ifndef INCLUDE_LIBIO_H #ifndef INCLUDE_LIBIO_H
#define INCLUDE_LIBIO_H #define INCLUDE_LIBIO_H
#print "[include <obj/libio_lib.h>]\n"
#ifndef INCLUDE_KOLIBRI_H #ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h" #include "../lib/kolibri.h"

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_RGB_H #ifndef INCLUDE_RGB_H
#define INCLUDE_RGB_H #define INCLUDE_RGB_H
#print "[include <rgb.h>]\n"
:struct _rgb :struct _rgb
{ {

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_STRING_H #ifndef INCLUDE_STRING_H
#define INCLUDE_STRING_H #define INCLUDE_STRING_H
#print "[include <strings.h>]\n"
#ifndef INCLUDE_MEM_H #ifndef INCLUDE_MEM_H
#include "../lib/mem.h" #include "../lib/mem.h"

View File

@ -1,6 +1,5 @@
#ifndef INCLUDE_SYSTEM_H #ifndef INCLUDE_SYSTEM_H
#define INCLUDE_SYSTEM_H #define INCLUDE_SYSTEM_H
#print "[include <system.h>]\n"
:struct COLORS { :struct COLORS {
dword dword

49
programs/cmm/lib/window.h Normal file
View File

@ -0,0 +1,49 @@
#ifndef INCLUDE_WINDOW_H
#define INCLUDE_WINDOW_H
#include "../lib/gui.h"
#define WINDOW_NORMAL 0x34
:struct window
{
void create();
dword left,top,width,height;
dword caption,type,background;
dword onbutton,onkey,ondraw;
proc_info Form;
};
void window::create()
{
word id=0;
IF(!caption)caption = "Window";
IF(!width)width=350;
IF(!height)height=300;
IF(!type)type = WINDOW_NORMAL;
IF(!background)background = 0xDED7CE;
loop() switch(WaitEvent())
{
case evButton:
id=GetButtonID();
IF(onbutton)onbutton(id);
IF (id==1) ExitProcess();
break;
case evKey:
GetKeys();
IF(onkey)onbutton(key_scancode);
//if (key_scancode == SCAN_CODE_ESC ) ExitProcess();
break;
case evReDraw:
GetProcessInfo(#Form, SelfInfo);
DefineAndDrawWindow(left,top,width,height,type,background,caption,0);
IF(ondraw)ondraw();
break;
}
}
#endif