Skip to content

Commit 553e96b

Browse files
committed
Adds basic docs site setup
1 parent f6a306d commit 553e96b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+13010
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# React NodeGUI
2+
23
[![Join the NodeGUI community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/nodegui)
34
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors)
45

5-
Build **performant**, **native** and **cross-platform** desktop applications with **JavaScript** + powerful **CSS like styling**.🚀
6+
Build **performant**, **native** and **cross-platform** desktop applications with React.🚀
67

78
React NodeGUI is powered by **React** ⚛️ and **Qt5** 💚 which makes it CPU and memory efficient as compared to other chromium based solutions like electron. React NodeGUI is essentially a React renderer for [NodeGUI](https://github.com/nodegui/nodegui).
89

@@ -71,7 +72,7 @@ React NodeGUI is an open source project and requires your support. If you like t
7172

7273
## Special Thanks
7374

74-
- [Logo: Thanks to Vishwas Shetty from the Noun Project.](https://github.com/nodegui/nodegui/blob/master/extras/legal/logo/thanks.md)
75+
- [Logo: Thanks to Vishwas Shetty from the Noun Project.](https://github.com/nodegui/nodegui/blob/master/extras/legal/logo/thanks.md)
7576

7677
## Code of Conduct
7778

website/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# dependencies
2+
/node_modules
3+
4+
# production
5+
/build
6+
7+
# generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

website/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Website
2+
3+
This website is built using Docusaurus 2, a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
```
30+
$ GIT_USER=<Your GitHub username> USE_SSH=1 yarn deploy
31+
```
32+
33+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

website/blog/2019-05-30-welcome.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: welcome
3+
title: Welcome
4+
author: Atul R
5+
authorTitle: Maintainer @NodeGui
6+
authorURL: https://github.com/master-atul
7+
authorImageURL: https://avatars2.githubusercontent.com/u/4029423?s=460&v=4
8+
authorTwitter: masteratul94
9+
tags: [nodegui, hello]
10+
---
11+
12+
This is the new blog site for NodeGui. This will be updated soon.

website/docs/api/Component.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
sidebar_label: Component
3+
title: Component
4+
---
5+
6+
> Abstract class that is root most base class for all widgets and layouts in the NodeGui World.
7+
8+
**This class is used to add core properties to all widgets, layouts etc in NodeGui world. Currently it helps us maintain references to the native C++ instance of the widget or layout. It also helps in preventing gc of child elements of a layout or widget**
9+
10+
`Component` is an abstract class and hence no instances of the same should be created. It exists so that we can add core functionalities to all widgets and layouts easily. This is an internal class.
11+
12+
**Component is the base class for YogaWidget and NodeLayout which means all widgets and layouts inherit it aswell. Its the root base class in NodeGui world**
13+
14+
To get a clearer picture you can take a look at the Component source code here: `src/lib/core/Component/index.ts`
15+
16+
## Static Methods
17+
18+
There are no public static methods for Component.
19+
20+
## Instance Properties
21+
22+
There are no public instance properties for Component.
23+
24+
## Instance Methods
25+
26+
There are no public instance methods for Component.

website/docs/api/EventWidget.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
sidebar_label: EventWidget
3+
title: EventWidget
4+
---
5+
6+
> Abstract class that adds event handling support to all widgets.
7+
8+
**This class implements an event emitter and merges it with Qt's event and signal system. It allows us to register and unregister event and signal listener at will from javascript**
9+
10+
`EventWidget` is an abstract class and hence no instances of the same should be created. It exists so that we can add event handling functionalities to all widget's easily. This is an internal class.
11+
12+
**EventWidget is the base class for NodeWidget which means all widgets inherit it aswell. It inherits from another abstract class [YogaWidget](api/YogaWidget.md)**
13+
14+
### Example
15+
16+
```javascript
17+
const { QWidget, QWidgetEvents } = require("@nodegui/nodegui");
18+
19+
const view = new QWidget();
20+
// addEventListener is a method from EventWidget
21+
view.addEventListener("MouseMove", () => {
22+
console.log("mouse moved");
23+
});
24+
25+
or;
26+
27+
// addEventListener is a method from EventWidget
28+
view.addEventListener(QWidgetEvents.MouseMove, () => {
29+
console.log("mouse moved");
30+
});
31+
```
32+
33+
EventWidget will contain all methods and properties that are useful to handle events and signals of widgets in the NodeGui world.
34+
35+
## Static Methods
36+
37+
EventWidget can access all the static methods defined in [YogaWidget](api/YogaWidget.md)
38+
39+
## Instance Properties
40+
41+
EventWidget can access all the instance properties defined in [YogaWidget](api/YogaWidget.md)
42+
43+
## Instance Methods
44+
45+
EventWidget can access all the instance methods defined in [YogaWidget](api/YogaWidget.md)
46+
47+
Additionally it also has the following instance methods:
48+
49+
### `widget.addEventListener(eventType, callback)`
50+
51+
Adds an event listener to the widget to listen to events that occur on a widget.
52+
53+
- `eventType` string - The event or signal you wish to listen to for the widget. Every widget exports its own enum of all possible events and signal types it can take. For example: `QWidget` exports `QWidgetEvents`, `QPushButton` exports `QPushButtonEvents`.
54+
55+
- `callback` (payload?: NativeEvent | any) => void - A callback function to invoke when an event occurs. Usually you receive a nativeEvent or a string as argument.
56+
57+
### `widget.removeEventListener(eventType, callback?)`
58+
59+
Removes the specified event listener from the widget.
60+
61+
- `eventType` string - The event or signal for which you wish to remove the listener.
62+
63+
- `callback` Function (_Optional_) - If specified the removeEventListener will remove the specified listener only, otherwise all eventlisteners of the eventType on the widget will be removed.

website/docs/api/FlexLayout.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
sidebar_label: FlexLayout
3+
title: FlexLayout
4+
---
5+
6+
> Custom layout to help layout child widgets using flex layout.
7+
8+
**This class is a JS wrapper around custom Qt layout implemented using [Yoga](https://github.com/facebook/yoga)**
9+
10+
A `FlexLayout` can be used to layout all child NodeGui widgets using flex.
11+
12+
**FlexLayout inherits from [NodeLayout](api/NodeLayout.md)**
13+
14+
### Example
15+
16+
```javascript
17+
const { FlexLayout, QWidget, QLabel } = require("@nodegui/nodegui");
18+
19+
const view = new QWidget();
20+
const layout = new FlexLayout();
21+
view.setLayout(layout);
22+
23+
const label = new QLabel();
24+
label.setText("label1");
25+
const label2 = new QLabel();
26+
label2.setText("label2");
27+
28+
layout.addWidget(label);
29+
layout.addWidget(label2);
30+
```
31+
32+
## Static Methods
33+
34+
FlexLayout can access all the static methods defined in [NodeLayout](api/NodeLayout.md)
35+
36+
## Instance Properties
37+
38+
FlexLayout can access all the instance properties defined in [NodeLayout](api/NodeLayout.md)
39+
40+
## Instance Methods
41+
42+
FlexLayout can access all the instance methods defined in [NodeLayout](api/NodeLayout.md)
43+
44+
Additionally it also has the following instance methods:
45+
46+
### `layout.addWidget(childWidget, childFlexNode?)`
47+
48+
Adds the childWidget to the layout. It calls the native method of custom FlexLayout.
49+
50+
- `childWidget` NodeWidget - child widget that needs to be added to the layout.
51+
- `childFlexNode` flexNode ref (_Optional_) - flexNode reference of the child widget. You can get this by calling `childWidget.getFlexNode()`.
52+
53+
### `layout.insertChildBefore(childWidget, beforeChildWidget, childFlexNode?, beforeChildFlexNode?)`
54+
55+
Adds the childWidget before another already set childWidget in the layout. It calls the native method of custom FlexLayout.
56+
57+
- `childWidget` NodeWidget - child widget that needs to be added to the layout.
58+
- `beforeChildWidget` NodeWidget - the widget before which the `childWidget` needs to be added in the layout.
59+
- `childFlexNode` flexNode ref (_Optional_) - flexNode reference of the child widget. You can get this by calling `childWidget.getFlexNode()`.
60+
- `beforeChildFlexNode` flexNode ref (_Optional_) - flexNode reference of the before child widget. You can get this by calling `beforeChildWidget.getFlexNode()`.
61+
62+
### `layout.removeWidget(childWidget, childFlexNode?)`
63+
64+
Removes the childWidget from the layout. It calls the native method of custom FlexLayout.
65+
66+
- `childWidget` NodeWidget - child widget that needs to be added to the layout.
67+
- `childFlexNode` flexNode ref (_Optional_) - flexNode reference of the child widget. You can get this by calling `childWidget.getFlexNode()`.
68+
69+
### `layout.setFlexNode(flexNode)`
70+
71+
A layout doesnt have its own flexNode. This method sets the flex Node to use for calculating position of the child widgets. Hence this should be always equal to the flex node of widget for which this layout is set. This is called internally by `widget.setLayout`.
72+
73+
- `flexNode` flexNode ref - flexNode reference of the widget for which this layout is set. You can get this by calling `widget.getFlexNode()`.

website/docs/api/NodeLayout.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
sidebar_label: NodeLayout
3+
title: NodeLayout
4+
---
5+
6+
> Abstract class to add functionalities common to all Layout.
7+
8+
**This class implements all methods, properties of Qt's [QLayout class](https://doc.qt.io/qt-5/qlayout.html) so that it can be inherited by all layouts**
9+
10+
`NodeLayout` is an abstract class and hence no instances of the same should be created. It exists so that we can add similar functionalities to all layout's easily. Additionally it helps in typechecking process.
11+
12+
**NodeLayout is the base class for all layouts. It inherits from another abstract class [Component](api/Component.md)**
13+
14+
### Example
15+
16+
```javascript
17+
const {
18+
NodeLayout,
19+
NodeWidget,
20+
FlexLayout,
21+
GridLayout,
22+
QPushButton,
23+
QWidget
24+
} = require("@nodegui/nodegui");
25+
26+
// addChildToLayout can accept any layout since it expects NodeLayout
27+
const addChildToLayout = (layout: NodeLayout, widget: NodeWidget) => {
28+
layout.addWidget(widget);
29+
};
30+
31+
addChildToLayout(new FlexLayout(), new QPushButton());
32+
addChildToLayout(new GridLayout(), new QWidget());
33+
```
34+
35+
NodeLayout will list all methods and properties that are common to all layouts in the NodeGui world.
36+
37+
## Static Methods
38+
39+
NodeLayout can access all the static methods defined in [Component](api/Component.md)
40+
41+
## Instance Properties
42+
43+
NodeLayout can access all the instance properties defined in [Component](api/Component.md)
44+
45+
Additionally it also has the following instance properties:
46+
47+
### `layout.type`
48+
49+
This will return the string `layout` for all layouts.
50+
51+
## Instance Methods
52+
53+
NodeLayout can access all the instance methods defined in [Component](api/Component.md)
54+
55+
Additionally it also has the following instance methods:
56+
57+
### `layout.addWidget(childWidget, ...args)`
58+
59+
This is an abstract method in NodeLayout class. All Layouts inheriting from NodeLayout should implement this method.
60+
61+
- `childWidget` NodeWidget - Any widget in the NodeGui world.
62+
- `...args` any[] - Additional params as required by the layout.
63+
64+
### `layout.activate()`
65+
66+
Redoes the layout for parent widget of this layout if necessary. Returns true if the layout was redone.
67+
68+
### `layout.invalidate()`
69+
70+
Invalidates any cached information in this layout.
71+
72+
### `layout.update()`
73+
74+
Updates the layout for parent widget of this layout. You should generally not need to call this because it is automatically called at the most appropriate times.

0 commit comments

Comments
 (0)