Module: Clogs
- Defined in:
- lib/clogs.rb,
lib/clogs/ui.rb,
lib/clogs/app.rb,
lib/clogs/log.rb,
lib/clogs/text.rb,
lib/clogs/style.rb,
lib/clogs/canvas.rb,
lib/clogs/dialogs.rb,
lib/clogs/painter.rb,
lib/clogs/version.rb,
lib/clogs/drawable.rb,
lib/clogs/clipboard.rb,
lib/clogs/paragraph.rb,
lib/clogs/drawables/misc.rb,
lib/clogs/drawables/slot.rb,
lib/clogs/drawables/text.rb,
lib/clogs/display_service.rb,
lib/clogs/drawables/image.rb,
lib/clogs/drawables/shapes.rb,
lib/clogs/drawables/controls.rb
Overview
Clogs: Shoes, worn over libui.
Shoes is _why the lucky stiff's tiny Ruby GUI toolkit. Clogs implements the Shoes drawing and layout model on top of libui, a small cross-platform native widget library, so Shoes programs run on plain CRuby -- no browser engine, no JVM, one small native dependency.
The Shoes API itself comes from Lacci, the display-independent half of Scarpe. Clogs is a Lacci display service: Lacci owns the DSL and the drawable tree, Clogs owns the pixels. Run an app with:
SCARPE_DISPLAY_SERVICE=clogs ruby my_app.rb
or simply require "clogs" before Shoes.app.
Defined Under Namespace
Modules: Clipboard, Dialogs, Editable, Style, UI Classes: App, Arc, Arrow, ArtDrawable, Background, Bg, Border, Button, Canvas, Check, Clogs, Code, Control, Del, DisplayService, DocumentRoot, Drawable, EditBox, EditLine, Em, Fg, Flow, Image, Ins, Line, Link, ListBox, Log, Mask, Oval, Painter, Para, Paragraph, Path, Progress, Radio, Rect, Run, Shape, Slot, SlotDecoration, Span, Stack, Star, Strong, Sub, SubscriptionItem, Sup, TextBlock, TextDrawable, Video, Widget
Constant Summary collapse
- VERSION =
"0.1.0"
Class Attribute Summary collapse
-
.default_font_family ⇒ Object
libui takes a font family name and resolves it per platform.
- .default_font_size ⇒ Object
- .monospace_font_family ⇒ Object
Class Method Summary collapse
-
.rounded_rect(path, x, y, w, h, r) ⇒ Object
A rounded rectangle, built from four quarter-circle arcs.
Class Attribute Details
.default_font_family ⇒ Object
libui takes a font family name and resolves it per platform.
40 41 42 43 44 45 46 |
# File 'lib/clogs.rb', line 40 def default_font_family @default_font_family ||= case RUBY_PLATFORM when /darwin/ then "Helvetica" when /mingw|mswin/ then "Segoe UI" else "Sans" end end |
.default_font_size ⇒ Object
50 51 52 |
# File 'lib/clogs.rb', line 50 def default_font_size @default_font_size ||= 14 end |
.monospace_font_family ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/clogs.rb', line 56 def monospace_font_family @monospace_font_family ||= case RUBY_PLATFORM when /darwin/ then "Monaco" when /mingw|mswin/ then "Consolas" else "Monospace" end end |
Class Method Details
.rounded_rect(path, x, y, w, h, r) ⇒ Object
A rounded rectangle, built from four quarter-circle arcs.
7 8 9 10 11 12 13 14 15 |
# File 'lib/clogs/drawables/shapes.rb', line 7 def self.rounded_rect(path, x, y, w, h, r) r = [r, w / 2.0, h / 2.0].min hp = Math::PI / 2 path.arc_figure(x + r, y + r, r, Math::PI, hp) path.arc_to(x + w - r, y + r, r, -hp, hp) path.arc_to(x + w - r, y + h - r, r, 0, hp) path.arc_to(x + r, y + h - r, r, hp, hp) path.close end |