Win/Lin GUI API Wrapper Library

User projects written in or related to FreeBASIC.
Oz
Posts: 585
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Win/Lin GUI API Wrapper Library

Postby Oz » Mar 24, 2008 14:20

I have not started on this project, but I am looking to recruit some people to create a winapi wrapper and a program similar to VB to make it easy to create windows apps in a WYSIWYG editor.

If anyone is serious interested in contributing to this sort of a project, please let me know or hop on irc

irc.freenode.net #fb-gui-api
Any help is appreciated,

Oz

::EDIT

Goals
  • What GUI systems will be supported
    • windows
    • gtk?
    • X11/A5c11's Gui lib? (X11 does not have native GUI support)
  • Create a base class that handles the windowing system events
    • Use VB-like callbacks for both windows and linux
    • Decide whether these callbacks need to be threaded
  • Create a basic widget class with the following elements
    • A reference to it's handle in the windowing system
    • Callbacks for OnClick, OnDblClick, OnKey, OnKeyDown, OnKeyUp, OnMouseMove, OnFocus, OnBlur, OnMouseEnter, OnMouseExit, [add more later as we discuss]
    • Properties of the widget: color, background color, text, style, size, position, etc.
  • Design individual widget plugins
    • each gui system will have it's own function, but will be added as a plugin function depending on the user setting, see below code


Code: Select all

'
'  Window Class?
'

#include "plugins.bi"
#include "widget_types.bi"

declare sub win_create cdecl ( byval x as any ptr )
declare sub win_destroy cdecl ( byval x as any ptr )
declare sub lin_create cdecl ( byval x as any ptr )
declare sub lin_destroy cdecl ( byval x as any ptr )
' ... other functions

dim shared _self as Plugin_Instance Ptr
dim shared _parent as Plugin_List Ptr

   function init cdecl alias "init" ( byval self as any ptr, byval object as any ptr ) as ubyte export
      _self = cptr( Plugin_Instance Ptr, self )
      _parent = _self->parent
      
      _self->pname = "window"

#if __fb_win32__
      _self->init_func( "create", ProcPtr( win_create ) )
      _self->init_func( "destroy", ProcPtr( win_destroy ) )
#elseif __fb_linux__
      _self->init_func( "create", ProcPtr( lin_create ) )
      _self->init_func( "destroy", ProcPtr( lin_destroy ) )
#else
      _self->init_func( "create", ProcPtr( ???_create ) )
      _self->init_func( "destroy", ProcPtr( ???_destroy ) )
#endif
      
      _self->version.maj = 0
      _self->version.min = 1
      _self->version.rev = 1

      if _parent <> 0 then
         dim i as integer
         i = _parent->find( "base" )
         return iif( i >= 0, 1, 0 )
      end if

      return 1
      
   end function

   function deinit cdecl alias "deinit" ( byval self as any ptr, byval object as any ptr ) as ubyte export

      _self->deinit_func( "destroy" )
      _self->deinit_func( "create" )
      
      return 1

   end function

sub win_create cdecl ( byval x as any ptr )

   dim newWidget as any ptr
   dim n as WidgetInfo

   _parent->_call( "base::widget", newWidget )
   n.setHandle( newWidget )
   n.attributes.blahblahblah = SOMVE_VAR
   _parent->_call( "base::set_attr", @n )
   
end sub

sub win_destroy cdecl ( byval x as any ptr )

   ' I really wish I had planned this system out a bit more... =/

end sub

sub lin_create cdecl ( byval x as any ptr )

   dim newWidget as any ptr
   dim n as WidgetInfo

   _parent->_call( "base::widget", newWidget )
   n.setHandle( newWidget )
   n.attributes.blahblahblah = SOMVE_VAR
   _parent->_call( "base::set_attr", @n )
   
end sub

sub lin_destroy cdecl ( byval x as any ptr )

   ' I really wish I had planned this system out a bit more... =/

end sub


Here is a list of references for both windows and x11 programming:

WinAPI:
http://msdn2.microsoft.com/en-us/library/aa163301.aspx
(this is actually a tool) http://www.devhood.com/Tools/tool_detai ... ool_id=563
[if you have any other good ones, i'll be glad to add them]

X11:
http://www.x.org/wiki/
http://tronche.com/gui/x/xlib/function-index.html
http://users.actcom.co.il/~choo/lupg/tu ... mming.html
http://en.wikibooks.org/wiki/Guide_to_X ... _and_Links

GTK:
http://library.gnome.org/devel/gtk-tutorial/stable/
http://gtk.org/documentation.html

Perhaps collectively we can discuss how things will work, and I plan on doing quite a bit of adding to my pluginsys to make it faster (search using heuristics) and adding the ability to use functions as well as subs (shouldn't be too hard) and anything else we may require of it.

I'll post the latest version of pluginsys sometime in a few hours (there are some bugs I need to fix, and some things I need to add)
Last edited by Oz on Mar 25, 2008 18:06, edited 7 times in total.
D.J.Peters
Posts: 8024
Joined: May 28, 2005 3:28
Contact:

Postby D.J.Peters » Mar 24, 2008 14:59

Windows only is stupid :lol:

Joshy
Oz
Posts: 585
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Postby Oz » Mar 24, 2008 16:04

well, most other windowing system api have lots of information out on them.
winapi, on the other hand, doesn't have many information sources, and it's trickier than most to learn

unofficially, I will say there will be X11 support, but I'd like to see who is interested in doing this sort of project, first

Oz
theuserbl
Posts: 29
Joined: Dec 01, 2005 13:03

Postby theuserbl » Mar 24, 2008 16:49

Oz wrote:well, most other windowing system api have lots of information out on them.
winapi, on the other hand, doesn't have many information sources, and it's trickier than most to learn


Right. The only advantage of the WinAPI is, that it is easyer to understand for people who develop precedural and not OOP.


unofficially, I will say there will be X11 support, but I'd like to see who is interested in doing this sort of project, first


I would love to see such a project. But I have no skill, proficiency, experiences, knowledge and so to help for this.

At the moment I plan to buy a PureBasic, because FB supports no GUI the easy way.


Greatings
theuserbl
krcko
Posts: 163
Joined: Jul 30, 2006 0:34
Location: Serbia
Contact:

Postby krcko » Mar 24, 2008 19:13

I'm interested in contributing to this project, I always wanted to do gui library (which will resemble vb6, ie control names and their property/event/method names should be the same) but I waited some oop support to be implemented in fb (inheritance)...

as i see, we will not have inheritance in near future, so we'll have to do it without it (okay, copy/pasting will do the job :D)
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Postby anonymous1337 » Mar 24, 2008 19:23

krcko wrote:as i see, we will not have inheritance in near future, so we'll have to do it without it (okay, copy/pasting will do the job :D)
Writing Plugins with Dynamic Libraries in FB

Can't beat inheritance, but it can definitely supply the very useful 'interface'-styled design class extension offers.
Oz
Posts: 585
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Postby Oz » Mar 24, 2008 21:00

I have a plugin library I plan on using extensively, considering it has multi-threading ability, plus the use of internal variables, so we have inheritance and that sort of thing covered

Each widget will have it's own plugin, and that will take care of inheritence, as the plugins can access other plugins in a list, so we could have a base class to handle most information.

even if you have no experience with these APIs, there will be many function prototypes and types to design and refine, so almost anyone with programming experience can help.
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Postby Merick » Mar 24, 2008 21:03

If you are looking make something that would be easily portable to linux, then you might want to look into the IUP library, as it already has built-in wrappers for both windows and linux (only, on linux it uses gtk, not X11)
Oz
Posts: 585
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Postby Oz » Mar 24, 2008 21:35

I've taken a look at IUP, but it doesn't seem to have the type of style that I prefer.
I'm not closed to using it, but I'd like to look into using X11, which will run on any linux environment (to the most of my knowledge)

Oz
Last edited by Oz on Mar 25, 2008 4:07, edited 1 time in total.
HD_
Posts: 215
Joined: Jun 10, 2006 12:15
Contact:

Postby HD_ » Mar 24, 2008 23:15

What is X11?

I think you should use something which uses the platforms native api. I really hate a tool which runs slowly..
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Postby Merick » Mar 25, 2008 0:33

X11 is the set of graphics libs that almost all linux guis are built on
Oz
Posts: 585
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Postby Oz » Mar 25, 2008 4:09

this library will use native api: winapi and x11...maybe gtk, but I don't want to get a huge expectation for this, then end up being too much to bite off
Deleter
Posts: 975
Joined: Jun 22, 2005 22:33

Postby Deleter » Mar 25, 2008 5:21

if deleter.hasTime()=true then deleter.willHelp()

;)

Though I have a fairly large fb project in the works atm...so I'm not sure how much I will be able to contribute.
HD_
Posts: 215
Joined: Jun 10, 2006 12:15
Contact:

Postby HD_ » Mar 25, 2008 6:18

Let me just get this straight, am I mistaken in thinking that IUP and wxwidgets use the native controls (and by native controls, I mean on windows they will use win32 api, on linux they use whatever linux uses)?

I am interested in this project.
wallyfblu
Posts: 69
Joined: May 24, 2006 10:58
Location: ITALY

Postby wallyfblu » Mar 25, 2008 9:14

Hi Oz, I'm also interested in this project.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 6 guests